[fxruby-users] FXComboBox with no currentItem

Jeroen van der Zijp jeroen at fox-toolkit.org
Mon Jul 10 17:26:14 EDT 2006


On Monday 10 July 2006 15:42, Joel VanderWerf wrote:
> 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"?
> 

As far as I can tell from here, setting -1 should be possible; it could
be in the FXRuby binding itself.

No to be honest, the FXComboBox uses the FXList in browse-select mode,
which means as long as there is at least ONE item, the current item
should be >=0...



		- Jeroen





-- 
+----------------------------------------------------------------------------+
| Copyright (C) 23:30 03/30/2006 Jeroen van der Zijp.   All Rights Reserved. |
+----------------------------------------------------------------------------+


More information about the fxruby-users mailing list