Why are you creating gadgets in your mainloop anyway?
If you want to hide a gadget depending on a variable, then use HideGadget gadget and ShowGadget gadget.
The correct order is:
1: initialisation & create
2: mainloop
3: cleanup & exit
If you want to hide a gadget depending on a variable, then use HideGadget gadget and ShowGadget gadget.
The correct order is:
1: initialisation & create
2: mainloop
3: cleanup & exit