end-key question

nate100

Member
I have the following code:

pause 7.

if keyfunction(lastkey) = "END-KEY" then
message "End Key Pressed ". pause.


When the program is pausing for 7 seconds, if I press F4 why do I not get teh message.
 

rstanciu

Member
because 4GL is a procedural language. The execution plan is: line by line.
The runtime cannot execute the if ... code line until the pause 7. line is not finished.

If you wants to implement this you have to use the event-driven model and add a trigger ON "F4".
 

suny

ProgressTalk.com Sponsor
Or use this code :awink:
Code:
repeat:
  pause 7.
  leave.
end.
if keyfunction(lastkey) = "END-KEY" or keyfunction(lastkey) = "END-ERROR" then
do:
  message "End Key Pressed ".
  pause.
end.
Because if you press F4, the program leave the current repeat block and in your sample the message with pause 7 is in the same block.
 

nate100

Member
Have a question - what is the different between ENDKEY and END-ERROR in the example above. When will Endkey work and when will End-error work.

Thanks
 

GregTomkins

Active Member
END-ERROR is almost always what you want and generally the only thing you need. END-KEY / ENDKEY is only useful if you deliberately assign an ENDKEY, using something like 'ON F9 ENDKEY', which nobody ever does (in my experience).
 
Top