Touch setting

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

touch_setting(node_id,property,value) 

touch_setting is used to configure touch settings for dials, buttons or switches.

Return value

This function won't return any value.

Arguments

# Argument Type Description
1 node_id ID Node identifier. This can be obtained by calling functions like dial_add or switch_add.
2 property String Setting property.
3 value Object The value to set for the property. The type of value depends on the chosen property.

Properties

# Property Type Applies to Default Description
1 SHOW_HIGHLIGHT Boolean Switch, Dial true Show or hide the blue ellipse, which by default shows up on touch.
2 ROTATE_TICK Number Switch, Dial 20 This value determines the degrees between two dial callbacks. E.g. If you make a full 360 rotation with your finger, setting the tick_degrees to 180 will give you 2 dial callback calls.
3 SCROLL_TICK Number Scroll wheel Dynamic This value determines the number of pixels between two scroll wheel callbacks.
4 FORCE_ROTATE_MODE Boolean Switch false Forces the rotation mode of a switch. When a switch has 2 positions, it will go into a click mode, where you cannot rotate your finger around it. Setting this property to true will force the switch into the rotation mode, even when only 2 positions are available.

Example

function callback(direction)
  print("dial has been turned another 90 degrees")
end
 
dial_id = dial_add("a.png", 100,100,100,100,callback)

-- We want to get a dial tick every 90 degrees
touch_setting(dial_id , "ROTATE_TICK", 90)

-- We do not want to show highlighting on this dial
touch_setting(dial_id , "SHOW_HIGHLIGHT", false)