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
On Jul 10, 2006, at 3:42 PM, 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...This is a bug. I''ve filed a bug report about it, and will get it fixed in the next release.
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. | +----------------------------------------------------------------------------+
On Jul 10, 2006, at 4:26 PM, Jeroen van der Zijp wrote:> As far as I can tell from here, setting -1 should be possible; it > could > be in the FXRuby binding itself.Yes, it''s an FXRuby bug.> 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...Hmmm... Maybe I was right all along and just didn''t know it. ;) Anyways. After the bug fix, FXRuby will at least be consistent with FOX in terms of setting the current item index to -1.