Page 1 of 1
Changing the colour of a progress bar gadget to blue
Posted: Mon Oct 10, 2022 8:07 am
by marcoagpinto
Hello!
I have tried changing the colour, and it doesn't work:
Code: Select all
; Progress bar
t=number_of_words
x=GadgetX(#PANEL_BOX_CRUNCH_WORDS)+GadgetWidth(#PANEL_BOX_CRUNCH_WORDS)-5-default_gadget_width_progress
y=GadgetY(#PANEL_BOX_CRUNCH_WORDS)+GadgetHeight(#PANEL_BOX_CRUNCH_WORDS)+5+2
ProgressBarGadget(#PROGRESSBAR_WINDOW_CRUNCH_WORDS,x,y,default_gadget_width_progress,default_gadget_height_small_progress,0,t,#PB_ProgressBar_Smooth)
SetGadgetColor(#PROGRESSBAR_WINDOW_CRUNCH_WORDS,#PB_Gadget_FrontColor,#Blue) ; Blue progress bar
What is wrong with my code?
I am on Windows 10 and the gadget height is 8 pixels.
Thanks!
Re: Changing the colour of a progress bar gadget to blue
Posted: Mon Oct 10, 2022 8:29 am
by mk-soft
The modern window theme not support front and back color.
But you can disable the modern window theme for any gadgets.
Code: Select all
If OpenWindow(0, 0, 0, 320, 160, "ProgressBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget (3, 10, 10, 250, 20, "ProgressBar Standard (50/100)", #PB_Text_Center)
ProgressBarGadget(0, 10, 30, 250, 30, 0, 100)
SetGadgetState (0, 50) ; wir setzen die erste ProgressBar (ID = 0) auf 50 von 100
TextGadget (4, 10, 70, 250, 20, "ProgressBar Smooth (50/200)", #PB_Text_Center)
ProgressBarGadget(1, 10, 90, 250, 30, 0, 200, #PB_ProgressBar_Smooth)
SetGadgetState (1, 50) ; wir setzen die zweite ProgressBar (ID = 1) auf 50 von 200
TextGadget (5, 100,135, 200, 20, "ProgressBar Vertical (100/300)", #PB_Text_Right)
ProgressBarGadget(2, 270, 10, 30, 120, 0, 300, #PB_ProgressBar_Vertical)
SetGadgetState (2, 100) ; wir setzen die dritte ProgressBar (ID = 2) auf 100 von 300
SetWindowTheme_(GadgetID(0), #Empty$, #Empty$)
SetGadgetColor(0, #PB_Gadget_FrontColor, #Blue)
SetWindowTheme_(GadgetID(1), #Empty$, #Empty$)
SetGadgetColor(1, #PB_Gadget_FrontColor, #Blue)
SetWindowTheme_(GadgetID(2), #Empty$, #Empty$)
SetGadgetColor(2, #PB_Gadget_FrontColor, #Blue)
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
Re: Changing the colour of a progress bar gadget to blue
Posted: Mon Oct 10, 2022 9:18 am
by marcoagpinto
Thank you, I will open a feature suggestion in the forum.
Re: Changing the colour of a progress bar gadget to blue
Posted: Thu Nov 02, 2023 11:40 am
by dibor
THANKS A LOT!!!
Needs to put this info to the PB help!
Re: Changing the colour of a progress bar gadget to blue
Posted: Thu Nov 02, 2023 12:03 pm
by BarryG
marcoagpinto wrote: Mon Oct 10, 2022 9:18 amThank you, I will open a feature suggestion in the forum.
It's a Windows limitation, so Fred can't make it happen.
dibor wrote: Thu Nov 02, 2023 11:40 amNeeds to put this info to the PB help!
It's in the Help, but needs updated phrasing:
"On Windows XP with enabled skins, this coloring has no effect."
It should say this instead:
"With Modern Theme support enabled for your app, this coloring has no effect."
Report done for the manual's documentation.
Re: Changing the colour of a progress bar gadget to blue
Posted: Thu Nov 02, 2023 2:14 pm
by dibor
Sorry, in the help we can see limitation under Windoz and do not solution.
This is important thing:
"The modern window theme not support front and back color.
But you can disable the modern window theme for any gadgets."
SetWindowTheme_(GadgetID(XXX), #Empty$, #Empty$)
Where XXX - a number of ProgressBarGadget.
Best Wishes.