WORKING Group Box?

BlitzPlus Forums/BlitzPlus Programming/WORKING Group Box?

Here's another method. SetGadgetLayout commands won't work on this, but gadgets can be parented to the groupbox, the groupbox clips its children, and the flicker is gone:
Const BM_SETSTYLE=244
Const BS_GROUPBOX=7

win=CreateWindow ("Win",10,10,400,400,main,15)
groupbox=CreateGroupBox("Woo a Groupbox",10,10,300,300,win)
button1=CreateButton("test",40,40,80,30,groupbox)
SetGadgetLayout button1,1,0,1,0
button2=CreateButton("test2",200,40,80,30,groupbox)
SetGadgetLayout button2,1,0,1,0
While WaitEvent(10)<>$803
Wend
End

Function CreateGroupBox(name$,x,y,w,h,parent) 
groupbox=CreateButton(name,x,y,w,h,parent)
SetGadgetLayout groupbox,1,1,1,1
SendMessage QueryObject(groupbox,1),BM_SETSTYLE,BS_GROUPBOX,1
backgroundpanel=CreatePanel(x+2,y+2,w-4,h-4,parent)
SetGadgetLayout backgroundpanel,1,1,1,1
Return backgroundpanel
End Function