On Sunday 12 July 2009 08:31:55 pm tim awa wrote:
> I wanted to trap a particular keystroke while in a grid column and
> replace it with a two keystroke combination.
>
> This is done in VFP by overriding grid.Column1.Text1.Keypress
>
> LPARAMETERS nKeyCode, nShiftAltCtrl
> NODEFAULT
> IF nKeyCode = 123
>    KEYBOARD 'Hi'
> ENDIF
>
> How to do this in Dabo?

To capture the keypress you need bind an event:

someControl.bindEvent(dEvents.KeyChar, self._keypress)

The question in my mind is what you need to bind too.  I have not done it but 
I bet  there is some way to bind an event to a cell.

Below is an example of do something with the keys.
def _keypress(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 
        #print keyChar 
        keyChar=evt.keyChar
if (keyChar in """,./<>?;':"[]\\{}|`...@#$%%^&*()_=+"""): 
            evt.stop()

johnf


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to