• References
    • Main
    • RenderKit
    • LibJS
    • Canvas
  • Components
    • Overview
    • Page
    • Basic
      • Rectangle
      • Text
      • Button
      • HTML Article
      • Toggle Button
      • Tiler
      • Web View
      • Image Zoomer
    • Navigation
      • Carousel
    • Forms
      • Form
      • Text Entry
    • Layout
      • Group
  • Web API
  • Tutorials
  • Contact
Menu
  • References
    • Main
    • RenderKit
    • LibJS
    • Canvas
  • Components
    • Overview
    • Page
    • Basic
      • Rectangle
      • Text
      • Button
      • HTML Article
      • Toggle Button
      • Tiler
      • Web View
      • Image Zoomer
    • Navigation
      • Carousel
    • Forms
      • Form
      • Text Entry
    • Layout
      • Group
  • Web API
  • Tutorials
  • Contact
Umajin Developer > Components > Toggle Button

 

Toggle Button

Check out the standard help for an overview of the toggle button.

API Examples

// Internally the component is known as "toggle_button"
var toggle_buttonComponent1 = findComponent("My Page", "toggle_button", "MyToggleButton"); // To retrieve a toggle_button component called "MyToggleButton" on a page called "My Page"
var toggle_buttonComponent2 = findComponentInForeground("My Foreground", "toggle_button", "MyToggleButton"); // To retrieve a toggle_button component in the foreground.
var toggle_buttonComponent3 = createComponent(parentComponent, "toggle_button", 0, 0, 100, 100); // to create a toggle_button component inside a custom component.
 
// Retrieving a property
var textOnToggleButton = getProperty(toggle_buttonComponent1, "text");
console.log(textOnToggleButton);
 
// Setting a property
setProperty(toggle_buttonComponent1, "text", "on"); 
setProperty(toggle_buttonComponent1, "toggled_text", "off");

Properties

See the shared property list for all properties available for this component.

PropertyTypeDescription
textstringThe text of normal status
toggled_textstringThe text of toggled status
hide_textboolHide / show the text
keep_aspect_ratio_modeboolDefault is false.
default_filenamestringThe image of normal status
down_filenamestringThe image when pressed
disabled_filenamestringThe image of disabled status
slice_top, slice_bottom
slice_left, slice_right
numberUsed to preserve the edges of an image when resizing.
To quickly find optimal slice values, place a component using the editor and choose ‘Edit Values’.
icon_filenamestringThe filename of icon.
icon_scalenumberScales the icon based on native size of the icon.
font_filenamestringThe filename of a font inside the /fonts folder (e.g vera.ttf). If the font isn’t found the text will disappear.
font_sizenumberThe size of the font. Decimal values are allowed.
toggled_font_filenamestringThe filename of a font inside the /fonts folder (e.g vera.ttf). If the font isn’t found the text will disappear.
toggled_font_sizenumberThe size of the font. Decimal values are allowed.
trackingnumberDistance between characters.
toggled_trackingnumberDistance between characters.
scale_border_with_screenboolProportionally scales the sides, edges and corners of the nine slice image that are set in the editable values of the image used as a base for the component if it is true.
text_scalingstringScales the text.
caption_x_posrealThe x position of the text
caption_y_posrealThe y position of the text
icon_x_posrealThe x position of the icon
icon_y_posrealThe y position of the icon
font_alignnumber 
enabled boolEnable / Disable
toggled boolNormal / Toggled
toggled_default_filename stringThe image of toggled status
toggled_down_filename stringThe image when pressed
toggled_disabled_filename stringThe image of disable status

Events

See the shared event list for all events available for this component.

EventParamsDescription
on_activated  called when set it activated
on_deactivated  called when set it deactivated
  • Developer Home
  • Umajin Home
  • Support Home
Menu
  • Developer Home
  • Umajin Home
  • Support Home