Index
2009-07-24 15:28 – John : [dabo-users] using evt.keyCode in windows
2009-07-25 12:12 – John : Re: [dabo-users] using evt.keyCode in windows
Back to top
[dabo-users] using evt.keyCode in windows

Author: John

Posted: 2009-07-24 15:28:20   Link

Hi,

Under windows I want to use F4,F7, and return to activate a method. So I have

been binding the dEvents.KeyChar to a method to capture the keystokes.

vendcomp is a dabo.ui.dTextBox

if sys.platform == 'win32':

vendcomp._addWindowStyleFlag(wx.TE_PROCESS_ENTER)

vendcomp.bindEvent(dEvents.KeyChar, self._lookup)

def _lookup(self,evt):

from dabo.ui import dKeys as dKeys

if evt.keyCode in

[dKeys.key_F1,dKeys.key_F2,dKeys.key_F3,dKeys.key_F5,dKeys.key_F6,dKeys.key_F8,dKeys.key_F9,dKeys.key_F10,dKeys.key_F11,dKeys.key_F12]:

return

if evt.keyCode in [dKeys.key_F7, dKeys.key_F4, dKeys.key_Return]:

thestr= self.Form.lookup(evt)

return

if evt.keyChar is not None:

keyChar=evt.keyChar

if (keyChar in """,./<>?;':"[]\\{}|`~!@#$%%^&*()_=+"""):

evt.stop()

return

The Problem is under windows the left arrow, right arrow, the delete key do

not work. I do use "_addWindowStyleFlag(wx.TE_PROCESS_ENTER)" to capture

the "return" key. It was the only way I figure out how to force the return

key to work.

But I don't want to lose the arrow keys and the delete key. Anybody know how

I can have my cake and eat too? Of course all this works under Linux.

Johnf

©2009 John
Back to top
Re: [dabo-users] using evt.keyCode in windows

Author: John

Posted: 2009-07-25 12:12:04   Link

On Friday 24 July 2009 12:28:20 pm John wrote:

> Hi,

>

> Under windows I want to use F4,F7, and return to activate a method. So I

> have been binding the dEvents.KeyChar to a method to capture the keystokes.

>

> vendcomp is a dabo.ui.dTextBox

>

> if sys.platform == 'win32':

> vendcomp._addWindowStyleFlag(wx.TE_PROCESS_ENTER)

> vendcomp.bindEvent(dEvents.KeyChar, self._lookup)

>

>

> def _lookup(self,evt):

> from dabo.ui import dKeys as dKeys

> if evt.keyCode in

> [dKeys.key_F1,dKeys.key_F2,dKeys.key_F3,dKeys.key_F5,dKeys.key_F6,dKeys.key

>_F8,dKeys.key_F9,dKeys.key_F10,dKeys.key_F11,dKeys.key_F12]: return

> if evt.keyCode in [dKeys.key_F7, dKeys.key_F4, dKeys.key_Return]:

> thestr= self.Form.lookup(evt)

> return

>

> if evt.keyChar is not None:

> keyChar=evt.keyChar

> if (keyChar in """,./<>?;':"[]\\{}|`~!@#$%%^&*()_=+"""):

> evt.stop()

> return

>

> The Problem is under windows the left arrow, right arrow, the delete key do

> not work. I do use "_addWindowStyleFlag(wx.TE_PROCESS_ENTER)" to capture

> the "return" key. It was the only way I figure out how to force the return

> key to work.

>

> But I don't want to lose the arrow keys and the delete key. Anybody know

> how I can have my cake and eat too? Of course all this works under Linux.

>

> Johnf

Solved. Larry pointed out that the code were a match to the way VFP

keystrokes worked. So I added.

if (keyChar in """,./<>?;':"[]\\{}|`~!@#$%%^&*()_=+""") and (evt.keyCode < 126

and evt.keyCode >=32) :

Johnf

©2009 John