Find the parent of a gadget

BlitzMax Forums/BlitzMax GUI Programming/Find the parent of a gadget

If I have create a window and added a button to it, how do I find out what the parent is?

Or do I have to assign the window as a global?

The GadgetGroup() function returns the parent e.g.
If GadgetGroup(button) = window Then Notify "Parent is 'window'"