[fxruby-users] FXComboBox with no currentItem

Joel VanderWerf vjoel at path.berkeley.edu
Mon Jul 10 16:42:10 EDT 2006


It used to be the case that -1 represented the state of having no 
current item, but that doesn't seem to be the case now in 1.6. If I 
modify groupbox.rb like so:

     combobox = FXComboBox.new(group3, 5, nil, 0,
       COMBOBOX_INSERT_LAST|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP)
     combobox.appendItem("Very Wide Item")
     for i in 0...3
       combobox.appendItem("%04d" % i)
     end
     combobox.currentItem = -1

Then I get an IndexError. It also fails with setCurrentItem(-1). And it 
fails using nil in place of -1.

The rdoc for FXComboBox says:

currentItem   [RW]    Index of current item, or -1 if no current item 
[Integer]

Is there any way to say "no current item"?

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407


More information about the fxruby-users mailing list