Class mct_slider
MCT Slider type
Functions
wrapped_type:new (option_obj) | Create a new wrapped type within an mct_option. |
wrapped_type:check_validity (value) | Checks the validity of the value passed. |
wrapped_type:set_default () | Sets the default value for this mct_option. |
wrapped_type:ui_select_value (val) | Selects a value in the UI for this option. |
wrapped_type:ui_change_state () | Change the UI state; ie., lock if it's set to lock. |
wrapped_type:ui_create_option (dummy_parent) | Create the slider in UI. |
wrapped_type:slider_get_precise_value (value, as_string, override_precision) | Get a precise value for this slider, minding the precision set. |
wrapped_type:slider_set_step_size (step_size, step_size_precision) | Set function to set the step size for moving left/right through the slider. |
wrapped_type:slider_set_precision (precision) | Setter for the precision on the slider's displayed value. |
wrapped_type:slider_set_min_max (min, max) | Setter for the minimum and maximum values for the slider. |
wrapped_type:test_text (text) | this is the tester function for supplied text into the string. |
wrapped_type:ui_create_popup () | Creates the edit-in-UI popup. |
Functions
Methods- wrapped_type:new (option_obj)
-
Create a new wrapped type within an mct_option.
Parameters:
- option_obj mct_option The mctoption this wrappedtype is being passed.
- wrapped_type:check_validity (value)
-
Checks the validity of the value passed.
Parameters:
- value any Tested value.
Returns:
- boolean valid Returns true if the value passed is valid, false otherwise.
- boolean valid_return If the value passed isn't valid, a second return is sent, for a valid value to replace the tested one with.
- wrapped_type:set_default ()
- Sets the default value for this mct_option. Returns the exact median value for this slider, with precision in mind.
- wrapped_type:ui_select_value (val)
-
Selects a value in the UI for this option.
Called from mct_option:set_selected_setting.
Parameters:
- val
- wrapped_type:ui_change_state ()
- Change the UI state; ie., lock if it's set to lock. Called from mct_option:set_uic_locked.
- wrapped_type:ui_create_option (dummy_parent)
-
Create the slider in UI.
Parameters:
- dummy_parent
- wrapped_type:slider_get_precise_value (value, as_string, override_precision)
-
Get a precise value for this slider, minding the precision set.
Parameters:
- value number The number to change the precision for.
- as_string boolean Set to true if you want a string returned instead of a number.
- override_precision number or nil A number to change the precision. If not set, it will use the value set in mct_slider:slider_set_precision.
Returns:
-
number or string
precise_value The new number with the precision in mind.
- wrapped_type:slider_set_step_size (step_size, step_size_precision)
-
Set function to set the step size for moving left/right through the slider.
Works with floats and other numbers. Use the optional second argument if using floats/decimals
Parameters:
- step_size number The number to jump when using the left/right button.
- step_size_precision number The precision for the step size, to prevent weird number changing. If the step size is 0.2, for instance, the precision would be 1, for one-decimal-place.
- wrapped_type:slider_set_precision (precision)
-
Setter for the precision on the slider's displayed value. Necessary when working with decimal numbers.
The number should be how many decimal places you want, ie. if you are using one decimal place, send 1 to this function; if you are using none, send 0.
Parameters:
- precision number The precision used for floats.
- wrapped_type:slider_set_min_max (min, max)
-
Setter for the minimum and maximum values for the slider. If the UI already exists, this method will do a quick check to make sure the current value is between the new min/max, and it will change the lock states of the left/right buttons if necessary.
Parameters:
- min number The minimum number the slider value can reach.
- max number The maximum number the slider value can reach.
- wrapped_type:test_text (text)
-
this is the tester function for supplied text into the string.
checks if it's a number; if it's valid within precision; if it's valid within min/max
Parameters:
- text
- wrapped_type:ui_create_popup ()
- Creates the edit-in-UI popup.