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

Reply via email to