Lock Screen with Click Event

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Lock Screen with Click Event

跳至解决方案
3,206 次查看
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,165 次查看
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,166 次查看
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,169 次查看
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.