Change Label text/background color

BlitzMax Forums/BlitzMax GUI Programming/Change Label text/background color

I'm having problems changing the color of a label.
What the proper way to do it?

I tried
x:TGadget
SetGadgetColor(x, 255, 0, 0)
SetGadgetTextColor(x, 255, 0, 0)


Nothing happens


Thanks

This slightly tweaked createlabel.bmx example appears to work correctly...

Import MaxGui.Drivers

Strict 

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

Local label1:TGadget = CreateLabel("A plain label",10,10,280,52,window)
Local label2:TGadget = CreateLabel("A label with LABEL_FRAME",10,80,280,60,window,LABEL_FRAME)
Local label3:TGadget = CreateLabel("A label with LABEL_SUNKENFRAME",10,150,280,60,window,LABEL_SUNKENFRAME)
Local label4:TGadget = CreateLabel("not applicable",10,220,280,54,window,LABEL_SEPARATOR)

SetGadgetColor label1,255,128,64
SetGadgetTextColor label2,64,128,255

While WaitEvent()<>EVENT_WINDOWCLOSE
Wend


Hi SebHoll
It did not work.

Is createlabel.bmx another file that I need or is it the current code?

No, it is just the code I posted. Can you post a screenshot of what you see when the code I posted is compiled and run?

Which platform are you on?

I'm on Windows XP


That's strange.

OK, can you please post another screenshot of the following code compiled and running?

Import MaxGui.Win32MaxGUIEx

Strict 

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

Local label1:TGadget = CreateLabel("A plain label",10,10,280,52,window)
Local label2:TGadget = CreateLabel("A label with LABEL_FRAME",10,80,280,60,window,LABEL_FRAME)
Local label3:TGadget = CreateLabel(TWindowsLabel(label1)<>Null,10,150,280,60,window,LABEL_SUNKENFRAME)
Local label4:TGadget = CreateLabel("",10,220,280,54,window,LABEL_SEPARATOR)

SetGadgetColor label1,255,128,64
SetGadgetTextColor label2,64,128,255

While WaitEvent()<>EVENT_WINDOWCLOSE
Wend
Thanks!

For some reason I get the following Error

Compile Error: Duplicate identifier 'TIconStrip' in modules 'brl.maxgui' and 'maxgui.maxgui'


I was also getting this error when I added the following line

Import MaxGui.Drivers


So I ran the first code without it.
Could it have somethingto do with the latest update of MaxGui?

Yes, that would explain it.

After updating to the latest set of MaxGUI drivers, you will need to delete the old module folders from BlitzMax\mod\brl.mod for BRL.CocoaMaxGUI, BRL.FLTKMaxGUI, BRL.MaxGUI and BRL.Win32MaxGUI.

Thanks a lot SebHoll

I reinstalled Blitzmax just to make sure and it WORKS!

I can now label the world in COLOR!



Thanks