Table of Contents

Widgets Menu


Spinner Widgets

The spinner widget increases or decreases a numeric value with the arrow buttons.

This widget inherits from the layout widget, so all functions concerning the layout widget are used on the spinner widget.

Table of Contents

Adding a Spinner

This is how to create a spinner object.

Evas_Object *spin;
spin = elm_spinner_add(parent);

This widgets allows a “vertical” style: up/down buttons at the right side and text left aligned.

Configuring the Spinner

The label format is set to a different value:

elm_spinner_label_format_set(spin, "%1.2f meters");

You can determine the result of clicking the arrow buttons. In this example, a click on an arrow increases or decreases with 2.0 units:

elm_spinner_step_set(spin, 2.0);

The wrapping mode is activated. In this mode, the spinner wraps when it reaches its minimum or maximum value.

elm_spinner_wrap_set(spin, EINA_TRUE);

We set the minimum and maximum values of the spinner.

elm_spinner_min_max_set(spin, -25.0, 100.0);

The spinner object can be set vertical, and the change interval when the user presses the arrows long can be modified so that it changes faster.

elm_object_style_set(spin, "vertical");
elm_spinner_interval_set(spin, 0.1);

If the user has to select between text values instead of numerical values, it is possible to add our own text labels. Here spin2 object shows three numbers written in text characters.

Evas_Object *spin2 = elm_spinner_add(parent);
elm_spinner_min_max_set(spin2, 1, 3);
elm_spinner_special_value_add(spin2, 1, "One");
elm_spinner_special_value_add(spin2, 2, "Two");
elm_spinner_special_value_add(spin2, 3, "Three");

Using Spinner Callbacks

This widget emits the following signals, besides the ones sent from Layout:

This is how to register a callback on the “delay,changed” signal.

evas_object_smart_callback_add(spin, "delay,changed", _delay_changed_cb, data);
// Callback function for the "delay,changed" signal
// This callback is called a short time after the spinner value changes
static void
_delay_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
   printf(The spinner value has changed\n");
}


A Spinner Example


Widgets Menu