Lock Screen with Click Event

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lock Screen with Click Event

Jump to solution
1,127 Views
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 Kudos
Reply
1 Solution
1,086 Views
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

View solution in original post

2 Replies
1,087 Views
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

1,092 Views
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.