Find Label by ID

I am using the UI Builder to build an application. On create, I would like to find a Label in the view using the ID specified in the UI Builder. How can I find a Label with a specified ID in an Elm_Grid?


4 Replies
Yasin Ali


Could you please share some of your code that you tried.


Brian Lee

Thank you for the reply. So to be more descriptive, in my test situation, in the UI Builder I have a view that contains a Grid. This Grid contains a single Label with the ID "TestLabel". I would like to find the Label in the Grid using the ID. Below is the code I am using to try to accomplish this:

void ChangeLabelView_onuib_view_create(uib_ChangeLabelView_view_context *vc, Evas_Object *obj, void *event_info) {
    // Cast the obj to a Grid.
    Elm_Grid* grid = (Elm_Grid*)obj;

    // Go thorugh the grid's children and find the child with the ID "TestLabel".
    Eina_List* gridChildren = elm_grid_children_get(grid);
    for (Eina_List* currentElement = gridChildren; currentElement; currentElement = eina_list_next(currentElement))
         // I don't know how to get the current Element's ID here, or if that is the correct way of doing things.
Yasin Ali

I think you may try with several options:

void *  eina_list_data_find (const Eina_List *list, const void *data)
  Finds a member of a list and return the member.
Eina_List *  eina_list_data_find_list (const Eina_List *list, const void *data)
  Finds a member of a list and return the list node containing that member.

int  eina_list_data_idx (const Eina_List *list, void *data)
  Finds the member of the list and return the index.

Before that you may see what data exists in list to make sure your is actually there
static void* eina_list_data_get  ( const Eina_List *  list )

See this link for better reference

Hope it will help.

Brian Lee

I'm a total noob to Tizen dev, but I have figured out the answer to this problem. The "vc" object passed to the function contains pointers to objects in the view. The objects are named using the ID specified in the UI Builder. To get a pointer to an object in the view with a known ID, use the appropriate object pointer in the vc instance.