Kirix Support Forums

switching between wxGrid and wxTextCtrl

Please post all general questions, comments, bug reports, and any other wxAUI feedback here.

switching between wxGrid and wxTextCtrl

Postby platform on Tue Jun 26, 2007 9:09 am

Good Afternoon,
I apologize in advance if my question should be directed to
other forums (please let me know if that's the case).

Here is my issue:
I am using wxAUI included in wxWidget 2.8.4 on XP with
Visual C++ 2005 (32 bit) when linked with wxWidget static libraries
(and I also use boost::signals)

I am essentially creating a 'spreadsheet like' application.
So I am using directly the AUI example
where the GRID and textCtrl are created into separate Panes.

What I want to do is to every time a user clicks a cell on wxGrid
the cell value is read into the TextCtrl class.

So I am doing in the following way:

a) Intercept wxGrid OnCellChange,
b) read the cell value in a variable.
c) find using the PaneInfo the TextCtrl instance (it is another pane)
d) call a method in TextCtrl to 1) clear the context of the text
2) write the value of the Grid cell into the wxTextCtrl

e) call ev.Skip in the OnCellChange

the way I do d) (specifically calling a function of the wxTextCtrl
from within the wxGrid instance is using the boost signals
(but I also tried to call Update/Clear on textCtrl right from within grid's OnCellChange)

the problem is
that A) the text control never gets updated

the GRid cell movement using keyboard keys stops working
(although I think this is a separate problem, and I am not calling ev.Skip()
somewhere else)

So I was thinking that I should force the chance of the 'Window focus'
to the pane where the text control is... but there is no apparent way
to do that.

I also read a blog Article by Dmitry about using the 'Connect' method
for event handlers, but a) I am not clear on how to use it
b) I am not sure it will resolve my problem.

I actually do not have a problem updating the Grid's cells from within the textControl,
It is the other way: updating the textControl value when a Grid cell is selected...

thanks in advance
Registered User
Posts: 2
Joined: Tue Jun 26, 2007 8:33 am

Re: switching between wxGrid and wxTextCtrl

Postby platform on Tue Jul 03, 2007 11:52 pm

Figured out what the problem was.

I was using wxauitest.cpp as the example for my main app. And it created many panes with many text controls. (with the same Pane name)

And since I was searching for the text window to update by the pane name,
I was getting a different window from the one that was actually active (so I was updating with text the window whose pane was hidden).

The reason why Grid updates worked was because there was only one Grid pane.
Registered User
Posts: 2
Joined: Tue Jun 26, 2007 8:33 am

Return to wxAUI Questions, Thoughts & Feedback