clearing Gadget variable values?

BlitzMax Forums/BlitzMax Programming/clearing Gadget variable values?

Andres(Posted 2008) [#1]
A question: Do i really need to clear all gadget variable values when i close a child window, so the variables wouldn't interfere with other child windows and gadgets?
Child windows have many different gadgets and clearing their variables is a pain in the *ss.


Dreamora(Posted 2008) [#2]
what kind of variables?
the stuff within a gadget? No not needed.
Child gadgets? -> freegadget will free them as well (given you used a valid container as parent -> panel or window)


Andres(Posted 2008) [#3]
Let me explain:

Select EventSource()
    Case ButtonInWindow1
    Case ButtonInWindow2
End Select


ButtonInWindow1 is in the main window and ButtonInWindow2 in the child window. If i free the child window, variable ButtonInWindow2 will still have it's value?

Maybe in BMax it doesn't matter coz it's all types now instead of integers like in Plus. In Plus when i close the window the gadget variables still have their integer values and when i recreate some gadgets it might use same value for a gadget as for the one whose window i freed.

In Plus i had to (atleast i did like that):
Select ActiveWindow()
    Case Window2
        FreeGadget Window2
        ButtonInWindow2 = false <- and i falsed all gadgets like that. In Max i don't have to do that anymore?
    Default
        FreeGadget MainWindow
        End
End Select