Your techniques for MaxGUI

BlitzMax Forums/BlitzMax GUI Programming/Your techniques for MaxGUI

Well euhm.. as you can see you are 3 times changing values, which in this case are the same, being 255,0,0

How about replacing those 9 lines with 1? :P
Function SetPalettecolor(r:int,g:int,b:int)
CCR=r
CCG=g
CCB=b

SetSliderValue(SLR,r)
SetSliderValue(SLG,g)
SetSliderValue(SLB,b)

SetGadgetText(txtR,String(r))
SetGadgetText(txtG,String(g))
SetGadgetText(txtB,String(b))

End Function


Untested, but I guess it works. Now, from every gadget handler you call this function for every rgb color you want.

Naturally, since you didn't paste the rest of your code, I can only assume that all the variables and objects are global or otherwise within reach of that function.

If you're asking for a more overall large-scale structure, we need to see more.