Button Position (ELM Gear S2)

Button Position (ELM Gear S2)

BY 27 Nov 2015 Native Application Development

The following code generates the basic UI, including a button. The button should appear at the bottom of the screen, but it is at top for some reason.

Any help is appreciated!

static void create_base_gui(appdata_s *ad, int width, int height)
{
    int ret;
    watch_time_h watch_time = NULL;

    /* Window */
    ret = watch_app_get_elm_win(&ad->win);
    if (ret != APP_ERROR_NONE) {
        dlog_print(DLOG_ERROR, LOG_TAG, “failed to get window. err = %d”, ret);
        return;
    }

    evas_object_resize(ad->win, width, height);

    /* Conformant */
    ad->conform = elm_conformant_add(ad->win);
    evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(ad->win, ad->conform);
    evas_object_show(ad->conform);

    /* Label*/
    ad->label = elm_label_add(ad->conform);
    evas_object_resize(ad->label, width, height / 3);
    evas_object_move(ad->label, 0, height / 3);
    evas_object_show(ad->label);

    /*OK Button*/
    ad->button = elm_button_add(ad->conform);
    evas_object_resize(ad->button, width, height / 4);
    elm_object_style_set(ad->button, “bottom/queue”);
    elm_object_text_set(ad->button, “CLICK”);
    evas_object_smart_callback_add(ad->button, “clicked”, btn_clicked_cb, ad);
    evas_object_show(ad->button);

    ret = watch_time_get_current_time(&watch_time);
    if (ret != APP_ERROR_NONE)
        dlog_print(DLOG_ERROR, LOG_TAG, “failed to get current time. err = %d”, ret);

    update_watch(ad, watch_time, 0);
    watch_time_delete(watch_time);

    /* Show window after base gui is set up */
    evas_object_show(ad->win);
}

Written by