Hi,
I’m using a Wx::GridCellChoiceEditor within a Wx:grid. I have it
displaying as it should, but I now need to do something when a user
selects a string. The only likely looking event I can find is
evt_grid_cell_change. evt_grid_cell_change is calling the method I
defined when I click off the choice box, assuming the choice changed.
This is fine.
What I need to do, is get the newly selected item (or preferably
some client data asssociated with it) how do I do that? I can’t see any
likley methods, and inspecting the generated event is useless…
I currently have:
# Set up the event
evt_grid_cell_change {|event| cell_change(event)}
#Set up the rows, there is more to this, but it's just putting
values in cells…
@characters.each do |char|
weapons = Wx::GridCellChoiceEditor.new(char.weapons_list)
@grid.insert_rows
@grid.set_cell_editor(0,1,weapons)
end
#The method run when the selection changes
def cell_change(event)
row = event.get_row
character = Character.find_by_name(@grid.get_cell_value(row,0))
character.held_weapon = ???
end
What do I need to put in the ??? . As I said, ??? should ideally be
the string selected, or some data associated with it…
Thanks
Anthony