Toggle Command

The Toggle command defines binary state touch controls with 2D rectangular shapes at a depth position of zero (0.0). The current state of the toggle control is available to other commands on the same page to create buttons for interactive control. The first parameter is a name, which is mandatory. Toggle names are only required to be unique for the current page. Defined toggle names can then be referenced by other commands on the same page to enable/disable boxes, text, tickers, objects and other toggle controls. Track controls can not be used to define parameters for Toggle commands.

Touch controls can only be used on the same page they are defined on unless they are defined on a global page, in which case they can be used on subsequent pages until the next global page. Toggle controls have the special capability to be defined in any order on the same page. This allows mutually exclusive button groups to be defined using the disable option, provided that the entire group is defined on the same page.

    Example of a Page with Two Toggle Control Buttons
    
    page: PageName    time: 1, 10
          box: Highlight1    position: 15, 20   size: 15, 10    toggle: Button1    color: 0.5, 0.5, 0
          box: Highlight2    position: 15, 40   size: 15, 10    toggle: Button2    color: 0.5, 0.5, 0
          toggle: Button1    box: Highlight1    disable: Button2    initial: on    stick: on
          toggle: Button2    box: Highlight2    disable: Button1    initial: off    stick: on

Box Option

Defines the name of an associated box from which many parameters will be inherited as defaults for the toggle control. This allows a preceding box on the same page to define the appearance of the toggle control, including time, position, size, image and/or color. Any of these can still be overridden with specific command options, but usually a button image should be aligned with the touch control for a proper user interface. Toggle controls will function without an associated box, but will be invisible.

Time Option

Defines the start and duration times for the toggle control in seconds. If not specified, the default start and duration times will be the same as for the page that this control is on. These can be specified as either floating-point values in seconds or integer (sexagesimal) clock time durations. Start times can be prefixed with a plus symbol “+” which means the new start time is the sum of the specified time and the start time from the previous toggle command on the same page. This allows toggle commands to be duplicated in the script without the need to manually add time values. Refer to the Page command for examples. This parameter is typically inherited from a box which defines the appearance of the toggle control, but this option allows that to be overridden.

Size Option

Defines the width and height of the toggle control, respectively. These dimensions are specified in the same coordinate system used to position text, tickers and objects. Dimensions of 100, 100 would cover the entire page, for example, if the top left corner of the toggle control were positioned at the origin. This parameter is typically inherited from a box which defines the appearance of the toggle control, but this option allows that to be overridden. If a size is defined which differs from an associated box, the box image will be scaled to this size. If only one value is specified (the width), the height is computed automatically to make the toggle control square, regardless of the aspect ratio of the display.

Align Option

Defines the vertical and horizontal alignment for the toggle control.  This determines the position of the toggle control region on the display. This parameter is typically inherited from a box which defines the appearance of the toggle control, but this option allows that to be overridden.

Toggle Control Alignments

        Names                Short            Uses
        
        TopLeft                    tl                Left Justified Control    
        TopCenter               tc               Centered Control
        TopRight                  tr               Right Justified Control    
        CenterLeft               cl               Left Justified Control    
        CenterCenter          cc              Centered Control
        CenterRight            cr               Right Justified Control
        BottomLeft             bl               Left Justified Control    
        BottomCenter        bc              Centered Control
        BottomRight           br              Right Justified Control

Position Option

Defines the position for the toggle control on the display. The align option also affects this position. The default position for touch controls is 0.0, 0.0, 0.0, which is the top left corner of the display and at the front of the coordinate space depth. The depth coordinate is fixed for touch controls at zero (0.0) and can not be altered.

Position coordinates can be prefixed with a plus symbol (“+”) to define the new position as the sum of the specified coordinate and the same position coordinate from the previous toggle command on the same page. This allows toggle commands to be duplicated in the script file without the need to manually add position values. This parameter is typically inherited from a box command which defines the appearance of the toggle control, but this option allows that to be overridden.

Scale Option

Defines horizontal and vertical scaling factors for the toggle control. This can be used to stretch or reduce the toggle control’s region in either direction. The default scaling factors for toggle controls are 1.0, 1.0, which disables scaling. This parameter is typically inherited from a box command which defines the appearance of the toggle control, but this option allows that to be overridden.

Initial Option

Defines the initial state of the toggle control. Toggle controls reset to their initial state whenever the page begins or whenever their reset time expires. This parameter must be either on or off. The default state is off.

Stick Option

Defines if the toggle control will stick in the active state when it is touched and released. By default, toggle controls automatically reset to their initial state when the touch ends, which is intended for creating buttons with momentary behavior that define a binary state. This option allows this automatic reset to be disabled which causes the toggle control to stick until it is reset  by either the reset or disable options or by restarting the page. This parameter must be either on or off. The default state is off.

Touch Option

Defines the polarity for which touch screen events will be recognized for the toggle control. This parameter can be specified as on, off or both. The default is both. A touch on event means a finger has made contact with the touch screen. A touch off event means a finger has broken contact with the touch screen. Touch both means that both on and off touch events are recognized. Touch events are not recognized during page transitions.

Disable Option

Defines other toggle controls which will be reset when this toggle control is touched and becomes active. Any number of toggle controls can be associated into mutually exclusive groups using this option, such that activating any button can reset any or all of the other buttons in the group. The names of up to 24 toggle controls can be specified. All of these toggle controls must be defined on the same page.

Reset Option

Defines a time interval in seconds when the toggle control will be automatically reset to its initial state, as defined by the initial option. Toggle controls always reset to their initial state when the page begins. This option provides an additional means to reset the state of the toggle control without the need to restart the page. By default, this parameter is zero, which disables this reset. This parameter can be specified as either a floating-point value in seconds or an integer (sexagesimal) clock time duration.

 

 

<   Ticker Command                                             Introduction                                            Touch Command   >