Bookstore

Recent

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

wschulte

  • New Member
  • *
  • Posts: 19
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: 2490
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.
Number 1 at blue screen app creations!

BrunoK

  • Full Member
  • ***
  • Posts: 230
  • 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: 19
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

  • Full Member
  • ***
  • Posts: 230
  • 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: 2588
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 2.0.6/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

jamie

  • Hero Member
  • *****
  • Posts: 2490
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
Number 1 at blue screen app creations!

lucamar

  • Hero Member
  • *****
  • Posts: 2588
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 2.0.6/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.