Page 1 of 1

simulate pressing the F2

Posted: Tue Feb 28, 2012 1:10 pm
by MIGUELON
Hi all, not if I can help.
I need to simulate pressing the F2 key, pressing a button. The code I am trying to use is the following but not working.


@ 20, 0 DCTOOLBAR oBotonesTecla SIZE 110,3 BUTTONSIZE 11,3


DCADDBUTTON CAPTION 'F2';
PARENT oBotonesTecla;
ACTION {||PostAppEvent(xbeK_F2,,,DC_GetListObject( GetList ))}


Thank you very much for your help. :think:
Miguel

Re: simulate pressing the F2

Posted: Tue Feb 28, 2012 1:49 pm
by TWolfe
Try the following:

ACTION {||PostAppEvent(xbeP_Keyboard,xbeK_F2,NIL,DC_GetListObject( GetList ))}

HTH,
Terry

Re: simulate pressing the F2

Posted: Tue Feb 28, 2012 2:19 pm
by MIGUELON
Thank you very much for your help but I changed the code and gives me the error.

Re: simulate pressing the F2

Posted: Tue Feb 28, 2012 3:28 pm
by TWolfe
The object needs to be the object receiving the keyboard events. If you do not have multiple event handlers, just try:

ACTION {||PostAppEvent(xbeP_Keyboard,xbeK_F2)}

This sends the event to the appWindow (The value of a SetAppWindow() call).

Otherwise you need to pass the object that will receive the event.

Terry

Re: simulate pressing the F2

Posted: Tue Feb 28, 2012 3:53 pm
by MIGUELON
OK I works if the object as follows:
ACTION {||SetAppFocus(oOrigen),PostAppEvent(xbeP_Keyboard,xbeK_F2,,oOrigen)}

The problem is that not what the object where it is, there are several objects (gets)

Thank you very much
Miguel