Languages

Menu
Sites
Language
Toolbar item text get

Hi All,

I have created a toolbar and appended three Items into it.

Then I do elm_toolbar_item_selected_set(item, EINA_TRUE); this does call the callback function registered while appending the Item.

What I observed is, when I do "elm_object_item_text_get(item);", The title text is not returned. I mean Its the empty string. ""

 

When I manually select the Item, I get the Title text as desired.

Am I missing anything or its an issue with toolbar?

Thanx,

Ashwini

Responses

2 Replies
Jean Yang

Hi, 

I guess you used the return string to switch into different view, here is the simple way to check your issue, create sample UI controls in the IDE, in this sample, find the toolbar related file, and you can check from the below function, or you can share your code let's find where is wrong.

static void
toolbar_it_cb(void *data, Evas_Object *obj, void *event_info)
{
    Evas_Object *nf = data;
    Evas_Object *sub_view;
    Elm_Object_Item *it;
    const char *str = NULL;

    it = event_info;

    str = elm_object_item_text_get(it);

    if (str == NULL || !strcmp(str, "Main")) {
        sub_view = create_main_list(nf);
    } else if (!strcmp(str, "Playlist")) {
        sub_view = create_play_list(nf);
    } else if (!strcmp(str, "Artists list")) {
        sub_view = create_artists_list(nf);
    } else if (!strcmp(str, "Songs")) {
        sub_view = create_song_list(nf);
    } else if (!strcmp(str, "Dialer")) {
        sub_view = create_dialer_list(nf);
    } else {
        sub_view = create_main_list(nf);
    }

    elm_object_content_set(nf, sub_view);
}

colin Rao

Hi,

I've encounter the issue, but the scenario isn't same with you. My issue was raise when I call "elm_toolbar_select_mode_set(tabbar, ELM_OBJECT_SELECT_MODE_ALWAYS);" before any items been added.

You can check the details at https://developer.tizen.org/forums/native-application-development/efl-toolbar-bug

As your scenario, it's ok in my local environment. Paste the sample code here as your reference,

static Evas_Object*
create_toolbar(appdata_s *ad)
{
    Evas_Object *tabbar;

	tabbar = elm_toolbar_add(ad->conform);
	elm_object_style_set(tabbar, "tabbar");
	elm_toolbar_shrink_mode_set(tabbar, ELM_TOOLBAR_SHRINK_NONE);
	elm_toolbar_transverse_expanded_set(tabbar, EINA_TRUE);

	elm_toolbar_item_append(tabbar, NULL, TXT_TABBAR_ITEM_MSG, tabbar_item_cb, ad);
	elm_toolbar_item_append(tabbar, NULL, TXT_TABBAR_ITEM_CAT, tabbar_item_cb, ad);
	elm_toolbar_item_append(tabbar, NULL, TXT_TABBAR_ITEM_ME, tabbar_item_cb, ad);

	return tabbar;
}

    ad->tabbar = create_toolbar(ad);
    Elm_Object_Item *tabbar_it = elm_toolbar_item_find_by_label(ad->tabbar, TXT_TABBAR_ITEM_CAT);
    elm_toolbar_item_selected_set(tabbar_it, EINA_TRUE);