Real Software Forums
http://forums.realsoftware.com/

Auto-resizing columns in ListBox
http://forums.realsoftware.com/viewtopic.php?f=1&t=47988
Page 1 of 1

Author:  gemini0x4d [ Mon May 27, 2013 11:44 am ]
Post subject:  Auto-resizing columns in ListBox

Hi,

I searched this topic, but I didn't find a proper solution yet.

My program retrieves data from a MySQL database and displays it within a ListBox. Unfortunately, there seems to be no option to automatically adapt the column widths to the data within the cells. I'm looking for a pure RS solution without external plugins. Can you help me with this problem?

Kind regards,
gemini

Author:  DaveS [ Mon May 27, 2013 12:48 pm ]
Post subject:  Re: Auto-resizing columns in ListBox

easy.

As you load each cell... keep track of the max width of the data (using g.stringwidth)

when the listbox is loaded, add a bit of padding to your value, and set the column widths

Author:  gemini0x4d [ Tue May 28, 2013 8:02 am ]
Post subject:  Re: Auto-resizing columns in ListBox

Works! Thank you :-)

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/