Skip to content

2.5 Get current UI controls data

Davide Magni edited this page Sep 2, 2016 · 4 revisions

Koala Library features two types of functions to get a UI Control data:

  1. The developer can retrieve the data as declared in on init callback.

  2. The developer can retrieve the current data of the selected UI Control.

This section will cover the first of the two methods.

NOTE: the functions to retrieve both Current and Default data ARE inline functions, therefore can be used in if statements, while loops etc.

get_type

This function returns the UI Control's type. The Type of each UI Control is an ID set when declaring the UI Control itself according to what UI Control has been declared (Sliders, Knobs, Buttons etc.).

UI Control Type IDs are listed under “System constants”, “User Interface Constants” section of Koala's Manual.

This IS an inline function, therefore it can be used directly as argument in KSP constructs such as if, while etc.

Usage:

if (get_type(<ui_id>) = ...)
	{...}
end if

get_pos_x and get_pos_y

These functions return the current position of the specified UI Control on each axis.

These ARE inline functions, therefore they can be used directly as arguments in KSP constructs such as if, while etc.

Usage:

if (get_pos_x(<ui_id>) = ...)
	{...}
end if

get_width and get_height

These functions return the current size values of the specified UI Control.

These ARE inline functions, therefore they can be used directly as arguments in KSP constructs such as if, while etc.

Usage:

if (get_width(<ui_id>) = ...)
	{...}
end if

get_value

This function returns the current value of the specified UI Control.

This IS an inline function, therefore it can be used directly as argument in KSP constructs such as if, while etc.

Usage:

if (get_value(<ui_id>) = ...)
	{...}
end if

get_picture

This function returns the UI Control's picture name. This function returns a string, so be sure to load its value inside a string value or array.

This IS an inline function, therefore it can be used directly as argument in KSP constructs and functions enabled to receive a string as input.

Usage:

call display_picture_name(get_picture(<ui_id>))

get_visibility

This function returns the UI Control's current visibility status.

This IS an inline function, therefore it can be used directly as argument in KSP constructs and functions enabled to receive a string as input.

Usage:

if (get_visibility(<ui_id>) = ...)
	{...}
end if

get_picture_state

This function returns the UI Control's current picture state. Use this on labels with multiple animations.

This IS an inline function, therefore it can be used directly as argument in KSP constructs and functions enabled to receive a string as input.

Usage:

if (get_picture_state(<ui_id>) = ...)
	{...}
end if
Clone this wiki locally