/ HALion Developer Resource / HALion Macro Page / Controls /

Switch


On this page:


Description

The Switch control allows you to create different types of switches. It can be configured as an on/off switch with two states or as a multi-state switch with an arbitrary number of states. Furthermore, it can be set to Increment or Decrement, to edit values stepwise. To realize exclusive switches that can act as a radio group, Exclusive mode can be selected. In this mode, each switch can be configured to send a dedicated value and all related switches are connected to the same parameter. The Switch control requires several bitmaps, depending on the specified mode and it can be set to scalable, which allows for resizing of the switch. The used bitmaps are resized according to the Scale Modes that are defined for the respective Bitmap resources.

Properties

PopertyDescription
NameThe name of the element. This name will be displayed in the GUI Tree.
Position/SizePosition X, Position Y, Width, Height: Position and size of the element in pixels. Position X/Y defines the position of the upper left corner.
AttachDefines how an element behaves when its parent element is resized. You can set the following parameters:
  • Left: If the parent element is resized, the element remains attached to left edge, with the specified ratio.
  • Right: If the parent element is resized, the element moves relatively to the right edge, with the specified ratio.
  • Top: If the parent element is resized, the element remains attached to top edge, with the specified ratio.
  • Bottom: If the parent element is resized, the element moves relatively to the bottom edge, with the specified ratio.
  • Left + Right: If the parent element is resized, the element is resized horizontally relatively to the left and right edges, with the specified ratio.
TooltipText that appears as a tooltip when the mouse hovers over the element.
ValueDrag and drop a parameter from the Parameter List to this text field to establish a connection. The assigned parameter will be displayed. Alternatively, you can export the property, which can then be used as a template parameter on a template instance.
Mode
  • Push: Sends a value of 1 and returns to 0. This mode requires bitmaps for Off and Down. If Hover is active, an additional bitmap Hover is required.
  • OnOff: Sets a value of 1 when pressed, 0 when pressed again. This mode requires bitmaps for Off, Off Down, On and On Down. If Hover is active, the additional bitmaps Off Hover and On Hover are required.
  • Multiple: In this mode, the switch can step through multiple states each time that it is clicked. For each state, the bitmaps must refer to bitmap resources or sections that contain a vertically aligned subframe per state, comparable to an animation sequence, such as the one that is used in knob controls, for example.
  • Increment: This mode allows you to increment the connected parameter value each time that the switch is clicked.
  • Decrement: This mode allows you to decrement the connected parameter value each time that the switch is clicked.
  • Exclusive: This mode allows you to use multiple switches as a radio group where only one switch is active at a time. An additional property allows you to define the value that is sent when the switch is on. To configure a radio group, connect all participating switches to the same parameter and define the Onvalue for each switch.
  • Hover: This mode allows you to switch directly from 0 to max (depending on the connected parameter) when hovering the switch without needing to click it.
  • Hover Exclusive: This mode allows you to use multiple hover switches as a radio group where only one switch is active at a time. An additional property allows you to define the value that is sent when the switch is on. To configure a radio group, connect all participating switches to the same parameter and define the Onvalue for each switch. (Since HALion 6.3)
Style
  • Immediate: By default, switches change their state when the mouse button is released. Activate this option if you want the state of the switch to change immediately when clicking the mouse. (Since HALion 7.0)
  • Hover: Shows a dedicated bitmap when hovering the switch. A hover bitmap resource must be assigned.
  • Shaped: The switch only reacts when you click the visible pixels, i.e., the pixels with an alpha value > 0.
  • Invert: Inverts the displayed bitmaps.
  • Scalable: Activate this if you want to be able to resize the element. The assigned Bitmap resources are resized according to the Scale Mode that is defined for the respective Bitmap resource. This also works if the switch is set to Multiple. In this case, the margin splitters are defined as for simple bitmaps, but the lower splitter must be set in the lowest subframe.
  • Popup: This mode allows you to use a switch to open a template as a popup. (Since HALion 6.3)
  • Clickthrough: Activate this option if you want the mouse click to be used by the switch but also to be forwarded to an underlying control. (Since HALion 6.4.0)
