Yes, as Raster replied, this is tricky and you need to use timer as a work around. But here is one more important thing. Even though the focus is moved to a button, list item is still highlighted. If you don't want it to be highlighted, you also need to call elm_list_item_selected_set(item, EINA_FALSE); Thanks.
Daniel Juyung Seo (SeoZ) On Fri, Jan 13, 2012 at 9:22 AM, Carsten Haitzler <[email protected]> wrote: > On Thu, 12 Jan 2012 14:34:34 -0200 Guilherme Silveira <[email protected]> said: > > set the list to be not focusable. doing this kind of thing with focus as a > result of actions on 1 widget to set focus on another is ALWAYS bound to have > conflicts. your alternative is to set the focus in a timer (ie wait 0.2 sec > then focus other button hoping that list has finished its human interactions > by > then). you are at the mercy of policies that are flexible and may change from > desktop to touchscreen to something else. > >> Hi All, >> >> I have a problem with lists.. >> In my list has a lot of items, I would like when I press Enter or double >> click on item of the list, a button gain focus. >> To do that I connect my callback function into "activated" event.. when I >> use enter everything is right, but when I use double click some problems >> appears. >> >> The callback is called when I PRESS item on second time, so when I release >> (mouse up in the second time) the focus is setted to list again... >> So I can set focus to another button, but when I release mouse the focus >> back to list.. >> >> I wrote a simple example to demonstrate that.. >> >> Try select item of list e press ENTER.. Ok everything works fine.. >> But now, try double click into an item of list.. >> Better of that, in the second time, don't release the mouse button, you can >> see that focus is right, and when you release, the focus come back to the >> list. >> >> #include <stdio.h> >> #include <Elementary.h> >> >> static Evas_Object *button; >> >> static void >> _list_activated(void *data, Evas_Object *obj, void *event_info) >> { >> elm_object_focus_set(button, EINA_TRUE); >> } >> >> EAPI int >> elm_main(int argc, char **argv) >> { >> Evas_Object *parent; >> Evas_Object *bg; >> Evas_Object *list; >> >> parent = elm_win_add(NULL, "tip05-gui", ELM_WIN_BASIC); >> if (!parent) goto out; >> elm_win_focus_highlight_enabled_set(parent, EINA_TRUE); >> evas_object_show(parent); >> elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); >> elm_win_autodel_set(parent, EINA_TRUE); >> >> bg = elm_bg_add(parent); >> elm_win_resize_object_add(parent, bg); >> evas_object_show(bg); >> evas_object_resize(parent, 350, 250); >> >> button = elm_button_add(parent); >> evas_object_resize(button, 100, 50); >> evas_object_move(button, 50, 50); >> elm_object_text_set(button, "Button"); >> evas_object_show(button); >> >> list = elm_list_add(parent); >> evas_object_resize(list, 100, 200); >> evas_object_move(list, 200, 50); >> evas_object_show(list); >> >> elm_list_item_append(list, "name 1", NULL, NULL, NULL, NULL); >> elm_list_item_append(list, "name 2", NULL, NULL, NULL, NULL); >> elm_list_item_append(list, "name 3", NULL, NULL, NULL, NULL); >> elm_list_go(list); >> >> evas_object_smart_callback_add(list, "activated", _list_activated, >> NULL); >> >> elm_run(); >> elm_shutdown(); >> >> out: >> evas_object_del(parent); >> >> return 0; >> } >> ELM_MAIN() >> >> >> -- >> Guilherme Silveira >> E-mail: [email protected] >> ------------------------------------------------------------------------------ >> RSA(R) Conference 2012 >> Mar 27 - Feb 2 >> Save $400 by Jan. 27 >> Register now! >> http://p.sf.net/sfu/rsa-sfdev2dev2 >> _______________________________________________ >> enlightenment-devel mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel >> > > > -- > ------------- Codito, ergo sum - "I code, therefore I am" -------------- > The Rasterman (Carsten Haitzler) [email protected] > > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Mar 27 - Feb 2 > Save $400 by Jan. 27 > Register now! > http://p.sf.net/sfu/rsa-sfdev2dev2 > _______________________________________________ > enlightenment-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
