[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QT5 ListBox Problem


On Sun, 1 Mar 2026 at 20:57, Lee <t.lee.davidson@xxxxxxxxx> wrote:

> On 2/28/26 1:00 PM, Lee wrote:
> > On 2/28/26 2:42 AM, Benoît Minisini wrote:
> >> Le 28/02/2026 à 06:25, Lee a écrit :
> >>> On 2/27/26 7:19 PM, Benoît Minisini wrote:
> >>>> Le 27/02/2026 à 21:25, Lee a écrit :
> >>>>>> Does the problem occur with the master branch?
> >>>>>>
> >>>>>
> >>>>> Yes, the issue persists on 3.21.99 409093b (master) with all three
> of those GUI toolkits.
> >>>>>
> >>>>> It occurs only if ListBox.ScrollBar is set to include Horizontal
> with either Scroll.Horizontal or Scroll.Both.
> >>>>>
> >>>>>
> >>>>
> >>>> I asked because I can't reproduce the problem. Can you send me a
> little project that shows the bug?
> >>>>
> >>>
> >>> I've discovered that the issue occurs if ListBox.Scrollbar is set to
> include Scroll.Horizontal *prior* to ListBox.List being
> >>> populated (which would include setting it via the IDE's property
> sheet). A project that shows the bug is very simple.
> >>>
> >>> Merely add a ListBox to a form, set its Scrollbar property to None so
> it can be controlled programmatically, and then use
> >>> just this code in FMain.class:
> >>>
> >>> [code]
> >>> Public Sub Form_Open()
> >>>
> >>>      ' ListBox1.ScrollBar = Scroll.Both ' Setting it here causes the
> issue
> >>>      ListBox1.List = ["One", "Two", "Three", "Four", "Five", "Six",
> "Seven", "Eight", "Nine", "Ten"]
> >>>      ' ListBox1.ScrollBar = Scroll.Both ' Setting it here does not
> cause the issue
> >>>
> >>> End
> >>> [/code]
> >>>
> >>>
> >>
> >> Thanks, it should be fixed in master now.
> >>
> >> Regards,
> >>
> >
> > Unfortunately, no, it is not fixed in version 3.21.99 cc76782 (master).
> >
> > I tried using ListBox1.Refresh after setting the List, but that didn't
> help.
>
> I found that setting ListBox1.Wrap = True prior to populating the List
> causes the ListBox to behave as expected.
>
> In the gb.gui.base source code for the UpdateLayout() subroutine: if
> $bWrap is true, line 230 sets $hView.AutoResize = True,
> else if the Scroll.Horizontal bit is set, line 238 sets $hView.AutoResize
> = False.
>
> I commented out line 238 and recompiled with `make install`. That fixes
> it. But, I don't know what other issues that may cause.
>
>
> --
> Lee


But i guess if Wrap = True then horizontal scrollbar will not even be used,.
If you want to use any Horizontal scrollbar then Wrap must surely be False.

Doing something like this works around the problem on a ListBox with Wrap =
False and ScrollBar = Both..

Public Sub Form_Open()

  ListBox1.List = Dir("~")

' now force set ListBox GridView column 0 width again
  Dim gv As GridView = ListBox1.Children[0]
  gv.Columns[0].W = -1

End

But that's only a workaround suitable for versions before it's fixed.
Respects
BruceS

Follow-Ups:
Re: QT5 ListBox ProblemLee <t.lee.davidson@xxxxxxxxx>
References:
Re: QT5 ListBox ProblemLee <t.lee.davidson@xxxxxxxxx>