Reading Variables in External Modeless Xdialogs
Description
This example shows how a variable in another modeless Xdialog can be read using the UI_DLG_EVAL()and UI_DLG_EVAL_VALID() functions. First, display the "test" modeless dialog box with a variable.
x=1 ui_modeless_dlg_box("Test",<<%dlg% X: [.20x] ; {lf}; ; %dlg%,<<%code% if a_dlg_button = "increment" then x = x + 1 a_dlg_button = "" end if if a_dlg_button = "close" then ui_modeless_dlg_close("test") end if %code%)
Then, create the "Read Value" modeless dialog that will read the value of x in the "test" dialog.
dim dlg_title2 as c dlg_title2 = "Read Value in External Modeless Dialog" ui_modeless_dlg_box(dlg_title2,<<%dlg This example shows how a variable in another modeless Xdialog can be read using the ui_dlg_eval\() function.; ; {lf}; ; %dlg%,<<%code%
Test to see if the variable x exists in the "test" dialog.
if a_dlg_button = "read" then if ui_dlg_eval_valid("test","x") then
If it does exist, use UI_DLG_EVAL()to read it and display it in a message box.
ui_msg_box("Value of X","" + ui_dlg_eval("test","x")) else ui_msg_box("Error","Dialog 'Test' is not open.") end if a_dlg_button = "" end if if a_dlg_button = "close" then ui_modeless_dlg_close(dlg_title2) end if %code%)
Move the "Read Value" dialog so it does not hide the "Test" dialog..
ui_dlg_move(dlg_title2, 0, 0)
Limitations
Desktop applications only
See Also