Hello

I want to use box transition to make appear a item from the left of
the window. I have written a small example with a hbox with a button
in it. When I click on the button, with a transition, i make the box
item appears from the left.

But this second item is misaligned (see screenshot on the left), it is
shift to the top and I can understand why.

This second item is composed with a box, with an entry and 2 icons in
it. When I enter text in this entry, the item is shift to bottom and
is correctly aligned

does someone see what my error is ?

sample attached

thank you

Vincent Torri
#include <Elementary.h>

Evas_Object *hbox0;

static void
_win_delete_cb(void *data, Evas *e EINA_UNUSED,
        Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
{
    elm_exit();
}

static Evas_Object *
search_new(Evas_Object *win)
{
    Evas_Object *o;
    Evas_Object *hbox;
    Evas_Object *vbox;

    o = elm_box_add(win);
    evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
    elm_box_horizontal_set(o, EINA_TRUE);
    /* elm_box_pack_end(hbox0, o); */
    evas_object_show(o);
    hbox = o;

    o = elm_entry_add(win);
    elm_entry_single_line_set(o, EINA_TRUE);
    elm_entry_scrollable_set(o, EINA_TRUE);
    elm_object_part_text_set(o, "guide", "Type search text here");
    evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
    elm_box_pack_end(hbox, o);
    evas_object_show(o);

    o = elm_box_add(win);
    evas_object_size_hint_weight_set(o, 0.0, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
    elm_box_horizontal_set(o, EINA_FALSE);
    elm_box_pack_end(hbox, o);
    evas_object_show(o);
    vbox = o;

    o = elm_button_add(win);
    elm_object_style_set(o, "spinner/increase/default");
    elm_box_pack_end(vbox, o);
    evas_object_show(o);

    o = elm_button_add(win);
    elm_object_style_set(o, "spinner/decrease/default");
    elm_box_pack_end(vbox, o);
    evas_object_show(o);

    return hbox;
}

static void
_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
  Evas_Object *o;
  Elm_Box_Transition *l;

  o = search_new(data);
  elm_box_pack_start(hbox0, o);
  l = elm_box_transition_new(2.0, evas_object_box_layout_stack,
                             NULL, NULL, evas_object_box_layout_horizontal, NULL, NULL,
                             NULL, NULL);
  elm_box_layout_set(hbox0, elm_box_layout_transition, l, elm_box_transition_free);
}

EAPI_MAIN int
elm_main(int argc, char *argv[])
{
    Evas_Object *win;
    Evas_Object *bg;
    Evas_Object *o;

    /* window */
    o = elm_win_add(NULL, "etui", ELM_WIN_BASIC);
    elm_win_title_set(o, "search");
    elm_win_focus_highlight_enabled_set(o, EINA_TRUE);
    elm_win_autodel_set(o, EINA_TRUE);
    evas_object_event_callback_add(o, EVAS_CALLBACK_DEL,
                                   _win_delete_cb, NULL);
    win = o;

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

    o = elm_box_add(win);
    evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
    elm_box_horizontal_set(o, EINA_TRUE);
    elm_win_resize_object_add(win, o);
    evas_object_show(o);
    hbox0 = o;

    o = elm_button_add(win);
    elm_object_text_set(o, "Button 2");
    evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_smart_callback_add(o, "clicked", _cb, win);
    elm_box_pack_end(hbox0, o);
    evas_object_show(o);

    elm_box_layout_set(hbox0, evas_object_box_layout_stack, NULL, NULL);

    evas_object_resize(win, 480, 640);
    evas_object_show(win);

    elm_run();

    return 0;
}
ELM_MAIN()
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to