Check
This feature is supported in wearable applications only.
The check component is similar to the radio component, except that it does not work as a group. It toggles a boolean value between true and false.
The check component inherits from the layout component, which means that layout functions can be used on the check component.
For more information, see the Check API.
Figure: Check component
Figure: Check hierarchy
Adding a Check Component
To create a check component, use the elm_check_add() function:
Evas_Object *check, *parent; check = elm_check_add(parent);
Modifying the Check Styles
Set the check component style with the elm_object_style_set() function.
The following styles are available for the rectangular screen:
- default
- on and off
The following styles are available for the circular screen:
- default
- small
- on and off
To set the on and off style on the check object:
elm_object_style_set(check, "on and off");
To get the current style, use the elm_object_style_get() function:
char *style = elm_object_style_get(check);
Using the Check Component
To use the check component:
-
Set the check component's boolean value to EINA_TRUE:
elm_check_state_set(check, EINA_TRUE);
-
Retrieve the current value of the check object:
Eina_Bool value = elm_check_state_get(check);
-
Set an icon for the rectangular screen:
// Create a Home icon Evas_Object *icon; icon = elm_icon_add(parent); elm_icon_standard_set(icon, "home"); // Set it to the check object elm_object_part_content_set(check, "icon", icon);
-
Retrieve the content set to the check object:
// Get the content set in the icon part Evas_Object *icon = elm_object_part_content_get(check, "icon");
Using the Check Callbacks
When the value is changed by the user, the changed signal is emitted. The event_info parameter is NULL.
To register a callback on the changed signal:
{ evas_object_smart_callback_add(check, "changed", changed_cb, data); } // Callback function for the "changed" signal // This callback is called when the check value changes void changed_cb(void *data, Evas_Object *obj, void *event_info) { dlog_print(DLOG_INFO, LOG_TAG, "The value has changed\n"); }
Note |
---|
Except as noted, this content is licensed under LGPLv2.1+. |