Changing the colour of a progress bar gadget to blue

Just starting out? Need help? Post your questions and find answers here.
User avatar
marcoagpinto
Addict
Addict
Posts: 1045
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Changing the colour of a progress bar gadget to blue

Post 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!
User avatar
mk-soft
Always Here
Always Here
Posts: 6209
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Changing the colour of a progress bar gadget to blue

Post 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
Last edited by mk-soft on Mon Oct 10, 2022 8:32 am, edited 1 time in total.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
marcoagpinto
Addict
Addict
Posts: 1045
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: Changing the colour of a progress bar gadget to blue

Post by marcoagpinto »

Thank you, I will open a feature suggestion in the forum.
dibor
Enthusiast
Enthusiast
Posts: 160
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: Changing the colour of a progress bar gadget to blue

Post by dibor »

THANKS A LOT!!!
Needs to put this info to the PB help!
Mac Studio M1Max, PB 6.12 Arm64 and x64.
Macbook Air M2, PB 6.12 Arm64 and x64.
Windows 10, PB 6.12 x64 and x86.
BarryG
Addict
Addict
Posts: 4135
Joined: Thu Apr 18, 2019 8:17 am

Re: Changing the colour of a progress bar gadget to blue

Post 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.
dibor
Enthusiast
Enthusiast
Posts: 160
Joined: Wed May 20, 2020 5:19 pm
Location: The 3rd planet in the Solar System
Contact:

Re: Changing the colour of a progress bar gadget to blue

Post 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.
Mac Studio M1Max, PB 6.12 Arm64 and x64.
Macbook Air M2, PB 6.12 Arm64 and x64.
Windows 10, PB 6.12 x64 and x86.
Post Reply