[fxruby-users] FXListBox size behavior?

Jeroen van der Zijp jeroen at fox-toolkit.org
Wed Mar 23 22:24:34 EST 2005

On Wednesday 23 March 2005 04:32 pm, David Peoples wrote:
> The default behavior of FXListBox seems to be to grow and shrink in 
> width depending on the length of the selected entry in the list. This is 
> a problem when the list contains items of varying width, because if a 
> short item is picked then the longer entries are obscured in the 
> drop-down list.

> Is this deliberate, an oversight, or a bug? Its certainly not how I'd 
> choose it to act. Is there some combination of options in the "new" 
> method, or some layout manager setup, that can force the listbox to stay 
> one (appropriately wide) width?

Yes, looking through the code I see that there could indeed be a problem.
What happens is that the getDefaultWidth() of the FXListBox reflects only
the size of the currently selected text, and not the size of ALL the texts
in the list.  This is wrong, plain and simple!

In FXComboBox I fixed this by setting HSCROLLING_OFF on the embedded FXList,
if the combobox is static.  Since FXListBox pretty much behaves like a static
FXComboBox, this should probably be done inside FXListBox also.

I would suggest, for now, hard-wire the size of the FXListBox to the desired 
width, with the LAYOUT_FIX_WIDTH flag.  Then the parent widget will ignore
the value of getDefaultWidth() and just give it the right size.

Thanks for the bug report,


| Copyright (C) 19:30 03/23/2005 Jeroen van der Zijp.   All Rights Reserved. |

More information about the fxruby-users mailing list