系统变量:system.form_status代表了form的状态:'CHANGED', 'NEW', 'QUERY'。
按下默认[exit]键或选择默认菜单中的exit项时,程序执行的是do_key('KEY-EXIT')。
如果没有自定义key-exit触发器,do_key('KEY-EXIT')调用key-exit对应的默认built-in过程: exit_form。
exit_form实际上有三个重载过程:
exit_form; exit_form(commit_mode);exit_form(commit_mode, rollback_mode);
exit_form等于exit_form(ASK_COMMIT)。
它将检查system.form_status,如果不为'QUERY',弹出对话框提示是否保存变动。DO_COMMIT,NO_COMMIT,NO_VALIDATE参数将执行相应动作而不弹出对话框。
如果你想自定义退出过程,要做的就是:
创建key-exit触发器,在触发器中判断:system.form_status,执行相应动作或调用exit_form。
当然你如果只想简单的保存(或不保存)退出,调用参数的exit_form就行了,不用判断:system.form_status。
具体用例可以在forms builder的联机帮助中查到。
注意一点,:system.form_status只会随用户操作执行built-in过程而改变。
你在触发器或过程中使用insert,update语句直接修改数据库,form并不知道,:system.form_status并不改变
SYSTEM.MODE
Description
SYSTEM.MODE indicates whether the form is in Normal, Enter Query, or Fetch Processing mode. The value is always a character string.
NORMAL Indicates that the form is currently in normal processing mode.
ENTER-QUERY Indicates that the form is currently in Enter Query mode.
QUERY Indicates that the form is currently in fetch processing mode, meaning that a query is currently being processed.
Usage Notes
When using SYSTEM.MODE to check whether the current block is in Enter Query mode, be aware that if testing from a When-Button-Pressed trigger in a control block, Enter Query mode will never be entered, because the control block is not the current block.