New topic: 

Fixed width ListBox columns

<http://forums.realsoftware.com/viewtopic.php?t=47014>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        cm_rb          Post subject: Fixed width ListBox columnsPosted: 
Thu Feb 21, 2013 11:19 am                         
Joined: Sat Dec 24, 2011 5:32 am
Posts: 30
Location: Germany                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 pixesl 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.   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to