• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Action based on user hitting F1

#1
All,
I have a need to capture the "F1" key to initiate an action. I have been looking for code that does this, but so far I have come up empty. This is for Eagle software so it will be something along the lines of:
if rf_response_1 = "F1" then do:
end.

I do not know what to replace "F1" with to get the expected action.

Regards,
David
 
#2
Is this what you're after?

Code:
DEF VAR I AS INTEGER.

/* The program will accept the user's input for the I value and continue after the user presses F1 or ENTER. */
UPDATE I GO-ON(F1 ENTER).

IF LASTKEY=KEYCODE("F1") THEN
DO:
    /*    Do whatever you want*/
    message "F1 PRESSED! VALUE OF I IS" i.

END.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
#4
Isn't F1 the "HELP" key?
I think it depends on the client and the version. In a vanilla Windows install, the GUI client uses F1 for help and F2 for run. In the CHUI they're reversed. Same goes for CHUI on non-Windows platforms.

In our GUI app, we specify "v6keys=yes" in the [Startup] section of the .ini file. This swaps the function of F1 and F2 (and it probably changes other things too). I'd guess this was done for consistency when we went from v6 to v8.