Bitmaps
  • Off: Allows you to assign the bitmap that is used for the off state.
  • Off Down: Allows you to assign the bitmap that is used for the off state with mouse button held down.
  • Off Hover: Allows you to assign the bitmap that is used for the off state when the mouse is hovering over the switch.
  • On: Allows you to assign the bitmap that is used for the on state.
  • On Down: Allows you to assign the bitmap that is used for the on state with the mouse button pressed.
  • On Hover: Allows you to assign the bitmap that is used for the on state when the mouse is hovering over the switch.
  • State: Allows you to assign a multi-frame bitmap that is used for the different states. (Since HALion 6.1)
  • State Down: Allows you to assign a multi-frame bitmap that is used for the different states with the mouse button pressed. (Since HALion 6.1)
  • State Hover: Allows you to assign a multi-frame bitmap that is used for the different states when the mouse is hovering over the switch. (Since HALion 6.1)
OnvalueAllows you to define the value that is sent when the switch is turned on. This option is only available in Exclusive mode.

If you want to create a switch template that allows you to specify the Onvalue on the instance level of the template, you must export this property.

  • Click the Export button on the right of the Onvalue field.
Now, the switch template shows the additional Onvalue as a template parameter and you can use the switch template several times and configure each instance of the template individually.

PopupThe following settings are only available for the Popup style.
  • Template: Here, you can specify the template that is shown when the switch is clicked. (Since HALion 6.3)
  • Close on Click:
    • Inside: Activate this option if you want the Popup to close when a click inside the template is performed. This can be used to create menu popups where the popup closes when a menu entry is selected, for example.
    • Outside: Activate this option if you want the Popup to close when a click outside the template is performed (but within the area of the macro page). This can be used to close menu popups without the need to select one of the items, for example. If this option is deactivated, it can be used to create popups that remain visible until they are closed, e.g., using a close switch on the popup. (Since HALion 6.3)
  • Mode: Specifies how the popup template is opened.
    • Inherit: Uses the popup mode of the switch that opens the popup.
    • Overlay: Opens the popup as a layer over the macro page. This means that the popup is restricted to the dimensions of the macro page.
    • Window: Opens the popup as an individual window. This allows you to display popup templates that are too large to remain within the boundaries of the macro page. In this mode, Close on Click is set to Outside and cannot be deactivated. This is to prevent popup windows from moving behind the plug-in window. (Since HALion 7.0)
  • Placement: Here, you can specify where on the macro page the popup is shown. The options define the postion of the popup in relation to the switch. (Since HALion 6.3)
    • Place Left: The popup opens on the left side of the switch.
    • Place Right: The popup opens on the right side of the switch.
    • Place Left+Right: The popup opens horizontally centered.
    • Place Above: The popup opens above the switch.
    • Place Below: The popup opens below the switch.
    • Place Above+Below: The popup opens vertically centered.
  • Template Parameter: All exported properties of the assigned template are listed here. Only available if a template is assigned. (Since HALion 7.0)

Jump to Top

Examples

Radio buttons

A radio switch group can be realized by connecting several switches, all set to Exclusive mode, to the same parameter. For each switch, the Onvalue must be specified.

Switching pages:

  1. Create an integer variable, name it "Pages", e.g., and specify a range of 0-2.
  2. Add three exclusive switches and set their Values to the variable "Pages".
  3. Set the Onvalues of the switches to 0,1, and 2.
  4. Add a Stack with three child views and set the stack Value to the variable "Pages", too.
  5. The switches now allow you to switch between the three views.

Hover Mode Switch

The Hover mode can be used to switch between stack views when hovering over a switch control. Since the switch can also be used invisible, i.e., without any bitmap assigned, it can be layered under a knob control and control a stack view switching between the parameter label and a text view displaying the current parameter value. To see how this can be set up, load one of the knobs from the Additional Controls library.

Jump to Top