Recent

Author Topic: Solved Tscrollbar has a caption property ???  (Read 2381 times)

Ten_Mile_Hike

  • New Member
  • *
  • Posts: 49
Solved Tscrollbar has a caption property ???
« on: June 11, 2021, 06:28:35 am »
Using 2.0.12
How long has Tscrollbar have a caption property?
Tscrollbar isn't supposed to have a caption property is it? I'm confused.

Place a scrollbar 'SB1' on a form

Procedure test;
Begin
SB1.caption:= 'This works';
Form1.caption:=SB1.caption+', but why?' ;
End;
« Last Edit: July 22, 2021, 12:05:51 am by Ten_Mile_Hike »

Handoko

  • Hero Member
  • *****
  • Posts: 5149
  • My goal: build my own game engine using Lazarus
Re: Tscrollbar has a caption property ???
« Reply #1 on: June 11, 2021, 06:40:04 am »
As far as I know, all of the visual components have a caption property. They maybe not directly useful to you but it could be useful if you write a class inherited from them.

For example, the default TListBox has caption but it won't be visible to users. If I subclass it to TMyListBox, I may want to show a caption right above the position of the listbox. Something like: "Please select a category:".
« Last Edit: June 11, 2021, 06:42:09 am by Handoko »

Ten_Mile_Hike

  • New Member
  • *
  • Posts: 49
Re: Tscrollbar has a caption property ???
« Reply #2 on: June 11, 2021, 06:46:53 am »
Shouldn't "Caption"  be listed as a property in the documentation then???
I can find no mention of a "caption" property for Tscrollbar anywhere in the documentation.

Handoko

  • Hero Member
  • *****
  • Posts: 5149
  • My goal: build my own game engine using Lazarus
Re: Tscrollbar has a caption property ???
« Reply #3 on: June 11, 2021, 06:49:08 am »
Yes, it is documented on its ancestor class:
https://lazarus-ccr.sourceforge.io/docs/lcl/controls/tcontrol.html

When you study a class by reading the documentation, it's usually useful to read the documentation of its parent class too.
« Last Edit: June 11, 2021, 07:03:44 am by Handoko »

Ten_Mile_Hike

  • New Member
  • *
  • Posts: 49
Re: Tscrollbar has a caption property ???
« Reply #4 on: June 11, 2021, 07:41:39 am »
Thank you for your answer.
I'm new here. I don't know how to mark this topic as "answered", but I've been up for 20 hours
so maybe that has something to do with it.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Tscrollbar has a caption property ???
« Reply #5 on: June 11, 2021, 08:09:40 am »
Click "Modify" in your first post and prefix the original subject line with [SOLVED].

MarkMLl

  • Hero Member
  • *****
  • Posts: 6682
Re: Tscrollbar has a caption property ???
« Reply #6 on: June 11, 2021, 09:38:39 am »
Thank you for your answer.
I'm new here. I don't know how to mark this topic as "answered", but I've been up for 20 hours
so maybe that has something to do with it.

Don't worry, nobody's criticising you for it :-)

But as Handoko says, really you /do/ need to look back through ancestors since while they're very often marked "do not use directly" in many cases half of the functionality is only documented there.

I suggest keeping these as bookmarks somewhere:

https://www.freepascal.org/docs.html
https://lazarus-ccr.sourceforge.io/docs/

Those are for current FPC and Lazarus. Even though they appear to duplicate the RTL and FCL links, the versions might be different.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018