Hi All,

I think I found a bug when I changing button's style. The problem is when I
change style on clicked callback of button, i wrote a little test to
simulate that..
In my test I have a timer (1 sec) that it change style of a button (obj1),
and another button (obj2) that it only change when i click it!
The example is not big, and I'm going to paste here..

O problem is when I change style throght clicked event, label and icon
becomes empty..

-- code

#include <stdio.h>
#include <glib.h>
#include <Elementary.h>

static Ecore_Timer *test = NULL;
static Eina_Bool style1 = EINA_TRUE;
static Eina_Bool style2 = EINA_TRUE;

static Eina_Bool
_change_style1(void *data)
{
    Evas_Object *obj = (Evas_Object *) data;

    if (style1 == EINA_TRUE) {
        elm_object_style_set(obj, "anchor");
    } else {
        elm_object_style_set(obj, "default");
    }
    style1 = !style1;

    return EINA_TRUE;
}

static void
_change_style2(void *data, Evas_Object *obj, void *event_info)
{
    if (style2 == EINA_TRUE) {
        elm_object_style_set(obj, "anchor");
    } else {
        elm_object_style_set(obj, "default");
    }
    style2 = !style2;
}

EAPI int
elm_main(int argc, char **argv)
{
    Evas_Object *parent;
    Evas_Object *obj1, *obj2;

    parent = elm_win_add(NULL, "tip05-gui", ELM_WIN_BASIC);
    if (!parent) goto out;
    evas_object_resize(parent, 350, 150);
    evas_object_show(parent);
    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
    elm_win_autodel_set(parent, EINA_TRUE);

    obj1 = elm_button_add(parent);
    evas_object_resize(obj1, 100, 50);
    evas_object_move(obj1, 50, 50);
    elm_object_text_set(obj1, "Obj 1");
    evas_object_show(obj1);

    obj2 = elm_button_add(parent);
    evas_object_resize(obj2, 100, 50);
    evas_object_move(obj2, 200, 50);
    elm_object_text_set(obj2, "Obj 2");
    evas_object_show(obj2);

    test = ecore_timer_add(1.0, _change_style1, obj2);
    evas_object_smart_callback_add(obj1, "clicked", _change_style2, NULL);

    elm_run();
    elm_shutdown();

out:
    evas_object_del(parent);

    return 0;
}
ELM_MAIN()


Regards,

-- 
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