Forum: wxRuby Add values in GridCellChoiceEditor

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D9835683fa592c06cd8c095655af4494?d=identicon&s=25 Marija Velickovic (maricanis)
on 2011-04-11 14:32

I'm using GridCellChoiceEditor for some cells in Grid object.
At the beginning values inside choice are initialized like in grid.rb

@editor_c =['foo', 'bar', 'baz'])
@grid.set_cell_editor(4, 3, @editor_c)

After that when script is started this cell is empty and user can select
one of values. So this behavior is ok.

While program is running I want to add new values into this choice
editor, so I do next in the code:
@editor.set_parameters("foo, bar, baz, new")

After that nothing happens and choices still have the same old list of

I also tried to use local variable for editor instead on instance
edit = @grid.get_cell_editor(4,3)
edit.set_parameters("foo, bar, baz,new")

Again list is not updated, and 'new' string is not added.

Only way I've found for now to be able to update editor, is to have
empty grid (so nothing is selected in choice cells), and then update
This is no acceptable for my application, because list of values in
choice cells should be updated during the program running few times
(depending on some other user actions).

What am I doing wrong?
Is it possible to update list of values in choice editor while program
is running?

Thanks in advance,
D9835683fa592c06cd8c095655af4494?d=identicon&s=25 Marija Velickovic (maricanis)
on 2011-04-12 11:01
Hi again,

I've found possible solution for this problem in WxPython Wiki pages

from this page:
"A common question is how to dynamically update the list in a
GridCellChoiceEditor. The problem comes from not having direct access to
the underlying ComboBox widget in the grid editor. Fortunately the grid
editor throws an event that allows us to get to the underlying

I convert Python code for Ruby but I have a problem how to get
underlying ComboBox from GridCellChoiceEditor

If I use Wx::GridEditorCreatedEvent.get_control function (like in Python
code - line 249 on wiki page), I get Wx::Control object instead of
Wx::ComboBox or Wx::Choice.

So question is how to convert Wx::Control object to Wx::ComboBox to be
able to dynamically change list of its values.

Hope somebody has an answer,
E7f3cbcb69beec85643d1ecc54121460?d=identicon&s=25 David Beswick (davidbeswick)
on 2011-04-12 12:23
(Received via mailing list)
Hi Marija, that's strange because Ruby doesn't really have a way to cast
between types. Maybe it's a SWIG problem. Could you post a small code
that shows the issue?
This topic is locked and can not be replied to.