Top  | Previous | Next

2 State Toggle

The default "on" style 

The default "on" style 

The default "off" style

The default "off" style

Styles are highly<br>
customizable

Styles are highly
customizable

Description

This button is similar to the basic Toggle Button, but more finely tuned to work in realistic controls environments. Use this button any time you want to toggle a value between two states, such as On/Off, Stop/Run, etc. If you have more than two states (for example, Hand/Off/Auto, use the Multi-State Button).

 

If you have a tag whose value you want to toggle between 2 values (like zero and one), you can simply drag and drop the tag onto the button. This will bind both the Control Value and Indicator Value properties to that tag. Now set the State 1 Value and State 2 Value to your two states (they default to zero and one, respectively). Lastly, use the Styles Customizer to define the styles for your two states.

 

This button has four integer values that you use to set it up: the Control Value, the Indicator Value, and values that define the 2 different states: State 1 Value and State 2 Value. Every time you press the button, one of the state values is written to the control value. The Indicator Value is used to determine which state you're in. For example, suppose that State 1 Value was zero and State 2 Value is one. If Indicator Value is zero and you press the button, it'll write a one to the Control Value. The Style of the component is typically driven by the read-only property Current State. Current State equals zero when Indicator Value=State 1 Value and one otherwise.

 

See also:

Bidirectional Bindings

Component Styles

Properties

Appearance

Font

Font of text of this component

Scripting name

font

Data type

Font

Foreground Color

The foreground color of the component.

Scripting name

foreground

Data type

Color

Background Color

The background color of the button.

Scripting name

buttonBG

Data type

Color

Background 3D?

Should this button have a 3d type background, or a flat color one?

Scripting name

background3D

Data type

boolean

Flags

expert

Fill Area?

Controls whether or not this button's internal area is filled

Scripting name

contentAreaFilled

Data type

boolean

Flags

expert

Border Painted?

Should the border of this button be displayed?

Scripting name

borderPainted

Data type

boolean

Flags

expert

Text

Text of this component

Scripting name

text

Data type

String

Flags

bindable

Image Path

The relative path of the image.

Scripting name

path

Data type

String

Flags

bindable

Disabled Image Path

The relative path of the image to be displayed when this component is not enabled.

Scripting name

disabledPath

Data type

String

Flags

expert

Icon-Text Spacing

The space (in pixels) between the icon (if any) and the text (if any)

Scripting name

iconTextGap

Data type

int

Antialias

Draw with antialias on? Makes text smoother

Scripting name

antialias

Data type

boolean

Flags

expert

Styles

Contains the component's styles

Scripting name

styles

Data type

Dataset

Flags

bindable | expert

Behavior

Rollover

If true, the button may indicate that the mouse is hovering over it.

Scripting name

rolloverEnabled

Data type

boolean

Flags

expert

Focusable

If a button is not focusable, you will not be able to interact with it with the keyboard. This means you can't "tab" over to it.

Scripting name

focusable

Data type

boolean

Flags

expert

Confirm?

If true, a confirmation box will be shown.

Scripting name

confirm

Data type

boolean

Confirm Text

The message to ask the user if confirmation is turned on.

Scripting name

confirmText

Data type

String

Mnemonic

A single letter that will activate the button using 'ALT-mnemonic'.

Scripting name

mnemonicChar

Data type

String

Flags

expert

Common

Name

The name of this component.

Scripting name

name

Data type

String

Flags

bindable

Enabled

If disabled, a component cannot be used.

Scripting name

componentEnabled

Data type

boolean

Visible

If disabled, the component will be hidden.

Scripting name

visible

Data type

boolean

Flags

bindable

Mouseover Text

The text that is displayed in the tooltip which pops up on mouseover of this component.

Scripting name

toolTipText

Data type

String

Cursor

The mouse cursor to use when hovering over this component.

Scripting name

cursorCode

Data type

int

Values

0

Default

1

Crosshair

2

Text

3

Wait

12

Hand

13

Move

4

SW Resize

5

SE Resize

6

NW Resize

7

NE Resize

8

N Resize

9

S Resize

10

W Resize

11

E Resize

Border

The border surrounding this component. NOTE that the border is unaffected by rotation.

Scripting name

border

Data type

Border

Flags

expert

Opaque

Is this button completely opaque? Most aren't, so this should usually be false.

Scripting name

opaque

Data type

boolean

Flags

expert

Data

Data Quality

The data quality code for any tag bindings on this component.

Scripting name

dataQuality

Data type

int

Flags

bindable | expert

Control Value

Bind this to the tag that controls the state. (Typically, this is bound to the same location as Indicator Value)

Scripting name

controlValue

Data type

int

Flags

bindable

Indicator Value

Bind this to the tag that indicates the current state. (Typically, this is bound to the same location as Control Value)

Scripting name

indicatorValue

Data type

int

Flags

bindable

State 1 Value

The value that will be written to controlValue when the button is pushed in state 2.

Scripting name

state1Value

Data type

int

Flags

bindable

State 2 Value

The value that will be written to controlValue when the button is pushed in state 1.

Scripting name

state2Value

Data type

int

Flags

bindable

Current State

Read-only property that shows what state (0 or 1) this button is currently in.

Scripting name

state

Data type

int

Flags

bindable | expert

Layout

Margin

The space between a button's text and its borders.

Scripting name

margin

Data type

Insets

Flags

expert

Horizontal Alignment

The horizontal alignment of the button's contents (text and/or image)

Scripting name

horizontalAlignment

Data type

int

Values

2

Left

0

Center

4

Right

10

Leading

11

Trailing

Horizontal Text Position

The horizontal position of the button's text relative to its image

Scripting name

horizontalTextPosition

Data type

int

Flags

expert

Values

2

Left

0

Center

4

Right

10

Leading

11

Trailing

Vertical Alignment

The vertical alignment of the button's contents (text and/or image)

Scripting name

verticalAlignment

Data type

int

Values

1

Top

0

Center

3

Bottom

Vertical Text Position

The vertical position of the button's text relative to its image

Scripting name

verticalTextPosition

Data type

int

Flags

expert

Values

1

Top

0

Center

3

Bottom

Scripting

Events

The following event sets are fired by this component. See Component Event Handlers to learn more.

mouse
mouseMotion
focus
action
propertyChange
key

 

Scripting Functions

This component has no special scripting functions.