Languages

Menu
Sites
Language
Naviframe with background not visible

I have an app code that shows white screen instead of the backgound. The code is using Naviframe so that two screens can be displayed.

static void
create_base_gui(appdata_s *ad)
{
    char buf[PATH_MAX];

    /* Window */
    ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
    elm_win_autodel_set(ad->win, EINA_TRUE);

    if (elm_win_wm_rotation_supported_get(ad->win)) {
        int rots[1] = {0};//{ 0, 90, 180, 270 };
        elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 1);
    }

    evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
    eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);

    /* Conformant */
    ad->conform = elm_conformant_add(ad->win);
    elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_HIDE);
    elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
    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);

    // Naviframe
    ad->naviframe = elm_naviframe_add(ad->conform);
    elm_object_content_set(ad->conform, ad->naviframe);
    evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(ad->conform, ad->naviframe);
    evas_object_show(ad->naviframe);

/*    Evas_Object *box = elm_box_add(ad->naviframe);
    elm_box_horizontal_set(box, EINA_FALSE);
    evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
    elm_naviframe_item_push(ad->naviframe, "Game Menu", NULL, NULL, box, NULL);
    evas_object_show(box);*/

    // background
    Evas_Object *background = elm_bg_add(ad->naviframe);
     elm_win_resize_object_add(ad->naviframe, background);
    snprintf(buf, sizeof(buf), "%s/menu.png", IMG_DIR);
    elm_bg_file_set(background, buf, NULL);
    evas_object_size_hint_weight_set(background, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(background, EVAS_HINT_FILL, EVAS_HINT_FILL);
//    elm_object_content_set(ad->naviframe, background);
//    elm_win_resize_object_add(ad->naviframe, background);
    evas_object_show(background);

    /* Get window dimensions */
    elm_win_screen_size_get (ad->win, NULL, NULL, &screen_width, &screen_height);


/*    Evas_Object *button_continue = elm_button_add(box);
    Evas_Object *img_continue = elm_image_add(button_continue);
    elm_image_file_set(img_continue, IMG_DIR"/BttnContinue.png", NULL);
    elm_image_resizable_set(img_continue, EINA_TRUE, EINA_TRUE);
    elm_object_part_content_set(button_continue, "icon", img_continue);
    evas_object_size_hint_min_set(button_continue, ELM_SCALE_SIZE(150), ELM_SCALE_SIZE(58));
    evas_object_size_hint_weight_set(button_continue, EVAS_HINT_EXPAND, 0.5);
    evas_object_size_hint_align_set(button_continue, 0.5, 0);
    evas_object_size_hint_min_set(img_continue, 100, 100);
    evas_object_size_hint_max_set(img_continue, 100, 100);
    //evas_object_smart_callback_add(button_continue, "", button_continue_clicked_cb, ad);
    ////elm_object_text_set(button, "   PLAY   ");
    elm_box_pack_end(box, button_continue);
    evas_object_show(button_continue);*/


    /* Label*/
    /*ad->label = elm_label_add(ad->conform);
    elm_object_text_set(ad->label, "Hello EFL");
    evas_object_size_hint_weight_set(ad->label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_object_content_set(ad->conform, ad->label);
    evas_object_show(ad->label);*/


    /* show evas objects */
    /*evas_object_show(background);
    evas_object_show(ad->hole);
    evas_object_show(ad->ball);*/

    /* initialize ball velocity */
    ad->velocity_x = 0;
    ad->velocity_y = 0;

//    start_game(ad);

    register_accelerometer_callback(ad);


    /* Show window after base gui is set up */
    evas_object_show(ad->win);
    ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, keydown_cb, NULL);
    // Register the EFL extension callbacks for Menu and Back key events
//    eext_object_event_callback_add(ad->win, EEXT_CALLBACK_MORE, _create_popup, NULL);
    //eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, _nf_back_cb, win);
//    ea_object_event_callback_add( NULL, EA_CALLBACK_MORE, on_hwkey_down_cb, NULL);
}

 

 

Aashish

 

Responses

3 Replies
Mehedi Alamgir

Check the create_base_gui() function of sample app ClockUi . You will get idea about changes of Naviframe stack.

Ashish Patil

Hello Mehedi,

The sample that you mentioned is not what i am looking for. What i want is to have a naviframe with a background.

 

 

Aashish

Hernan Crespo

Hello Aashish

Could you manage to add a custom background image in Naviframe ? If you could, the please tell me the way. Also if possible please give me a code snippet to add a image in Naviframe background.