Home
Products
Community
Manuals
Contact
Login or Signup

BlitzMax Docs -> 3D - Category -> Labels -> CreateLabel

CreateLabel:TGadget(name$,x,y,w,h,group:TGadget,style=LABEL_LEFT)

Returns:

Nothing.

Description:

Create a Label gadget.

A Label gadget is used to place static text or frames in a MaxGUI user interface. They do notgenerate any events.

Labels support these optional styles:

StyleMeaning
LABEL_FRAMEThe label has a simple border.
LABEL_SUNKENFRAMEThe label has a sunken border.
LABEL_SEPARATORThe label is an etched box with no text useful for drawing separators.
LABEL_LEFTThe label's text is left-aligned. This is the default.
LABEL_CENTERThe label's text is center-aligned.
LABEL_RIGHTThe label's text is right-aligned.

See Also: SetGadgetText, SetGadgetTextColor, SetGadgetFont and SetGadgetColor.

Example:

' createlabel.bmx

Import MaxGui.Drivers

Strict 

Local window:TGadget

window=CreateWindow("My Window",30,20,320,480)

CreateLabel("A plain label",10,10,280,52,window)
CreateLabel("A label with LABEL_FRAME",10,80,280,60,window,LABEL_FRAME)
CreateLabel("A label with LABEL_SUNKENFRAME",10,150,280,60,window,LABEL_SUNKENFRAME)
CreateLabel("not applicable",10,220,280,54,window,LABEL_SEPARATOR)

While WaitEvent()<>EVENT_WINDOWCLOSE
Wend 

Comments

degac(Posted 1+ years ago)
Optional style can be mixed with the operator | like here
' createlabel.bmx

Import MaxGui.Drivers
Strict 
Local window:TGadget
window=CreateWindow("My Window",30,20,320,480)
CreateLabel("A label with LABEL_SUNKENFRAME",10,150,280,60,window,LABEL_SUNKENFRAME|LABEL_CENTER)
'is a label with Sunkenframe AND centered
While WaitEvent()<>EVENT_WINDOWCLOSE
Wend 


By default Label doesn't emit any event.
But with SetGadgetSensitivity you can change this behaviour and make a gadget reacting to MOUSE or KEY events.

PS: not all the OS platform supports label events.

Import MaxGui.Drivers
Strict 
Local window:TGadget
Local label:tgadget

window=CreateWindow("My Window",30,20,320,480)
label=CreateLabel("Click me",10,150,280,60,window,LABEL_CENTER|LABEL_FRAME)

SetGadgetSensitivity label,SENSITIZE_MOUSE

While True
	WaitEvent 
	Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
	End Select
Wend



BlitzMax Manual Forum

Blitz3D Equivalent Command