Please help support this free site and future BRL projects!

Home
Products
Community
Manuals
Contact
Login or Signup

BlitzMax Docs -> 3D - Category -> Tabbers -> CreateTabber

CreateTabber:TGadget(x,y,w,h,group:TGadget,style=0)

Returns:

Nothing.

Description:

Create a Tabber gadget.

A Tabber gadget shows a list of tabs above a client area typically used forhandling multiple documents.

Event IDDescription
EVENT_GADGETACTIONA new tab has been selected. Event data should contain the tab index.

See Also: AddGadgetItem, ClearGadgetItems, ModifyGadgetItem, SelectGadgetItem,RemoveGadgetItem and SelectedGadgetItem.

Example:

' createtabber.bmx

Import MaxGui.Drivers

Strict 

Local window:TGadget
Local tabber:TGadget
Local document:TGadget[3]
Local currentdocument: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)

tabber=CreateTabber(0,0,ClientWidth(window),ClientHeight(window),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

' 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_WINDOWCLOSE
			End
	End Select
Wend 

Comments

Eternal Crisis(Posted 1+ years ago)
This also has the menu event:

EVENT_GADGETMENU | A tab has been right-clicked. Event data contains the tab index.

In latest versions.


Hardcoal(Posted 2 months ago)
This is the most freaking stupid way Ive ever seen in a GUI!
why the hell do I need to be responsible on hiding and showing darn Tabs?
Let alone, why do I need to create Panels instead of directly adding to the newly created GadgetItem?

Jesus Christ Ive being wasting hours on this nonsense.
where do they come up with this stupidity sometimes I fail to know.

I feel like puking from this abomination

I had to break my head in order to create a process that will work and hide all
unselected Tabs.

There is no justification to this stupidity


BlitzMax Manual Forum

Blitz3D Equivalent Command