Hello,
I load data from a SQL-Database into a ListBox. Because I do not know in advance how many columns the ListBox will need to have, I put some code in the open event of the ListBox. The code tells how many columns the listbox (lb) should have and sets the width of the columns to 200 pixels.
Code example for a 10 column ListBox:
lb.ColumnCount = 10
dim i as Integer
for i = 0 to 9
lb.column(i).MinWidthActual = 200
lb.column(i).WidthActual = 200
next
Problem 1: After running then project, the horizontal scrollbar does not appear despite the fact, that the listbox content is much wider then the listbox. „ScrollBarHorizontal“ is checked in the IDE.
Problem 2: The above code behaves diferrently if I check/uncheck „AutoHideScrollbars“ for the listbox in the IDE and run the project. If „AutoHideScrollbars“ is checked, the column widths are not set to 200 pixels when I run the project.
Problem 3: When I resize the window/listbox the columns widths always change. The listbox seems to try to fit all the columns into its current width.
To solve Problem 3, I put some code in the „Resized“ event of the window, to make the column withs again 200 pixels wide:
dim i as Integer
for i = 0 to 9
lb.column(i).WidthActual = 200
next
The code in the „Resized“ event resizes the columns but leads to slow redrawing.
What am I doing wrong? How do you programmaticaly give the columns a fixed (or minimum) width which persists even when the window/listbox is resized? How do I make the horizontal scrollbar appear?
Real Studio 2012 R 2.1, Mac OS X 10.6.8