keyboard messages ...

Hi Folks,

Panda under wxWidges; Doing the setFocus() call according to

shashank from Tue Jul 08, 2008 8:42 pm

from ctypes import windll
user32dllHandle = windll.user32

pandaWindowHandle = user32dllHandle.GetWindow(parentWindow.GetHandle(), 5)
#the second parameter stands for the constant GW_HWNDPREV in windows.h
#the value of this parameter might depend on the order in which the #children are added to the parent of pandaWindow, assuming the
#parent might contain other windows beside pandaWindow

#finally when the parent gets focus I call this
user32dllHandle.SetFocus(pandaWindowHandle)

and then I try to bind

            self.accept('q', self.InitViewPoint )

but all I get is

DirectStart: Starting the game.
Verbose mode true.  quiet list = ['event-loop-done', 'NewFrame', 'avatarMoving']
:Messenger(debug): sent event: open_window sentArgs = [<libpanda.GraphicsWindow object at 0x02B10548>, True], taskChain = None
:Messenger(debug): sent event: open_main_window sentArgs = [], taskChain = None
:Messenger(debug): object: <__main__.App; proxy of <Swig Object of type 'wxPyApp *' at 0x28cf050> >
 accepting: q
 method: <bound method App.InitViewPoint of <__main__.App; proxy of <Swig Object of type 'wxPyApp *' at 0x28cf050> >>
 extraArgs: []
 persistent: 1
:Messenger(debug): object: <__main__.App; proxy of <Swig Object of type 'wxPyApp *' at 0x28cf050> >
 accepting: q
 method: <bound method App.InitViewPoint of <__main__.App; proxy of <Swig Object of type 'wxPyApp *' at 0x28cf050> >>
 extraArgs: []
 persistent: 1
:Messenger(warning): object: App was already accepting: "q" with same callback: InitViewPoint()

and this has me wondering what’s happening!!

any of you have a clue?

cheers Martin

It means you must have called set.accept(‘q’, self.InitViewPoint) more than once.

David

Sorry, it was late in the night and the second accept slipped my notice.

but still I’m not getting them darn keyboard events.

any Idea?

cheers Martin

You don’t provide much specific information, so there’s not much I can go on here. I suggest you put in a print statement whenever you call SetFocus() so you can be sure that you are actually calling it.

David

Ha Got It!

I was adressing the wrong window!

cheers Martin