Global Variables
|
Opens the Global Variables dialog (screenshot below). Global variables are available to the designer in programming contexts, such as XPath or XQuery, everywhere in the project. MobileTogether Designer provides a standard library of global variables, which are listed in the upper pane of the dialog. The values of the global variables are assigned by MobileTogether during simulation and when the app runs on the client device. Global variables are of three types, and the list of variables in the dialog is divided into three parts for these three types:
•Static-value variables (called Global Variables in the dialog): These variables contain information about the mobile device. Values of these variables do not change during the execution of the project. Notice that the Value column in the upper pane specifies the currently selected mobile device. The listed values are for that particular device. For simulations, the client device is considered to be the device selected in the Device Selector combo box. For example, the variable $MT_Android has a value of true when the mobile device being used is an Android. (Device information is sent by the device as part of standard mobile communication procedures.) •Dynamic-value variables (called Local Variables in the dialog): These variables contain information related to the design page and its controls. Their values could change during execution. For example, the $MT_ControlNode variable has different values according to which node is the page source link of the current control at a given time during project execution. •User variables: In addition to the standard library of global variables, you can add your own global variables (called User Variables in the dialog) in the lower pane of the dialog. You can give a user variable any value, and this value can then be used subsequently in any XPath/XQuery expression in the project.
To add a user variable, in the lower pane, do the following:
1.Click the Append or Insert icons (located in the pane's toolbar) to add a line to the list. 2.Enter the name of your new variable (in the Name column) and give the variable a description (Description column). See screenshot above. 3.Click in the Value field to bring up the Edit XPath/XQuery Expression dialog, and enter the XPath expression that determines the value of this variable. 4.Select an icon to help identify the new variable as belonging to a particular group. 5.Click OK to finish. The variable is added as a global variable, and can be used in programming contexts.
See the section, Global Variables for a description of predefined global variables. |