refactor(event): add _cb postfix to lv_obj_add_event()
This commit is contained in:
@@ -21,7 +21,7 @@ In practice, it looks like this:
|
||||
.. code:: c
|
||||
|
||||
lv_obj_t * btn = lv_btn_create(lv_screen_active());
|
||||
lv_obj_add_event(btn, my_event_cb, LV_EVENT_CLICKED, NULL); /*Assign an event callback*/
|
||||
lv_obj_add_event_cb(btn, my_event_cb, LV_EVENT_CLICKED, NULL); /*Assign an event callback*/
|
||||
|
||||
...
|
||||
|
||||
@@ -42,17 +42,17 @@ More events can be added to an object, like this:
|
||||
|
||||
.. code:: c
|
||||
|
||||
lv_obj_add_event(obj, my_event_cb_1, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event(obj, my_event_cb_2, LV_EVENT_PRESSED, NULL);
|
||||
lv_obj_add_event(obj, my_event_cb_3, LV_EVENT_ALL, NULL); /*No filtering, receive all events*/
|
||||
lv_obj_add_event_cb(obj, my_event_cb_1, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(obj, my_event_cb_2, LV_EVENT_PRESSED, NULL);
|
||||
lv_obj_add_event_cb(obj, my_event_cb_3, LV_EVENT_ALL, NULL); /*No filtering, receive all events*/
|
||||
|
||||
Even the same event callback can be used on an object with different
|
||||
``user_data``. For example:
|
||||
|
||||
.. code:: c
|
||||
|
||||
lv_obj_add_event(obj, increment_on_click, LV_EVENT_CLICKED, &num1);
|
||||
lv_obj_add_event(obj, increment_on_click, LV_EVENT_CLICKED, &num2);
|
||||
lv_obj_add_event_cb(obj, increment_on_click, LV_EVENT_CLICKED, &num1);
|
||||
lv_obj_add_event_cb(obj, increment_on_click, LV_EVENT_CLICKED, &num2);
|
||||
|
||||
The events will be called in the order as they were added.
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ event. For example:
|
||||
|
||||
...
|
||||
|
||||
lv_obj_add_event(screen1, my_event, LV_EVENT_GESTURE, NULL);
|
||||
lv_obj_add_event_cb(screen1, my_event, LV_EVENT_GESTURE, NULL);
|
||||
|
||||
To prevent passing the gesture event to the parent from an object use
|
||||
:cpp:expr:`lv_obj_remove_flag(obj, LV_OBJ_FLAG_GESTURE_BUBBLE)`.
|
||||
|
||||
@@ -225,7 +225,7 @@ to combine scroll event and store the scroll top position.
|
||||
}
|
||||
|
||||
lv_obj_t* container = lv_obj_create(NULL);
|
||||
lv_obj_add_event(container, store_scroll_value_event_cb, LV_EVENT_SCROLL, NULL);
|
||||
lv_obj_add_event_cb(container, store_scroll_value_event_cb, LV_EVENT_SCROLL, NULL);
|
||||
|
||||
Scroll coordinates can be retrieved from different axes with these
|
||||
functions:
|
||||
|
||||
Reference in New Issue
Block a user