SetGadgetColor - Can't restore color of panels?

BlitzMax Forums/MaxGUI Module/SetGadgetColor - Can't restore color of panels?

Grisu(Posted 2011) [#1]
Hello everyone!

When I try to reset a panel to its original state, it gets black instead of showing the original system color. - Is this a glitch of some sort? (OS: Win7, 64-Bit)

Quick and dirty example code:
Import MaxGui.Drivers

Strict 

Local window:TGadget
Local panel:TGadget
Local red,green,blue
Local but:TGadget

window=CreateWindow("RequestColor",40,40,320,240,Null,WINDOW_TITLEBAR)
panel=CreatePanel(20,20,32,32,window,PANEL_ACTIVE|PANEL_SUNKEN)
but=CreateButton("Reset Color",140,10,120,30,window,BUTTON_OK)

While True
	WaitEvent 
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
		Case EVENT_MOUSEDOWN
			If RequestColor(red,green,blue)
				red=RequestedRed()
				green=RequestedGreen()
				blue=RequestedBlue()
				SetGadgetColor panel,red,green,blue			
			EndIf
           Case EVENT_GADGETACTION
				SetGadgetColor panel,-1,-1,-1
                       SetGadgetText but, "Done!" 			
	End Select
Wend


Thanks
Grisu


degac(Posted 2011) [#2]
You can use LookUoGuiColor() to find the default color, but you have no guarantee of result.
Unfortunately the Tgadget doesn't save the colors, and LookupGuiColor() is just a 'try' to find the color.


Grisu(Posted 2011) [#3]
Great, that's exactly what I was looking for:



Spoileralert! ;o)


skidracer(Posted 2011) [#4]
You could also try the new RemoveGadgetColor command (not well tested).


Grisu(Posted 2011) [#5]
@Skid: I use MAXGUI 1.42 beta and don't have such a command available?!