[wxPython-users] GridCellChoiceEditor

Robin Dunn robin at alldunn.com
Tue Feb 5 14:55:47 PST 2008


Mark Erbaugh wrote:
> Is is possible to change the values in the drop down list of a
> GridCellChoiceEditor on the fly?
> 
> I have two columns in a grid. In the first column, the user selects the
> category (via a GridCellChoiceEditor), in the second column, they need
> to select an item within the selected category.
> 
> I tried using the Editor's SetParameters method in the select cell event
> handler when the user selects the items column  with interesting
> results. It seems like only the SetParameters calls made the first time
> the event handler is called are effective.  The C++ code shows that
> SetParameters calls reset the parameters to the new values. In fact, if
> I call SetParameters twice in the event handler, the values in the drop
> down list are from the last call. 
> 
> However, SetParameters calls in subsequent calls the the event handler
> (which I verified are being invoked with print statements) are not
> showing up in the drop down list.
> 
> My guess is that the actual control is created before the first time it
> drops down, using the values from the most recent SetParameters call.
> Once the control is created, changes to SetParameters don't refresh the
> values in the control.

The control is created the first time the editor is activated, but after 
that it will be kept around and just hidden until it is needed again. 
IIRC you can destroy the control when the editor is hidden and then the 
next time the editor is activated it will create it again, and so it 
should then use the new parameters you have set.  OTOH, once you've got 
a reference to the actual widget then you can change the values yourself.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list