[fxruby-users] FXListBox size behavior?

David Peoples davidp at touringcyclist.com
Wed Mar 23 17:32:57 EST 2005


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?

Code to demonstrate the problem below.

David

-- 
David Peoples  davidp at touringcyclist.com
The Touring Cyclist  http://www.touringcyclist.com
11816 St. Charles Rock Road, Bridgeton, MO 63044
tel: 314-739-4648  fax: 314-739-4972

-----------------------------------------------------

#!/usr/bin/env ruby

# tested using FXRuby 1.2.5 and Ruby 1.8.2 (One-click installer
# on Windows XP)

require 'fox12'
include Fox

application = FXApp.new("listboxtest", "FoxTest")
main = FXMainWindow.new(application, "FXListBox test", nil, nil, 
DECOR_ALL, 0, 0, 400, 200)

myListBox = FXListBox.new(main)
myListBox.appendItem("a very long example")
myListBox.appendItem("short")
myListBox.appendItem("longer")
myListBox.appendItem("even longer")
myListBox.appendItem("shorter")
myListBox.numVisible = myListBox.numItems

application.create
main.show(PLACEMENT_SCREEN)
application.run


More information about the fxruby-users mailing list