Flipselector
This feature is supported in mobile applications only.
The flipselector component shows a set of text items one at a time. The user can flip up or down the selector to change the text on it.
For more information, see the Flipselector API.
Figure: Flipselector component
Figure: Flipselector hierarchy
Adding a Flipselector Component
To create a flipselector component, use the elm_flipselector_add() function:
Evas_Object *flipselector, *parent; flipselector = elm_flipselector_add(parent);
Configuring the Flipselector
Use the elm_flipselector_first_interval_set() function to set the interval for a user's mouse button hold on a flipselector. After this interval, the text is changed regularly while the mouse button remains held down.
elm_flipselector_first_interval_set(flipselector, 2.0);
Adding Items
The following example shows how to add an item object with the number "99". By passing the it_select_cb() smart callback as a parameter, the callback is called when the item is selected.
Elm_Object_Item *flip_it; flip_it = elm_flipselector_item_append(flipselector, "99", it_select_cb, NULL); // Callback function called when the flip_it object is selected void it_select_cb(void *data, Evas_Object *obj, void *event_info) { dlog_print(DLOG_INFO, LOG_TAG, "flip_it selected\n"); }
An item can be prepended with the elm_flipselector_item_prepend() function.
Changing the Values
To change the values:
-
Show the next text using the elm_flipselector_flip_next() function:
elm_flipselector_flip_next(flipseletor);
-
Show the previous text using the elm_flipselector_flip_prev() function:
elm_flipselector_flip_prev(flipseletor);
-
Show the text of the specific item using the elm_flipselector_item_selected_set() function. When this function sets EINA_FALSE to the selected item, the flipselector shows the text of the first item.
elm_flipselector_item_selected_set(flip_it, EINA_TRUE);
Using the Flipselector Callbacks
The flipselector component emits the following signals:
- selected: The flipselector's selected text item is changed.
- overflowed: The flipselector's current selection is changed from the first item to the last one.
- underflowed: The flipselector's current selection is changed from the last item to the first one.
When the user selects an item in the flipselector, the selected signal is emitted. The following example shows how to implement a callback function for this signal.
static void _flip_selected_cb(void *data, Evas_Object *obj, void *event_info) { Elm_Object_Item *flip_it = event_info; // Code that does the desired action }
This callback function can be registered with the evas_object_smart_callback_add() function:
evas_object_smart_callback_add(flipselector, "selected", _flip_selected_cb, NULL);
Note |
---|
Except as noted, this content is licensed under LGPLv2.1+. |