The msg query command took two forms:
msg query "Question String", variable
msg query "Question String"
In the first form, the specified variable received the result of the question in the form of either 0 or 1, where 1 represented that the user had clicked on the YES box, and 0 represented the NO box. If an exclamation point was placed before the variable that the numerical meanings were reversed.
In the second form, where a variable was not defined, if the user clicked on the NO button, then jpl functionality at the current level would immediately exit at that step, with a return value of ????? to the previous level. If the user clicked on the YES button, then the next line of jpl was executed. This effect was also reversed by putting an exclamation point following the question string.
msg query "Data Not Saved. Do you really want to Exit?", ans if (ans) call save_form_data()
ans = sm_messagebox("Data Not Saved. Do you really want to Exit?", \ "Confirm Exit", SM_MB_YESNO, "") if (ans = SM_MB_YES) call save_form_data()
msg query "Data Not Saved. Exit without saving?" ! /* save code here */if ((sm_messagebox("Data Not Saved. Exit without saving?", \ "Abort Confirm", SM_MB_YESNO, "")) \ == SM_MB_YES) return ????? /* save code here */
The sm_messagebox() command is usually longer than the equivalent msg query command, but it also more flexible. As in the above examples, you can specify the title on the pop-up box. You can also change the types of buttons presented to the user, set the default choice to something other than the first button, and a variety of other options. See the Language Reference entry on sm_messagebox() for details.
The use of AUTO would need to be replaced by first defining a logical key, such as APP1, to the same value as AUTO. Then you just need to insure that the key will only be popped onto the keyboard stack (using the jm_keys command) during screen entry. One way is to pop the logical key onto the keystroke stack in the un-named jpl code, which only executes on screen-entry and not on screen re-exposure. Similarly, the screen's defined screen entry function could also pop this key, provided you add logic to check whether the screen is being opened or re-exposed.
SQL SELECT SYSDATE FROM DUAL
DBMS SQL SELECT SYSDATE FROM DUAL
if (:value == 1)
if (value == 1)
if (":variable" == "OK")
if (variable = "OK")
call sm_gofield (:fld_num)
call sm_gofield (fld_num)
Note: There are some cases where expansion of a variable inside of quotes would produce a different equality test than if the variable itself is used. One case is when comparisons are done with numerical constants or values. If it is doing a numerical comparison, if you remove colons and/or quotes, be sure to test the code to make sure it works as you expect it would. Also, if the result of colon expansion is the name of another variable or of a widget on the screen, then a second expansion will occur, since colon expansion occurs before variable dereferencing.
A further document will be written to explore