test_notify,popup: Add key event reacting examples.

There is a bug in notify. This test reveals the bugs :)
This commit is contained in:
Daniel Juyung Seo 2014-11-24 15:29:39 +09:00
parent 0c933506a8
commit 805590526e
2 changed files with 22 additions and 0 deletions

View File

@ -37,6 +37,15 @@ _notify_block(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
printf("Notify block area clicked!!\n");
}
static void
_notify_key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Event_Key_Down *ev = event_info;
printf("Key down: %s\n", ev->keyname);
}
void
test_notify(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@ -89,6 +98,8 @@ test_notify(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
elm_notify_timeout_set(notify, 5.0);
evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL);
evas_object_smart_callback_add(notify, "block,clicked", _notify_block, NULL);
evas_object_event_callback_add(notify, EVAS_CALLBACK_KEY_DOWN,
_notify_key_down_cb, NULL);
bx = elm_box_add(win);
elm_object_content_set(notify, bx);

View File

@ -106,6 +106,15 @@ _list_click(void *data EINA_UNUSED, Evas_Object *obj,
elm_list_item_selected_set(it, EINA_FALSE);
}
static void
_popup_key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Event_Key_Down *ev = event_info;
printf("Key: %s\n", ev->keyname);
}
static void
_popup_center_text_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
@ -117,6 +126,8 @@ _popup_center_text_cb(void *data, Evas_Object *obj EINA_UNUSED,
"timeout value is 3 seconds");
elm_popup_timeout_set(popup, 3.0);
evas_object_smart_callback_add(popup, "timeout", _response_cb, popup);
evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN,
_popup_key_down_cb, NULL);
// popup show should be called after adding all the contents and the buttons
// of popup to set the focus into popup's contents correctly.