언어 설정

Menu
Sites
Language
Button Focus Setting

Hi,

 

I am Facing a Problem many times.

if Somebody can help that is most welcomed.

 

Problem:- Code Snipplet

1:- In a click Callback Function I am Hiding/Destroy current Evas Buttons and other evas objects and making visible other Evas Objects(buttons)

and Setting text on those buttons and setting focus on new buttons.

 

But Problem is all Evas Object destroy is OK but text is not set on newly created buttons and also focus is not  set on newly visible buttons.

EVAS_OBJECT_DESTROY(pThis->1but);  
   EVAS_OBJECT_DESTROY(pThis->2but);
   EVAS_OBJECT_DESTROY(pThis->Textobj);
   
   elm_object_signal_emit(pThis->t_pLayout, "ss", "code");  // some signals to edc working OK 

   elm_object_part_text_set(pThis->t_pLayout, "label1", "XYZ :"); :- OK
   
   
   
   elm_object_part_text_set(pThis->t_pLayout, "qqq", "dada");  :- ok
   elm_object_part_text_set(pThis->t_pLayout, "qqqq", "sasa");:-ok
     EVAS_OBJECT_SHOW(pThis->new Button);:- ok
    elm_object_text_set(pThis->Text_LocalSLabel,"lokesh_abc");  NG
   elm_object_focus_set(pThis->Text_LocalSLabel, EINA_TRUE);NG

 

 

but these works OK, if I click or any key event on newly created button than these becimes visible text as well as focus.

 

Responses

4 댓글
pius lee

how to you get the "pThis->Text_LocalSLabel"? is this label set on "pThis->new Button"?

I can't understand your source, please upload well formated code and and use "add code" feature in this forum editor. ( you can see icon on upward like <> )

Lokesh Aggarwal

Hi Lee Thanks For the reply.

I debug it and reached a conclusion and find root cause of problem.

but no solution

 

1: I am deleting all evas Objects in a clicked callback of a button (Including the button whose callback is came) and making new evas objects on layout.(new Button)

so Focus is not going on new Button because of some Sync issue that caller Evas Object has been destroyed.

 

Sample code is like that:-

class A{

// 4 evas object on parent layout

Evas_Object *bt1;
 Evas_Object *bt2;
 Evas_Object *bt3;

Evas_Object *label;

}

Implement File:-

 bt1= elm_button_add(t_pLayout);

 bt2= elm_button_add(t_pLayout);

 

 label = elm_label_add(t_pLayout);

 evas_object_event_callback_add(bt1, "clicked", myfunc, this);

evas_object_event_callback_add(bt2, "clicked", myfunc, this);

 

 

myfunc(void* pData, Evas_Object* pObj, void* pEventInfo)

{

  class A* pThis = (A*)pData;

  if(pObj == pThis->bt1)

{

evas_object_del(pThis->bt1);

evas_object_del(pThis->bt2);

bt3 = elm_button_add(t_pLayout);

evas_object_event_callback_add(bt3, "clicked", myfunc, this);

elm_object_text_set(pThis->bt3, "XYZ");

 elm_object_focus_set(pThis->bt3, EINA_TRUE); 

}

}
 

I am facing 2 issues

1:- when I hide evas objects it does not get hides because parent is same and parent is always visible so I destroy those objects

2:- newly created buttons can't get text and focus once.(reason is :- focus is on previously created buton (bt1) which is already destroyed so if I move keys, focus will reach to bt3 and program works Ok

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Alex Dem

Hi,
At first, I think that you use evas_object_smart_callback_add yet, but do not evas_object_event_callback_add (and it is misprint): otherwise it looks like an error.

Also, for any button for both  "clicked' or "pressed" signals inside clickedCB

evas_object_focus_get(obj);

returns 'false' (I checked in UI Controls example) . I can't reproduce your case exactly but I think this is not focus issue.

p.s For pressed(clicked) buttons packed into box widget evas_object_hide(obj) works ok, but looks like you place your buttons on layout (with edc markup).

Alexey.

Alex Dem

also fyi: if you add your widgets (entry for example) onto layout container with 
 

elm_object_part_content_set(layout, "entry_part", entry);

afaik you can not hide such widget with evas_object_hide() but only delete.
try to perform something like this :

evas_object_part_content_unset(layout, "entry_part");
evas_object_hide(entry);

p.s. but I have my example where I have buttons placed on layout with

ad->btn = elm_button_add(ad->layout);
//...
elm_object_part_content_set(ad->layout, "btn1", ad->btn);

and I able to hide it with  evas_object_hide(ad->btn);  inside OnBtnClick callback .
Alexey