Widget button expand and collapse


I’m struggling with problem about button expanding and collapsing.

This is what I want to achieve:

If i press for example 4 button I want it to expand another “submenu” and close previously selected.

I have 2 problems:
1)When I choose any button from “submenu” and spawn in on the map, I have to click button from “mainmenu(button clicked on image)” two times to open it again Screen capture - cca39975a8716cb0962da6e9cecb85c8 - Gyazo
2)It is overlaping one on another Screen capture - c4314d268ad476ff18c9425e5bfc6706 - Gyazo


Hi @pkkky

You are clicking two times because you used a flip flop i think.
And you probably are opening the submenus without closing the already opened.

you can use array to list your widget buttons or boxes.
lets say you have Sub_1 _sub_2 and Sub_3
When clicked a Submenu category you want to :
Hide all Sub- but X that must be shown,
and doing it, you just check if they are alredy hidden or visile, otherwise do nothing.

A custom event like:
Active Sub (2)
Loop all Sub and get index, if index is == to (2)
Yes? check if already visible, if not , set it visible
No? check if already hidden, if not, set it hidden