Hi,

I want a function to be called once an object loses the focus.

I tried to add an evas object event callback for EVAS_CALLBACK_FOCUS_OUT,
but it never gets called. See the attached code.

Hopefully I'm just doing something wrong.

-- 
Leif
#include <stdio.h>
#include <evas-1/Evas.h>
#include <elementary-1/Elementary.h>

static void __focus_out_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);

EAPI_MAIN int
elm_main(int argc, char **argv)
{
   unsigned int i;
   Evas_Object *win, *bg, *bx;

   win = elm_win_add(NULL, "Focus out bug", ELM_WIN_BASIC);
   elm_win_title_set(win, "Focus out bug");
   elm_win_autodel_set(win, EINA_TRUE);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   elm_win_focus_highlight_enabled_set(win, EINA_TRUE);

   bg = elm_bg_add(win);
   elm_win_resize_object_add(win, bg);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(bg);

   bx = elm_box_add(win);
   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bx);
   elm_box_horizontal_set(bx, EINA_TRUE);
   evas_object_show(bx);

   for (i = 1; i < 3; i++)
   {
       char buf[32];
       Evas_Object *button = elm_button_add(bx);
       snprintf(buf, (sizeof(buf) - 1), "Button %i", i);
       elm_object_text_set(button, buf);
       evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
       evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
       evas_object_event_callback_add(button, EVAS_CALLBACK_FOCUS_OUT, __focus_out_cb, NULL);
       elm_box_pack_end(bx, button);
       evas_object_show(button);
   }

   evas_object_resize(win, 320, 240);
   evas_object_show(win);

   elm_run();
   elm_shutdown();

   return 0;
}
ELM_MAIN()

    static void
__focus_out_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
    printf("Object %p lost the focus\n", obj);
}
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to