Every gadget in BlitzPlus must have a parent gadget (even if it's a new window that uses the Desktop as it parent). This is so that BlitzPlus knows where to draw it and how to treat it in relation to other gadgets when certain events occur.
For instance, when you create a bunch of radio buttons with certain attributes and a certain parent (wndMain), like this:
CreateButton("1", 0, 0, 100, 20, wndMain, 3)
CreateButton("2", 0, 25, 100, 20, wndMain, 3)
CreateButton("a", 0, 50, 100, 20, wndMain, 3)
CreateButton("b", 0, 75, 100, 20, wndMain, 3)
...you'll end up with a column of four radio buttons whose parent is the main window. But the interesting thing about radio buttons is that only one of them in a group is allowed to be selected at a time. So what if you want to put them into groups so that either 1 and 2 can be selected along with either a or b? That's one reason to use panels.
If you create two panels and use panel1 as the parent of the first two buttons (instead of wndMain), and use panel2 as the parent of the next two buttons, then you will have successfully grouped your gadgets. (wndMain will be the parent of panel1 and panel2.)
the other thing about using panels is that the location of a child gadget is now in reference to the panel's (parent's) upper-left corner instead of the main window. So you would have something like this:
panel1 = CreatePanel(0,0,100,50,wndMain)
panel2 = CreatePanel(0,50,100,50,wndMain)
CreateButton("1", 0, 0, 100, 20, panel1, 3)
CreateButton("2", 0, 25, 100, 20, panel1, 3)
CreateButton("a", 0, 0, 100, 20, panel2, 3)
CreateButton("b", 0, 25, 100, 20, panel2, 3)
Do you see the subtle differences? It would look exactly the same to the user, but it would function a little bit differently.
Also, if you want to perform a gadget operation (like HideGadget, ShowGadget, FreeGadget, DisableGadget, EnableGadget, etc) then you can perform it on the parent, and it will act on all of its children. So for example, if I wanted to hide the top two radio buttons but leave the bottom two radio buttons visible, I would just have to say:
HideGadget(panel1)
Does that help explain things better?
For instance, when you create a bunch of radio buttons with certain attributes and a certain parent (wndMain), like this:
CreateButton("1", 0, 0, 100, 20, wndMain, 3)
CreateButton("2", 0, 25, 100, 20, wndMain, 3)
CreateButton("a", 0, 50, 100, 20, wndMain, 3)
CreateButton("b", 0, 75, 100, 20, wndMain, 3)
...you'll end up with a column of four radio buttons whose parent is the main window. But the interesting thing about radio buttons is that only one of them in a group is allowed to be selected at a time. So what if you want to put them into groups so that either 1 and 2 can be selected along with either a or b? That's one reason to use panels.
If you create two panels and use panel1 as the parent of the first two buttons (instead of wndMain), and use panel2 as the parent of the next two buttons, then you will have successfully grouped your gadgets. (wndMain will be the parent of panel1 and panel2.)
the other thing about using panels is that the location of a child gadget is now in reference to the panel's (parent's) upper-left corner instead of the main window. So you would have something like this:
panel1 = CreatePanel(0,0,100,50,wndMain)
panel2 = CreatePanel(0,50,100,50,wndMain)
CreateButton("1", 0, 0, 100, 20, panel1, 3)
CreateButton("2", 0, 25, 100, 20, panel1, 3)
CreateButton("a", 0, 0, 100, 20, panel2, 3)
CreateButton("b", 0, 25, 100, 20, panel2, 3)
Do you see the subtle differences? It would look exactly the same to the user, but it would function a little bit differently.
Also, if you want to perform a gadget operation (like HideGadget, ShowGadget, FreeGadget, DisableGadget, EnableGadget, etc) then you can perform it on the parent, and it will act on all of its children. So for example, if I wanted to hide the top two radio buttons but leave the bottom two radio buttons visible, I would just have to say:
HideGadget(panel1)
Does that help explain things better?