Listboxes

From Team Developer SqlWindows Wiki
Jump to: navigation, search

ListBox


Contents


Pointer2.png How to force/set listbox horizontal scrollbar width Pointer.png

When inserting text into a listbox, the horizontal scrollbar is automatically shown when the text is larger than the listbox width.
You can force the horizontal scrollbar to be shown and set the scrollbar width in pixels or you can force to hide the scrollbar.
When setting the width to a larger value than the largest text in the listbox, you can force empty space after the largest text item.
When setting the width to a smaller value, the text will be truncated.


When inserting new items to the listbox, the scrollbar width will be reset dynamically when the text is larger than the current scrollbar width.
You can also get the current scrollbar width.
For this to work, you will have to set the listbox attribute Horizontal Scroll to Yes.


First define these constants

Number: LB_GETHORIZONTALEXTENT    = 0x0193
Number: LB_SETHORIZONTALEXTENT    = 0x0194

Now, here the code to set and get the scrollbar width:

   ! Set the width to 500 pixels
   Call SalSendMsg( lbTest, LB_SETHORIZONTALEXTENT, 500, 0 )
   ! Get the width
   Set nWidth = SalSendMsg( lbTest, LB_GETHORIZONTALEXTENT, 0, 0 )

Here you can download a sample:
Down.png WIKI_ForceListboxScrollbar.zip