wxGrid and wxGridCellChoiceEditor

Joachim Wiesemann newsantwort.xyz at jwiesemann.de
Fri Jun 1 01:12:23 PDT 2007


Am Wed, 30 May 2007 20:36:39 +0200 schrieb Manuel Martín:

> Hi
> 
>> I am using a wxGrid to display and edit parameters for an embedded
>> control. (Windows, wxWidgets 2.8.0rc2) To mark parameters which are
>> changed and not yet sent to the device I use an italic font and the
>> color red.
>> 
>> Sadly the wxGridCellChoiceEditor doesn't react on these changes. The
>> wxComboBox used by this editor does not seem to be capable of these
>> features. (at least on Windows)
> 
> AFAIK, no.
> But you can launch (better in another frame) another grid (instead of
> choices) in response to EVT_GRID_CELL_LEFT_CLICK in the main grid and
> do whatever.

Well, I think the combo box is fine. I just want the colors during the
normal display, not while editing the value.

>> I figured out that I can keep the standard string editor and change that
>> one to the choice editor with a GRIDEDITORSHOWN event. (Which seems to
>> be issued before the editor is shown.) Sadly the GRIDEDITORHIDDEN event
>> is issued to early to change everything back. The CELLCHANGED event is
>> not issued if the editor is left with an <esc>.
>> 
>> Is there any other event I can use or another workaround I can use?
> 
> If you want to use your own editor, take a look at src/generic/grid.cpp
> and gridctrl.cpp and learn how current made editors work.
> Don't forget to make your own renderer.

I already tried to change the renderer with     

SetCellRenderer(row,col,new wxGridCellStringRenderer());

Because I just want the colors in the normal grid display. But that
didn't show any effect. Do I really have to completly program my own
editor and renderer for this?

Best regards,
Joachim

-- 
Dr. Joachim Wiesemann
http://jwiesemann.com/     Electrical Engineering, Usability






More information about the wx-users mailing list