Hmm, I was under the impression gadgets created last would be ontop but it seems with the new clipping it's the other way round (change order of CreateCanvas and CreateTabber to experiment):
' createtabber.bmx
Strict
Local window:TGadget
Local tabber:TGadget
Local document:TGadget[3]
Local currentdocument:TGadget
Local canvas:TGadget
' CreateDocument creates a hidden panel that fills entire tabber client area
Function CreateDocument:TGadget(tabber:TGadget)
Local panel:TGadget
panel=CreatePanel(0,0,ClientWidth(tabber),ClientHeight(tabber),tabber)
SetGadgetLayout panel,1,1,1,1
HideGadget panel
Return panel
End Function
' create a default window with a tabber gadget that fills entire client area
window=CreateWindow("My Window",30,20,400,300)
canvas=CreateCanvas(50,50,320,240,window)
tabber=CreateTabber(0,0,ClientWidth(window),ClientHeight(window)/2,window)
SetGadgetLayout tabber,1,1,1,1
' add three items and corresponding document panels to the tabber
AddGadgetItem tabber,"Document 0",False,-1,""
AddGadgetItem tabber,"Document 1",False,-1,"Tabber Tip 1"
AddGadgetItem tabber,"Document 2",False,-1,"tips 4 2"
document[0]=CreateDocument(tabber)
document[1]=CreateDocument(tabber)
document[2]=CreateDocument(tabber)
SetPanelColor document[0],255,200,200
SetPanelColor document[1],200,255,200
SetPanelColor document[2],200,200,255
' our documents start off hidden so make first one current and show
currentdocument=document[0]
ShowGadget currentdocument
CreateTimer 50
' standard message loop with special tabber GADGET_ACTION handling
While WaitEvent()
Select EventID()
Case EVENT_GADGETACTION
If EventSource()=tabber
HideGadget currentdocument
currentdocument=document[EventData()]
ShowGadget currentdocument
EndIf
Case EVENT_TIMERTICK
RedrawGadget canvas
Case EVENT_GADGETPAINT
SetGraphics CanvasGraphics(canvas)
SetOrigin 160,120
SetLineWidth 5
Cls
Local t=MilliSecs()
DrawLine 0,0,120*Cos(t),120*Sin(t)
DrawLine 0,0,80*Cos(t/60),80*Sin(t/60)
Flip
Case EVENT_WINDOWCLOSE
End
End Select
Wend