如何在不需要用户输入的情况下应用程序本身的最后一个键? - 进步 4GL

how to apply last key from a program itself without requiring a user input? - PROGRESS 4GL

在某些情况下,我需要我的程序来执行从程序本身应用的自动密钥。我不希望用户给出或按下任何键。当它达到某些条件时它应该是自动的。我正在使用下面的查询,需要用户输入。请帮忙修改

/*some conditions here..now its not required user input*/
case keyfunction(lastkey):
  when {&KEY-END} then
    undo RPT-SETTING-LOOP, next SOURCE-DB-LOOP.
  when {&KEY-GO} or when {&KEY-RETURN} then
    leave RPT-SETTING-LOOP.
 end case.

不要直接使用 LASTKEY,而是使用变量并根据需要有条件地设置变量以采取相应行动:

define variable notLastkey as integer no-undo.

/*some conditions here..now its not required user input*/

if theUserTypedSomethingBranch = yes then
  notLastKey = lastkey.
 else
  notLastKey = whateverYouDesire.

case notLastkey:
  when {&KEY-END} then
    undo RPT-SETTING-LOOP, next SOURCE-DB-LOOP.
  when {&KEY-GO} or when {&KEY-RETURN} then
    leave RPT-SETTING-LOOP.
 end case.