Re: How to bind a keyevent to a Python Card window?
Kevin Altis <[email protected]> Mon, 3 Aug 2009 09:15:48 -0700
| Newsgroups | gmane.comp.python.pythoncard |
|---|---|
| Message-ID | <[email protected]> |
On Aug 3, 2009, at 1:39 AM, Alec Bennett wrote:
> I'm trying to bind a key event to a Python card window. Something
> like:
>
> self.Bind(wx.EVT_KEY_DOWN, self.onKey)
>
> The "onKey" function should be triggered whenever a key is pressed
> when the window has focus. The event isn't being caught though.
>
> Wondering if anyone might have any tips?
If you use the Message Watcher window (-m from the command-line) you
can see which events are firing when you type in your window. The
keyDown, keyUp, and keyPress events are your choices for processing.
Chances are you don't actually want a key event bound to the window
itself, since whatever component that has focus will actually be
getting the event and it will pass up the chain to the window. So,
chances are you'll have something like
on_keyPress(self, event):
keyCode = event.keyCode
if keyCode == 13:
print "user pressed return"
event.skip()
If you use the findfiles tool you can search for
on_.*_key
within the PythonCard folder and see all the samples and tools that
use keyDown, keyUp, and keyPress events.
ka
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july