Lock Screen with Click Event

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Lock Screen with Click Event

ソリューションへジャンプ
3,257件の閲覧回数
frozen
Contributor III

Hi,

I use Gui Guider 1.6.0 on Ubuntu. I have a button. I want to have unclickable screen after clicking this button. I know that below code helps me for one object. But I have a lot of object on one screen and I have more than 10 different screens.

lv_obj_clear_flag(guider_ui.obj1, LV_OBJ_FLAG_CLICKABLE);

 Is there any short(cut/code) to do this with one line code ?
Such as

lv_obj_clear_flag(ALL OBJECTS ON THE PAGE, LV_OBJ_FLAG_CLICKABLE);

 I have tried this,
I added lock button to the page, I added container and added all other objects into this container. I added event clear flag for this container but it didn't work as I expected. I might click other objects.

0 件の賞賛
返信
1 解決策
3,216件の閲覧回数
WenbinYuan
NXP Employee
NXP Employee

Hello @frozen ,

As the comment from Alex, the GUI Guider has no one line way to reach your goal, but there's a workaround may help you:

  1. add a screen size simple widget like Label to cover all the objects you want to 'lock' by adjusting its position in widgets resource tree, clear all text of this widget and keep it transparent
  2. add event to your lock button (please enable toggle for this button) with Clicked Trigger and custom code:
    if (lv_obj_has_state(guider_ui.pageStatic_btn_1, LV_STATE_CHECKED)) {
    	        lv_obj_add_flag(guider_ui.pageStatic_label_1, LV_OBJ_FLAG_CLICKABLE);
    	    } else {
    	        lv_obj_clear_flag(guider_ui.pageStatic_label_1, LV_OBJ_FLAG_CLICKABLE);
    	    }​
  3. run simulator to check the 'lock' operation, all the objects under label should be unclickable after the button checked.

 

Best Regards,

Wenbin

元の投稿で解決策を見る

2 返答(返信)
3,217件の閲覧回数
WenbinYuan
NXP Employee
NXP Employee

Hello @frozen ,

As the comment from Alex, the GUI Guider has no one line way to reach your goal, but there's a workaround may help you:

  1. add a screen size simple widget like Label to cover all the objects you want to 'lock' by adjusting its position in widgets resource tree, clear all text of this widget and keep it transparent
  2. add event to your lock button (please enable toggle for this button) with Clicked Trigger and custom code:
    if (lv_obj_has_state(guider_ui.pageStatic_btn_1, LV_STATE_CHECKED)) {
    	        lv_obj_add_flag(guider_ui.pageStatic_label_1, LV_OBJ_FLAG_CLICKABLE);
    	    } else {
    	        lv_obj_clear_flag(guider_ui.pageStatic_label_1, LV_OBJ_FLAG_CLICKABLE);
    	    }​
  3. run simulator to check the 'lock' operation, all the objects under label should be unclickable after the button checked.

 

Best Regards,

Wenbin

3,220件の閲覧回数
Alex_Wang
NXP Employee
NXP Employee

Hello, @frozen 

       Hi, in the GUI Guider each widget is a separate object. If you only add the event clear flag to the container, it will not work for buttons inside the container. If you want all widgets in the container to be unclickable, you need to add an event clear flag to each widget. Please refer to the attached video.

      Currently, one-click setting is not supported to add a clear flag to all widgets. Hope this helps you.

Best regards, Alex.