Cross-platform C SDK logo

Cross-platform C SDK

Slider

❮ Back
Next ❯
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.

Functions

Slider*slider_create (void)
Slider*slider_vertical (void)
voidslider_OnMoved (...)
voidslider_tooltip (...)
voidslider_steps (...)
voidslider_value (...)
real32_tslider_get_value (...)

Sliders are normally used to edit continuous and bounded numerical values (Figure 1). As the control moves, OnMoved events occur that return a value between 0 and 1. In Hello Slider and Progress! you have an example of use.


slider_create ()

Create a new slider control.

Slider*
slider_create(void);

Return

Slider.


slider_vertical ()

Create a new vertical slider.

Slider*
slider_vertical(void);

Return

Slider.


slider_OnMoved ()

Set an event handler for slider movement.

void
slider_OnMoved(Slider *slider,
               Listener *listener);
1
2
3
4
5
6
7
static void i_OnMoved(UserData *data, Event *e)
{
    const EvSlider *p = event_params(e, EvSlider);
    do_something_onmoved(data, p->pos);
}
...
slider_OnMoved(slider, listener(data, i_OnMoved, UserData));
slider

Slider.

listener

Callback function that will be called continuously while the user moves a slider.

Remarks

EvSlider contains the event parameters, see GUI Events.


slider_tooltip ()

Set a tooltip for the slider. It is a small explanatory text that will appear when the mouse is over the control.

void
slider_tooltip(Slider *slider,
               const char_t *text);
slider

Slider.

text

UTF8 C-string terminated in null character '\0'.


slider_steps ()

Changes the slider from continuous range to discrete intervals.

void
slider_steps(Slider *slider,
             const uint32_t steps);
slider

Slider.

steps

Number of intervals. Use UINT32_MAX to return to continuous range.


slider_value ()

Set the slider position.

void
slider_value(Slider *slider,
             const real32_t value);
slider

Slider.

value

The position between 0.0 and 1.0.


slider_get_value ()

Get the slider position.

real32_t
slider_get_value(const Slider *slider);
slider

Slider.

Return

The normalized position between 0.0 and 1.0.

❮ Back
Next ❯