Prev Next

Win32 User Interface Simulation

Enterprise Architect supports the simulation of dialogs and screens created with the Win32® User Interface profile, to integrate user interface design with defined system behavior. Dialogs can be programmatically referenced and invoked using JavaScript commands within a behavioral model such as a StateMachine, providing a fully customizable and fully interactive execution of your behavioral model.

Button controls can be used to broadcast signals, firing a trigger when the button is clicked. Signal arguments can be filled from the dialog input fields; for example, to capture and send a username and password for evaluation.

Dialogs designed using the Win32 User Interface profile (and existing within the same Package branch as the behavioral model being executed) will be created as new windows in the background at the beginning of simulation. Various properties that can affect the appearance and behavior of each dialog and control can be customized at design time via Tagged Values provided by the Win32 User Interface profile.

To interact with a dialog via JavaScript during simulation, the 'dialog' simulation-level keyword is used, followed by a period and the name of the dialog. Properties and methods can then be accessed; for example, to show the dialog, or to set the text value of an 'Edit Control':

     dialog.Login.Show=true;

     dialog.Login.Username.Text="admin";

Examples

To view an example of the Win32 User Interface Simulation, open the EAExample model and locate the diagram:

Example Model > Model Simulation > State Machine Models > Customer Login > Customer > Customer Login

    

Common Properties

These common properties and methods are available on most supported Win32 UI Control types.

Property/Method

Description

Enable

Boolean

Enables or disables user interaction.

Move To (x,y,width,height)

Move the window to the specified coordinates and set the window height and width.

Show

Boolean

Show or hide the dialog. When this property is set to False, the dialog is moved off-screen.

Text

String

Set the title of the dialog or window.

JavaScript Functions

Function

Description

BroadcastSignal (string Signal)

Sends a signal to the simulation event queue.

Parameters:

  • Signal: String – the name of the Signal to be broadcast

UIBroadcastSignal (string Signal, array Parameters)

Sends a signal with additional parameters to the simulation event queue.

Parameters:

  • Signal: String – the name of the Signal to be broadcast
  • Parameters: Array – additional parameters to be supplied for this Signal

Example:

     UIBroadcastSignal("Login",{Name: dialog.Login.Username.Text, Password: dialog.Login.Password.Text});

ShowInterface (string InterfaceName, boolean Show)

Deprecated. See the Show property on the 'Dialog' control. For example:

     dialog.HelloWorld.Show = true;

InterfaceOperation (string InterfaceName, string ControlName, string OperationName,[string arg1],[string arg2])

Deprecated. Operations can be referenced directly from the control. For example:

     dialog.HelloWorld.ListControl.InsertItem("Test", 2);

GetInterfaceValue (string InterfaceName, string ControlName, string OperationName,[string arg1],[string arg2])

Deprecated. Properties can be referenced directly from the control. For example:

     dialog.HelloWorld.EditControl.Text;

Notes

  • Controls must be within a dialog; any controls outside a dialog will not be interpreted
  • Dialogs and controls must be on a Win32 User Interface diagram
  • Simple UI controls and Basic UI controls can also be used in a simulation, but are limited in functionality compared to Win32 UI controls
  • Dialog names and Control names must be unique; if multiple controls of the same name exist, the simulation will not be able to differentiate between them
  • Spaces in dialog names and Control names are treated as underscores
  • Dialog names and Control names are case sensitive

Learn more