Progress bar with different colours

Just starting out? Need help? Post your questions and find answers here.
dannyboy99
User
User
Posts: 27
Joined: Sun Jul 13, 2008 9:47 am
Location: UK

Progress bar with different colours

Post 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
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post 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
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post 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)
Post Reply