Recent

Author Topic: TListbox: scrollbar disappears  (Read 1069 times)

wschulte

  • New Member
  • *
  • Posts: 30
TListbox: scrollbar disappears
« on: February 15, 2020, 03:23:47 pm »
 Why does the scrollbar of a TListbox disappear behind a tabsheet. It is already visible in the designer. In the next example a simple button toggles the visibility of a listbox. When it gets visible it is displayed over the tab, but the part of the vertical scrollbar that should overlay the tab get invisible.
I include a simple example demonstrating the effect.

I tried a view things (as BringToFront, SendToBack), but nothing seems to help.

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: TListbox: scrollbar disappears
« Reply #1 on: February 15, 2020, 04:00:14 pm »
The Scrollbar is not part of the client area so that could be the issue..

Also there could be a bug in the LCL controls for that, not sure about that one..

What widget set are you using ?

In any case, you can use a TPanel has the parent of the list box and have the listbox align to client to the Tpanel, then test for the Panel visibility after that.
The only true wisdom is knowing you know nothing

BrunoK

  • Sr. Member
  • ****
  • Posts: 452
  • Retired programmer
Re: TListbox: scrollbar disappears
« Reply #2 on: February 15, 2020, 04:33:57 pm »
You have ListBox1.Visible = false !

wschulte

  • New Member
  • *
  • Posts: 30
Re: TListbox: scrollbar disappears
« Reply #3 on: February 16, 2020, 12:17:14 pm »
@jamie: thanks for that; displaying it on a TPanel works and makes the scrollbar completely visible. I am using a Gtk2 widgetset.

@BrunoK: I know, but not after you press the button  ;)

BrunoK

  • Sr. Member
  • ****
  • Posts: 452
  • Retired programmer
Re: TListbox: scrollbar disappears
« Reply #4 on: February 16, 2020, 12:28:48 pm »
@BrunoK: I know, but not after you press the button  ;)
Superficial read of your message. To quick to post ...

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: TListbox: scrollbar disappears
« Reply #5 on: February 16, 2020, 03:29:29 pm »
The Scrollbar is not part of the client area so that could be the issue..

It's not just the scroll bar but the whole listbox. To test it one has to click the button and then change tabs: the overlaping part of the list box then disappears under the tab sheet and there is no way of bringing it to "front", not even selecting its items, other than to click the button to hide/show it again (see attached image)

BTW, the OP's example lacks some files; I'm attaching a full compilable project.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: TListbox: scrollbar disappears
« Reply #6 on: February 16, 2020, 07:02:46 pm »
The parent must be wrong then..,.

I don't call that a BUG, it's a FEATURE  :P
The only true wisdom is knowing you know nothing

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: TListbox: scrollbar disappears
« Reply #7 on: February 16, 2020, 09:00:32 pm »
The parent must be wrong then..,.

No, the parent of all the controls is the form, as is normal. The problem seems to be that the tab sheet is drawn in the absolute front rather than in the front of the page control's area.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018