Page 1 of 1

How can i have a keyboardevent allways transleted to another

Posted: Thu Nov 17, 2011 1:54 am
by Markus Walter
Hi,

what is the best way to "translate" a special Keyboard-Event to another for the whole application? f. e. User press "#" on keyboard and i want "translate" this to ESC (so that the application behaves like ESC was pressed).
Any hints are welcome.

Re: How can i have a keyboardevent allways transleted to ano

Posted: Thu Nov 17, 2011 1:52 pm
by digitsoft
This can help you
PostAppEvent (xbeP_Keyboard, 27,, SetAppFocus ())

Paulino Nolberto
Regards

Re: How can i have a keyboardevent allways transleted to ano

Posted: Thu Nov 17, 2011 9:44 pm
by rdonnay
If all your windows are eXpress++ windows you could use the DC_ReadGuiHandler() funtion.

Code: Select all

FUNCTION Main()

DC_ReadGuiHandler({|a,b,c,d|MyGlobalHandler(a,b,c,d)})

....

RETURN nil

* ------------

FUNCTION MyGlobalHandler( nEvent, mp1, mp1, oXbp )

IF nEvent == xbeP_Keyboard .AND. Chr(mp1) = '#'
  PostAppEvent(xbeP_Keyboard, xbeK_ESC,, oXbp )
  RETURN DCGUI_IGNORE
ENDIF

RETURN DCGUI_NONE


Re: How can i have a keyboardevent allways transleted to ano

Posted: Fri Nov 18, 2011 3:17 am
by Markus Walter
Hi Roger,

thanks for the hint.

I still have a global handler function and i make the same thing with F10 to prevent that the Menubar receives focus, but have i still forgotten this... Sorry.