Component: Sim. Switch Base (Simulation)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.3 (Release)
Category Simulation


Image Sim. Switch Base component

A base for building switches that do not download to chip. Mouse interaction can send 'System.User' events with the following data... ID = The handle of the switch component sending the message Message = 1 (on) or 0 (off) Current state can also be read via simulation macros.


This component can be used as a base to create child components

The following components all inherit the traits of Sim. Switch Base:

-
Image Basic Sim. Slide Switch Simple slide switch with no pin assignment.

State can only be determined by simulation macro read. Momentary or latching action can be chosen in the properties.

Image Basic Sim. Switch Simple push button switch with LED indicator with no pin assignment.

State can only be determined by simulation macro read. Momentary or latching action can be chosen in the properties.

Examples

No additional examples


Downloadable macro reference

This component does not contain any downloadable macros

Simulation macro reference

GetState

Read the current state of the switch. Returns BOOL true when the switch is on, or

BOOL false when off.

Parameters

This macro has no parameters


Return value

BOOL : Returns true if the operation is a success, else false


SetState

Sets the current state of the switch. BOOL true when the switch is on, or

BOOL false when off.

Parameters

BOOL SwitchState
Sets the state of the switch


Return value

This call does not return a value



Property reference

Operation

This property is of type Fixed list of ints and can be referenced with the variable name operation.

Latching = Mouse click to turn on, click again to turn off.

Momentary = Mouse click to turn on, release to turn off.

Send Event

This property is of type Fixed list of ints and can be referenced with the variable name send_event.

Determine when the component will send a User event to its parent.

On Change - Whenever the switch state changes.

On Click - Only when the mouse clicks the object.

On Release - Only when the mouse is released over the object.

Never - No events.

Startup State

This property is of type Fixed list of ints and can be referenced with the variable name start_state.

State that the switch will take when simulation is started.

Moving part

This property is of type Panel object and can be referenced with the variable name target.

Handle of a panel object that will be the moving part of the switch.

Pivot object

This property is of type Panel object and can be referenced with the variable name pivot.

Object around which the moving part will rotate when rotation is selected as the movement tyoe.

Type

This property is of type Fixed list of ints and can be referenced with the variable name movetype.

Set whether the moving part will move linearly or by rotation.

Axis

This property is of type Fixed list of ints and can be referenced with the variable name axis.

Axis along which the moving part will move (for push/slide) or around which it will rotate (rotary).

Movement

This property is of type Floating point and can be referenced with the variable name move.

Distance or angle by which the mioving part will move.