# Conditional Flag / State Modification

**URL:** <http://forum.squareline.io/t/conditional-flag-state-modification/1528>\
**Category:** Feature requests\
**Created:** [July 19, 2023, 2:02am UTC](http://forum.squareline.io/t/conditional-flag-state-modification/1528 "2023-07-19T02:02:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeoChris2023](http://forum.squareline.io/user_avatar/forum.squareline.io/leochris2023/32/734_2.png) [@LeoChris2023](http://forum.squareline.io/u/LeoChris2023)\
**Post date:** [July 19, 2023, 2:02am UTC](http://forum.squareline.io/t/conditional-flag-state-modification/1528/1 "2023-07-19T02:02:32Z")

</div>

### **What do you want to achieve?**

Modify flags or states of widgets based on previous state.

Take my recent project (a complex menu) for instance. Multiple buttons and corresponding operational panels are designed within a screen. In this situation, I must handle flags and states of buttons and panels very carefully.

- When button A is clicked, corresponding panel A will appear (remove hidden flag);
- Remove “`Clickable`” flag of Button A, add “`Clickable`” flag and remove “`Checked`” state to all other buttons since I don’t know whether it is the first time that a user click Button A or it is clicked after other button.
- Add “`Hidden`” flag to all other panels (again, you don’t know user operation sequence).

All steps have to be done in the `CLICK` event of each button.

I exported the code to testing platform and do a trial run, it turns out that the screen response is very slow. I have to optimize the “`State`” and “`Flag`” handling in the event function.

If the flag, state modification is conditional, event handling function will be more efficient without code modification.

### **Do you see alternative options and workaround to achieve it?**

Currently, you can only do conditional flag/state modification in the exported LVGL code.

### **Mention some use cases**

Complex menu GUI design.

---

<div class="post-metadata">

**Author:** ![LeoChris2023](http://forum.squareline.io/user_avatar/forum.squareline.io/leochris2023/32/734_2.png) [@LeoChris2023](http://forum.squareline.io/u/LeoChris2023)\
**Post date:** [July 27, 2023, 3:28am UTC](http://forum.squareline.io/t/conditional-flag-state-modification/1528/2 "2023-07-27T03:28:37Z")

</div>

Bump for more concern
