Xdialogs Are Built from Strings
Many developers do not necessarily realize, or at least appreciate the
significance of the fact, that the arguments to UI_DLG_BOX()
and UI_MODELESS_DLG_BOX()
are just strings that can be manipulated in Xbasic. The ramifications
of this are really profound. This fact gives the developer the ability
to dynamically construct dialogs on the fly.
In other words, instead of defining an xdialog like this (which is how
most of the examples are written):
|
ui_dlg_box("Test",<<%dlg% |
You could set up your Xdialog like this:
|
dim dlg_body as C dlg_body = <<%dlg% |
While the second example iis more verbose that the example in red, it does bring home the point that dlg_body, and dlg_event are just strings that you can easily manipulate, or dynamically construct, using Xbasic code before calling the ui_dlg_box()command.
Example
The following, somewhat trivial, example demonstrates how the dlg_body string is constructed dynamically using Xbasic
before the dialog is shown.
Note that this example is different than a dynamic Xdialog where controls
are hidden or shown in real time
as the state of variables change. You can create dynamic Xdialog
using the {condition} statement in the
Xdialog body.
|
dim fn as C dlg_married = <<%dlg% if married then |
Supported By
Alpha Five Version 5 and Above