[wxPython] wxPyGridCellEditor.StartingKey question

Robin:
Your suggestion works! In StartingKey I dynamically connect the grid window's wxEVT_CHAR event to a method called OnGridChar and call event.Skip. Then, when OnGridChar gets called I grab the char, insert it into the custom cell editor, and disconnect the grid window's wxEVT_CHAR event.

One peculiarity - the very first char is not caught unless I click on the grid at least once.

It seems as though wxGrid is still leaking memory. Is that right?

Thanks!

Mark

···

From: "Robin Dunn" <robin@alldunn.com>
Reply-To: wxpython-users@lists.wxwindows.org
To: <wxpython-users@lists.wxwindows.org>
Subject: Re: [wxPython] wxPyGridCellEditor.StartingKey question
Date: Mon, 29 Apr 2002 21:22:44 -0700

> The problem I'm having is with the wxKeyEvent event passed to StartingKey.
> The key event is untranslated, so I don't receive the actual character,
but
> the key and the state of the shift, control and alt keys. What I want is
> the translated character. But, since "the translation is keyboard-layout
> dependent and can only be done properly by the system itself," how do I
get
> the actual character or translate the wxKeyEvent within StartingKey?

Unfortunatly there is not a way currently. This was discussed recently on
wx-dev and I think it was decided to do the editor activation on an EVT_CHAR
event rather than the EVT_KEY_DOWN, and then it would be translated when you
get it. It doesn't look like it's been done yet, so you may want to check
and see if there is a bug report for it on SF to see the status. (If there
isn't one, then create it.)

I just thought of a hack that may work. In your StartingKey just call
event.Skip() and then hook an EVT_CHAR handler to grid.GetGridWindow().
When the event happens add the char to the control and then Disconnect the
handler.

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

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

One peculiarity - the very first char is not caught unless I click on the
grid at least once.

Because the grid window must have focus for the hack to work. YOu could
probably get around that by hooking EVT_CHAR for the other component windows
too.

It seems as though wxGrid is still leaking memory. Is that right?

How are you seeing it?

···

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