A very simple SetGadgetColorEx() function [Windows]

Share your advanced PureBasic knowledge/code with the community.
User avatar
Zapman
Enthusiast
Enthusiast
Posts: 205
Joined: Tue Jan 07, 2020 7:27 pm

Re: A very simple SetGadgetColorEx() function [Windows]

Post by Zapman »

The code in the first post has been updated.
The FrameGadget now reacts to its creation flags (#PB_Frame_Single, #PB_Frame_Double, #PB_Frame_Flat or #PB_Frame_Container). Drawing a big contener is far faster.
User avatar
Zapman
Enthusiast
Enthusiast
Posts: 205
Joined: Tue Jan 07, 2020 7:27 pm

Re: A very simple SetGadgetColorEx() function [Windows]

Post by Zapman »

The code in the first post has been updated again.
• The PanelGadget has now colorized arrows (when there is too much panels to see all of them). See the picture of the first post of this subject.
• A new 'ApplyColorsToAllGadgets(WindowNum, FrontColor, BackColor)' function allows you to colorize all the gadgets of a window with a simple line.
• The 'SetGadgetColorEx()' procedure is more rational and simple.
User avatar
Zapman
Enthusiast
Enthusiast
Posts: 205
Joined: Tue Jan 07, 2020 7:27 pm

Re: A very simple SetGadgetColorEx() function [Windows]

Post by Zapman »

A new big update of the code figuring in the first post:
  • All gadgets are now fully colorized by the library (including ExplorerComboGadget, DateGadget and CalendarGadget).
  • Hovered gadgets are highlighted.
  • The overall operation is even faster.
Runs on Windows 7 -> Windows 11, with x64 and x86.
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: A very simple SetGadgetColorEx() function [Windows]

Post by Caronte3D »

Thanks! It's very useful and easy to work with :wink:
dcr3
Enthusiast
Enthusiast
Posts: 181
Joined: Fri Aug 04, 2017 11:03 pm

Re: A very simple SetGadgetColorEx() function [Windows]

Post by dcr3 »

Realy nice, that you come back to it, not only added color to the others gadgets,but also improved it. :D
User avatar
Zapman
Enthusiast
Enthusiast
Posts: 205
Joined: Tue Jan 07, 2020 7:27 pm

Re: A very simple SetGadgetColorEx() function [Windows]

Post by Zapman »

dcr3 wrote: Sun Feb 23, 2025 9:15 pmRealy nice, that you come back to it, not only added color to the others gadgets,but also improved it. :D
And the library is still compact, even though she gained a little weight :D
Thank you dcr3.
I just discovered some small issues with the ExplorerComboGadget and the DateGadget and CalendarGadget for older versions of Windows. A future release will fix this soon.
User avatar
Zapman
Enthusiast
Enthusiast
Posts: 205
Joined: Tue Jan 07, 2020 7:27 pm

Re: A very simple SetGadgetColorEx() function [Windows]

Post by Zapman »

ExplorerCombo, Calendar and Date gadgets had problems with some versions of Windows. That is now fixed.
The code in the first message of this subject has been updated.
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: A very simple SetGadgetColorEx() function [Windows]

Post by Caronte3D »

File not found :D

Code: Select all

XIncludeFile "../Références API/GetCallbackMessagesNames.pb"
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: A very simple SetGadgetColorEx() function [Windows]

Post by Caronte3D »

TextGadget of Container2 not show at first:

Code: Select all

IncludeFile "SetGadgetColorEx.pbi"


If OpenWindow(0, 400, 400, 200, 200, "PureBasic Window", #PB_Window_SystemMenu)
  
  Define Container1=ContainerGadget(#PB_Any,10,10,180,180)   
  SetGadgetColor(Container1,#PB_Gadget_BackColor,#Red)
  TextGadget(#PB_Any,10,10,160,80,"Container 1") 
  Define button1=ButtonGadget(1,10,100,140,20,"Go to Container2")
  CloseGadgetList()
  HideGadget(Container1,1)
  
  Define Container2=ContainerGadget(#PB_Any,10,10,180,180)   
  SetGadgetColor(Container2,#PB_Gadget_BackColor,#Blue)
  TextGadget(#PB_Any,10,10,160,80,"Container 2")   
  Define button2=ButtonGadget(2,10,100,140,20,"Go to Container1")
  CloseGadgetList()
  
  
   Repeat
     Event = WaitWindowEvent()
     Select Event    
       Case #PB_Event_Gadget
         Select EventGadget()
           Case 1
             HideGadget(Container1,1)
             HideGadget(Container2,0)
           Case 2
             HideGadget(Container2,1)
             HideGadget(Container1,0)             
         EndSelect     
     EndSelect
   Until Event = #PB_Event_CloseWindow

EndIf
User avatar
Zapman
Enthusiast
Enthusiast
Posts: 205
Joined: Tue Jan 07, 2020 7:27 pm

Re: A very simple SetGadgetColorEx() function [Windows]

Post by Zapman »

Caronte3D wrote: Tue Feb 25, 2025 3:37 pm File not found :D

Code: Select all

XIncludeFile "../Références API/GetCallbackMessagesNames.pb"
Sorry for this thoughtlessness. This line should have been deleted. I just updated the file.
Caronte3D wrote: Tue Feb 25, 2025 6:05 pm TextGadget of Container2 not show at first:

Code: Select all

...
That's interresting! Thank's for that test idea. I'll work on it.
User avatar
Zapman
Enthusiast
Enthusiast
Posts: 205
Joined: Tue Jan 07, 2020 7:27 pm

Re: A very simple SetGadgetColorEx() function [Windows]

Post by Zapman »

Caronte3D wrote: Tue Feb 25, 2025 6:05 pm TextGadget of Container2 not show at first:
It's fixed and the code has been updated.
Thanks again for this test!
User avatar
Zapman
Enthusiast
Enthusiast
Posts: 205
Joined: Tue Jan 07, 2020 7:27 pm

Re: A very simple SetGadgetColorEx() function [Windows]

Post by Zapman »

Code has been updated.

Due to a bug, the memory was not entirely cleaned when closing the gadget's window.
This is fixed whith the actual version (available in the first post of this subject).

Since there haven't been any bug reports for a while and I don't see what could be improved, I think we can consider this version as final (before the next one :D).
Post Reply