Controls are the objects placed on the Main or Child Interfaces to perform some task, such as plotting, metering, and displaying. They are used for user interaction such as entering values or a slider to set a value. Some controls are used for operations such as timers or logging.
Creating Controls
Controls may be placed once in Edit Mode (F9) and using the Controls Palette (F2) to click a control to select, then draw on an interface. It may also be placed by clicking an interface and the default size of the control will be used. Pop-up windows will open when placing asking for the name of control and other common information. Once placed and while in Edit Mode, a control may be moved through dragging or resized using the mouse.
A control may also be placed through code that comes from the Debug/CLI (F4), an interface file, a macro file, serial data sent by a controller or through event code of another control.
Through code, the general format of a control is:
!makeControlType name, left, top, width, height, one or more parameters
The coordinates for the Main or a Child Interface is 0,0 in upper left to 100,100 in lower right.
For example, to make a textbox in the upper right of the main interface:
!makeTextBox txtPower 80,10,15,5, 0 Watts
Once created it is access by its name and a specific property if desired.
!txtPower=[ain0] Watts !debug ? [txtPower]
!txtPower.backColor=RED
!debug ? [txtPower.backColor]
Good coding practice recommends using a suffix to identify they type of control. When 'drawing' a new control, the recommended suffix will be shown. This should be followed by a name the describes its use without spaces.
txtVoltage - a text box to hold voltage and allow input lblSpeed - a label to show current speed sldSpeed - a slider to set the speed
etc
When a control is manually placed on a Child Interface, the Child's name is ONLY used when creating through code, such as an interface named intSettings:
!intSettings.txtPower=[ain0] Watts
The control is global to the environment and is referenced only with the control's name: !txtPower = 10
If desired, the interface name could be made part of the control name for more explicit referencing, and easier locating for contextual help, such as in the Debug/CLI to see all controls on that interface.
!intSettings.intSettings_txtPower=[ain0] Watts
It would be referenced by its full name: !intSettings_txtPower=10
To configure a control using the Interface Editor, place the mouse pointer over a control and type F3.
Properties
All controls have Properties which affect the appearance of a control, such as setting the text, backColor or fontSize. Properties are also available to affect the operation of the control, such as whether a timer will run once or repeat, or to set a formula for incoming data on an analog plot control.
Please see Properties for more information on properties.
Update Values
The Update Values defines what value to update a control with when new data arrives, such as setting a textBox to update with the value of analog channel 0, [ain0], when data arrives. The default property, such as the text of a textBox is updated by default unless a property is first named. Only one property may be updated for an Update Value.
Please see Update Values for more information.
Event Code
Event Code is MakerPlot-J code or script that is ran when something triggers the control, such as a value being change and hitting Enter, moving a slider, clicking a button, etc. Some controls, such as the Logging control and Canvas Control trigger whenever analog, digital or message data arrive.
Please see Event Code and Triggered Event Code for more information on using Events.
Instructions
All instructions have instructions, such as telling a control to run its Event Code manually: !txtPower.run
Many controls have additional instruction to perform some operation with an instruction, such as:
Clearing a list: !lstData.clear
Resetting a plot: !plot.reset
Please see Instructions for more information.
Values
Many controls hold values outside of properties which hold data outside of properties that may be accessed on the same manner as properties, such as the value plotted for channel 0 of the analog plot or the time it was plotted in seconds:
[plot.ch0]
[plot.timeCh0]
Please see Values for more information.
Wildcards
Multiple controls can be accessed through use of the wildcard (*). This allows controls with similar prefixes or names to be accessed with a single instructions. For example, all controls starting with met (such as meters) can be accessed with one line of code to change a common property:
!met*.visible=0
The letters up to the wild card must be an exact match. Careful planning in naming can allow a similar group of controls to be accessed at once, such as naming all control to monitor motor 1 to be names with a common prefix, mot1: mot1LblTemp mot1metFlow mot1SldSpeed
This allows all motor 1 controls to be accessed for common changes with: !mot1*.visible=0
Cut/Copy/Paste Controls
A control may be cut or copied by placing the mouse pointer over it and pressing CTRL-X or Delete key.
It may be copied by placing the mouse pointer over it and pressing CTRL-C.
It may be pasted by selecting the interface of choice and pressing CTLR-V.
Copy/Paste between interface instances (separate programs) is not supported.
|