Page 1 of 1

Progress bar with different colours

Posted: Sun Aug 31, 2008 8:08 pm
by dannyboy99
I have a progress bar and having been try to program so that at 100%

0 - 50 is colour green
50 - 70 is colour yellow
70 - 100 is colour red

Is there an easy method, or will it involve the use of draw.


Thanks

Posted: Sun Aug 31, 2008 8:11 pm
by rsts
Not sure if there's a way to change to color on the fly - maybe one of the experts will weigh in.

Without a 'draw' routine you could possibly 'concatenate' three progress bars to appear as one, but you would have to handle the math yourself.

probably more elegant solutions to come.

cheers

Posted: Sun Aug 31, 2008 8:57 pm
by Derek

Code: Select all

OpenWindow(0,0,0,200,100,"",$ca0001)
CreateGadgetList(WindowID(0))
ProgressBarGadget(1,10,40,180,20,0,100)
SetGadgetColor(1,#PB_Gadget_FrontColor,RGB(0,$ff,0))
For n=0 To 100
If n>49
SetGadgetColor(1,#PB_Gadget_FrontColor,RGB($ff,$ff,0))
EndIf
If n>69
SetGadgetColor(1,#PB_Gadget_FrontColor,RGB($ff,0,0))
EndIf
SetGadgetState(1,n)
Delay(50)
WindowEvent()
Next
MessageRequester("","")
But it wont work if you use xp skins enabled.

Or did you mean that you want a bar that is actually all three colours at once? (Which after re-reading your post is what I think you want)