Scroller within Box

Scroller within Box

BY 30 Jun 2015 Native Application Development

Hi All,

I am trying to develop terms and condition screen. Where I have a box and inside that a scrollable area (scroller) where user can scroll the terms & condition text message.

I have written following sample code. But I am not able to see any content on the screen. 

What is the wrong with the below code?

    Evas_Object *main_box = elm_box_add(ad->nframe);
    evas_object_size_hint_weight_set(main_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(main_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_show(main_box);

//Here I will add header (“Terms of Use”) and progress bar in box. Then comes below scroller.

    Evas_Object *scroller = elm_scroller_add(main_box);
    elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_TRUE);
    elm_scroller_page_size_set(scroller, 100, 100);
    elm_scroller_policy_set(scroller,ELM_SCROLLER_POLICY_ON,ELM_SCROLLER_POLICY_ON);
    elm_box_pack_end(main_box, scroller);
    evas_object_show(scroller);


    Evas_Object *terms_of_use_text = elm_label_add(scroller);
    std::string msg_text;
    msg_text.assign(“<p><wrap=word><color=’#000000′>”);
    msg_text.append(“My personal terms of use. This text should be visible in scrollable area.”);
    msg_text.append(“</color></word></p>”);
    elm_object_text_set(terms_of_use_text, msg_text.c_str());
    evas_object_size_hint_weight_set(terms_of_use_text, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(terms_of_use_text, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_size_hint_min_set(terms_of_use_text, 500, 500);

    evas_object_show(terms_of_use_text);
    elm_object_content_set(scroller, terms_of_use_text);

    elm_naviframe_item_push(ad->nframe, “Hello”, NULL, NULL, main_box, NULL);

 

Please help.

Written by