Xbasic

UI_DLG_EVAL Function

Syntax

Return_Value as A = UI_DLG_EVAL(C title,C expr)

Arguments

Return_Value

The result of evaluating the Expression.

title

The Title of the modeless Xdialog box.

expr

Any expression that can be evaluated in the context of the Xdialog.

Description

Return the result of an expression evaluated in the context of an xdialog.

Discussion

The UI_DLG_EVAL() function evaluates an expression in the context of a modeless Xdialog box. The function is useful for going beyond what UI_DLG_EVENT() can offer, since there is no requirement that an event handler be coded.

Example 

put description here

dim x as N = 1
ui_modeless_dlg_box("Test",<<%dlg%
;
[.20x];
;
;
;
%dlg%,<<%code%
if (a_dlg_button = "Close") then
       ui_modeless_dlg_close("Test")
end if
if (a_dlg_button = "Increment") then
a_dlg_button = ""
x = x + 1
end if
%code%)

This statement run in the Interactive window returns the current value of x as defined above.

? ui_dlg_eval("Test", "x")
= 4

Define and run a script.

fname = "Fred"
lname = "Flintstone"
ui_modeless_dlg_box("Me","<&Close>",<<%code%
if a_dlg_button = "&Close" then
       a_dlg_button = ""
       ui_modeless_dlg_close("Me")
end if
%code%)
function one as C()
       one = "I am the one"
end function

Go to the Interactive window. You can now execute arbitrary expressions in the Xdialog's context..

? ui_dlg_eval("Me","One()")
= "I am the one"
? ui_dlg_eval("Me","fname")
= "Fred"
? ui_dlg_eval("Me","local_variables()")
= fname = "Fred"
lname = "Flintstone"

Limitations

Desktop applications only.

See Also