[wxruby-users] ListCtrl.get_selections broken?

Alex Fenton alex at pressure.to
Wed Mar 11 09:27:13 EDT 2009


Christian - you didn't say, but I'm assuming you're working on Windows 
b/c I now tried it there and can reproduce the problem.

I've no idea why Windows differs here, but fortunately it's easy to fix. 
The definition of get_selections is in Ruby and is in 
lib/wx/classes/listctrl.rb. If you want the definition that works on 
Windows, add something like this to your script:

class Wx::ListCtrl
  def get_selections
    selections = []
    item = get_next_item(-1, Wx::LIST_NEXT_ALL, Wx::LIST_STATE_SELECTED)
    while item >= 0
      selections << item
      item = get_next_item(item, Wx::LIST_NEXT_BELOW, 
Wx::LIST_STATE_SELECTED)
    end
    selections
  end
end

The only change is Wx::LIST_NEXT_ALL was previously LIST_NEXT_BELOW.

I'll apply this to wxRuby once I've tested on other platforms. Thanks 
again for the report.

a





More information about the wxruby-users mailing list