VisualNEO Win Plugin Manual

neoSwitch — Fluent & iOS Animated Toggle Switch Plugin

Plugin ID:com.visualneo.neoswitch
Suite:VisualNEO Essentials (Free)
Publisher:SinLios / VisualNEO Win
Category:Form / Controls

1. Overview & Purpose

The neoSwitch plugin provides smooth, antialiased animated toggle switch controls (styles: fluent, ios, flat) for VisualNEO Win applications.

It supports customizable ON/OFF colors, thumb circle colors, label text with flexible placement (left, right, none), keyboard spacebar toggle, and automatic event notifications (on, off, change).

The optional bound variable is a live two-way binding, matching VisualNEO's core input controls. An empty variable is initialized from checked; user interaction updates the variable before event scripts run; and changing the variable from NeoScript updates the switch without firing a user event. Its value is always True or False.


2. Custom Control Properties

Control: neoSwitch Control (neo-switch-control)

Property NameTypeDefault ValueDescription
variablevariable""Optional VisualNEO variable (e.g. [MySwitch]) bound directly to the switch state (True/False).
checkedbooleanfalseInitial ON/OFF toggle state.
labelstring"Toggle Switch"Descriptive text label string.
labelPositionstring"right"Label text placement ("right", "left", "none").
stylestring"fluent"Visual animation style ("fluent", "ios", "flat").
onColorstring"#2ECC71"Background color when active ON (#HEX).
offColorstring"#BDC3C7"Background color when inactive OFF (#HEX).
thumbColorstring"#FFFFFF"Sliding thumb circle color (#HEX).
bgColorstring"auto"Control background color (#HEX or "auto").

3. Actions & Commands Reference

neoSwitchSetValue

Sets the state (True/False, 1/0, ON/OFF) of a neoSwitchControl.

  • Command Syntax: neoSwitchSetValue "ObjectName" "State"

neoSwitchGetValue

Retrieves current boolean state ("True" or "False") into [neoSwitchResult] (and optionally into a specified variable).

  • Command Syntax: neoSwitchGetValue "ObjectName" "[ResultVar]"
  • Parameters:
  • ObjectName (string): Target control name.
  • ResultVar (string, optional): Destination variable (e.g. "[IsActive]").

neoSwitchToggle

Inverts the switch state (ON to OFF, or OFF to ON).

  • Command Syntax: neoSwitchToggle "ObjectName"

neoSwitchSetColors

Updates active ON, inactive OFF, and thumb colors.

  • Command Syntax: neoSwitchSetColors "ObjectName" "OnColorHex" "OffColorHex" "ThumbColorHex"

neoSwitchSetLabel

Sets label text and placement ("left", "right", "none").

  • Command Syntax: neoSwitchSetLabel "ObjectName" "Text" "Placement"

4. Events Reference

  • on: Triggered when the switch is toggled to ON (checked: true).
  • off: Triggered when the switch is toggled to OFF (checked: false).
  • change: Triggered on any state toggle change.

The event payload is available in [ModernEventJSON]. For ordinary boolean logic, binding the variable property is simpler and avoids calling neoSwitchGetValue from inside an event:

TEXT
. The control's variable property is [DarkModeEnabled].
. This script can be used directly in the change event.
SetVar "[StatusText]" "Dark mode: [DarkModeEnabled]"

5. Practical Usage Example (VisualNEO Win Script)

TEXT
. --- Enable dark mode toggle ---
neoSwitchSetColors "Switch1" "#3B82F6" "#475569" "#FFFFFF"
neoSwitchSetLabel "Switch1" "Dark Mode" "right"
neoSwitchSetValue "Switch1" "ON"

. --- Toggle state on button click ---
neoSwitchToggle "Switch1"