窗口窗体进入无响应阶段



我是4GL的新手。在我的程序中,我尝试使用progress 4GL创建一个表单。表单有两个字段,一个是DB名称,另一个是数据库描述。默认情况下,此表单的作用域应该有一个数据库名称和描述,如果用户在数据库名称字段中输入或保持空白,则警报框应该显示一条消息。我已经开发了表单,但当我运行它时,程序会持续运行,窗口表单会进入无响应阶段。我没有机会输入或保留DB字段名称为空。让我分享我的代码,请帮助找出问题所在以及它持续运行的原因。

define variable cArcDB      as character   no-undo format "x(20)" INIT "qadb".
define variable cArcDBDesc  as character   no-undo format "x(25)" INIT "archive database".
define variable cTmp  as character   NO-UNDO.
form
cArcDB     colon 25
cArcDBDesc colon 25
with frame frArchiveDB width 80 side-labels.
MAIN-LOOP:
REPEAT:
display
cArcDB
cArcDBDesc
with frame frArchiveDB.
set
cArcDB
with frame frArchiveDB editing:
if frame-field = "cArcDB" then do:
/* Find next/prev record from ttAppDB */
cTmp = cArcDB:input-value in frame frArchiveDB.
display
cArcDB
cArcDBDesc
with frame frArchiveDB.
end.
end. /* editing */
cArcDB = trim(cArcDB).
if cArcDB = "" then do:
/* Blank not allowed */
/*  {us/bbi/pxmsg.i &MSGNUM=40 &ERRORLEVEL=3} */
next-prompt cArcDB with frame frArchiveDB.
undo MAIN-LOOP,retry MAIN-LOOP.
end.
END.

请查看"编辑短语"的在线参考资料。对我来说,在EDITING块开始后,你似乎错过了READKEY,在某个时候你还需要"APPLY LASTKEY"。查看那里的示例:

/* Update Customer fields, monitoring each keystroke during the UPDATE */
UPDATE Customer.Name Customer.Address Customer.City Customer.State SKIP
Customer.SalesRep HELP "Use the space bar to select a SalesRep" 
WITH 2 COLUMNS EDITING:  /* Read a keystroke */
READKEY.
/* If the cursor is in any field except SalesRep, execute the last key
pressed and go on to the next iteration of this EDITING phrase to check
the next key */
IF FRAME-FIELD <> "SalesRep" THEN DO:
APPLY LASTKEY.
IF GO-PENDING THEN LEAVE.
ELSE NEXT.
END.
/* When in the SalesRep field, if the last key pressed was the space bar
then cycle through the sales reps */
IF LASTKEY = KEYCODE(" ") THEN DO:
FIND NEXT SalesRep NO-ERROR.
IF NOT AVAILABLE SalesRep THEN FIND FIRST SalesRep.
DISPLAY SalesRep.SalesRep @ Customer.SalesRep.
NEXT.
END.
/* If the user presses any one of a set of keys while in the SalesRep field,
immediately execute that key */
IF LOOKUP(KEYFUNCTION(LASTKEY), 
"TAB,BACK-TAB,GO,RETURN,END-ERROR") > 0 THEN APPLY LASTKEY.
ELSE BELL.
END.

相关内容

  • 没有找到相关文章

最新更新