• Welcome to PlanetSquires Forums.
 

WinFBE 3.0.0 Beta 3 - ListBox - Horizontal ScrollBar

Started by SeaVipe, April 26, 2022, 02:35:56 PM

Previous topic - Next topic

SeaVipe

Hi Paul, ListBox Horizontal ScrollBar is visible but disabled regardless of the width of the items. Vertical ScrollBar works as expected.
Clive Richey

philbar

Hi Clive,

As far as I can tell, list boxes have kind of strained diplomatic relations with horizontal scrolling. Try adding one of these to your Form_Load event:

sendmessage(frmmain.list1.hwindow, LB_SETHORIZONTALEXTENT, 500, 0)

where 500 (or whatever) is the number of pixels of scroll you'll allow. Its default value is 0, so there's no scrolling. By the way, if you try to use the horizontal extent property in the toolbox, you may regret it.

Phil

SeaVipe

Thank you, Phil,
I tried the toolbox HorizontalExtent property earlier; I promptly set that value back to 0!
I also tried your suggestion:
sendmessage(frmmain.list1.hwindow, LB_SETHORIZONTALEXTENT, 500, 0)
but it had no effect on the scrollbar - it remained disabled. As the list box does not update its horizontal extent dynamically, I experimented calling it in the procedure that updates the ListBox - still no effect.
If all else fails, I could simply place the too-long text value in the ListBox ToolTip.
I'll continue reviewing this issue and report my findings here.
Clive Richey

Paul Squires

It does look like (for whatever reason) the HorizontalExtent property is not defined when you change its value in the PropertyList of the visual designer. I have logged that as an issue to be fixed. Once Version 3 is released I will shift my focus to the visual designer and update/fix/expand that framework.

In the meantime, I tried a couple of tests and place LB_SETHORIZONTALEXTENT in the Form Load handler seems to work.

''
''
Function frmMain_Load( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT
   SendMessage(frmMain.List1.hWindow, LB_SETHORIZONTALEXTENT, 500, 0)
   frmMain.List1.Enabled = true
   dim as CWSTR wszText
   for i as long = 0 to 100
      wszText = "This is a very long line of text, does the scrollbar work?"
      frmMain.List1.Items.Add( wszText )
   next
   frmMain.List1.BackColor = colors.Beige
   Function = 0
End Function


Be sure to set the "500" value to a sufficiently high enough value given the width of your listbox and the text in it.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

Thanks, Paul & Phil,
This worked for me:

SendMessage(frmMain.List1.hWindow, LB_SETHORIZONTALEXTENT, 1500, 0)
The key here is to set wParam > than the width of the ListBox, not the number of pixels > the width of the ListBox. In my case, 500 did not enable the H ScrollBar on a ListBox width of 1100, a value of 1500 did.
Clive Richey

philbar

Okay, I think that means I also misread the description of LB_SETHORIZONTALEXTENT. The number is the width of the "virtual" listbox, not the number of pixels added.

But now that I'm looking at it, has anybody else noticed the odd quirk that happens when you scroll right to reveal the hidden characters? It's not fatal, because the text is drawn properly as soon as the mouse touches it, but it's a little surprising. I see it on my work computer and at home.


SeaVipe

Clive Richey