7.71.3 IF_KEY Examples
The following example applies to the IF_KEY command.
Use the IF_KEY command to indicate to the user which function key he/she pressed:
BEGIN_LOOP
DISPLAY FIELDS(#ORDNUM #CUSTNUM #DATEDUE) EXIT_KEY(*YES L01) MENU_KEY(*YES L01) ADD_KEY(*YES) USER_KEYS((15 'Task1')(16 'Task2')(17 'Task3') (18 'Task4')(19 'Task5'))
L01: IF_KEY WAS(*ENTER)
MESSAGE MSGTXT('The ENTER key was pressed')
ENDIF
IF_KEY WAS(*MENU)
MESSAGE MSGTXT('The MENU key was pressed')
ENDIF
IF_KEY WAS(*ADD)
MESSAGE MSGTXT('The ADD key was pressed')
ENDIF
IF_KEY WAS(*USERKEY1)
MESSAGE MSGTXT('User key 1 (F15) was pressed')
ENDIF
IF_KEY WAS(*USERKEY2)
MESSAGE MSGTXT('User key 2 (F16) was pressed')
ENDIF
IF_KEY WAS(*USERKEY3)
MESSAGE MSGTXT('User key 3 (F17) was pressed')
ENDIF
IF_KEY WAS(*USERKEY4)
MESSAGE MSGTXT('User key 4 (F18) was pressed')
ENDIF
IF_KEY WAS(*USERKEY5)
MESSAGE MSGTXT('User key 5 (F19) was pressed')
ENDIF
END_LOOP
For more information about function key use and function key assignments refer to the DISPLAY, REQUEST, POP_UP and BROWSE commands.