Recent

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

Ten_Mile_Hike

  • Newbie
  • Posts: 3
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: 4311
  • 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

  • Newbie
  • Posts: 3
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: 4311
  • 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

  • Newbie
  • Posts: 3
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: 1477
  • 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].
Lazarus 2.1 r65061 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.1 r65182 FPC 3.3.1 r49223 macOS 11.4 aarch64 Xcode 12.4
Lazarus 2.1 r61574 FPC 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

MarkMLl

  • Hero Member
  • *****
  • Posts: 2840
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
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and 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