Label Color (MaxGUI)

BlitzMax Forums/BlitzMax Beginners Area/Label Color (MaxGUI)

wedoe(Posted 2006) [#1]
Can anyone tell me why this doesn't work ?

Local w:TGadget=CreateWindow("Test",100,100,200,200,Null,WINDOW_TITLEBAR)
Local la:TGadget=CreateLabel("HELLO",50,50,100,20,w,LABEL_FRAME|LABEL_CENTER)
Local b1:TGadget=CreateButton("RED",50,100,40,40,w)
Local b2:TGadget=CreateButton("BLUE",100,100,40,40,w)


While True
	WaitEvent 
	Select EventID()
		Case EVENT_GADGETACTION
		Select EventSource()
		 Case b1
			SetGadgetColor la,255,0,0
		 Case b2
			SetGadgetColor la,0,0,255			
		End Select
		Case EVENT_WINDOWCLOSE
			End
	End Select
Wend



WendellM(Posted 2006) [#2]
Sadly, labels, buttons, and many other gadgets aren't able to have their foreground/background colors set. While I was initially expecting this capability since it was included since early versions of VisualBasic, later digging around in the MS/Win APIs showed why its a pain. So, I do understand, but...

I'd still really (REALLY) like to see more color/font flexibility (like VB has - c'mon guys, if the Evil Empire can do it...) for BlitzMax gadgets, but for now, it seems(?) constrained to the system defaults.


wedoe(Posted 2006) [#3]
Any workarounds then ?

I feel a little betrayed by BRL here, a GUI really
should be able to do those things. Like if you buy
a car you expect the doors to open even if you did
not explicit ask for that feature from the salesman.
Goes without saying the doors work, like it goes
without saying the GUI does what most other GUI's
does as well. It's like trying out cripple-ware..


WendellM(Posted 2006) [#4]
There may(?) be some way to call API/Win32 or somesuch functions to handle this (this sort of approach is used to hack similar things for Windows' windows, which I don't do). I don't know of any for gadget colors - sorry. I dug through MS's online references looking for various things, and while my discovery of such things would have make my trek through the belly of the Beast seem dull and pedestrian, I must report nothing.

There's a way to change the default system colors, but that'd affect ALL gadget colors. Plus, that seems very inelegant. I'd love if there were some way that BlitzGUI's color handling of gadgets could approach VisualBasic's, but I dunno if that's possible since MaxGUI seems pretty standard-based while VB can(?) go far afield....


I feel a little betrayed by BRL here

Since I come from a Visual Basic background, I'm tempted to agree: VB has lots more control over gadgets (as in tons more control) than MaxGUI. However, VB is a giant, bloated mess, and I expect that its "control handling" might(?) come from replacing "real" controls will made-up, fully-adjustible ones (this from comparing the expensive capabilities of API Windows controls with those contained within Visual Basic).


Skidracer? You or Mark are probably best-qualified to address these issues (I've put in what I know, but that's only a patch on what you know).


wedoe(Posted 2006) [#5]
Is there a list anywhere that says what can be colored at all ?
The only thing I have managed to color so far is Panel and text in a TextArea !


skidracer(Posted 2006) [#6]
A borderless readonly textarea may be a good solution for win32 labels, they are very limited at the moment.

A workaround may be to change the class property of the maxgui window.


wedoe(Posted 2006) [#7]
The best soulution turned out to be a small canvas
with rectangles with text on :o)


Mark Tiffany(Posted 2006) [#8]
A borderless readonly textarea may be a good solution for win32 labels, they are very limited at the moment.

Given the horribleness of win32 textarea's, I'd go with a canvas-based solution myself...