Page 2 of 5
Re: ObjectColor
Posted: Sat Apr 16, 2022 12:15 pm
by ChrisR
BarryG wrote: Sat Apr 16, 2022 10:19 am
Can the first post please be kept updated with the most recent code? Because when I copy and paste it, the EditorGadget and StringGadget are still white instead of dark as in the screenshot, and I can't see where to fix it. Thanks!
It's normal, wanted here
If you want the parent's background color for String and Editor also, you need to comment the line SetObjectColorType("NoEdit") = All supported Gadget except String and Editor.
Otherwise, as it should be, I try to always update the code in the first post, in the Tips and Tricks section.
I just updated it, with the ComboBox in addition, thanks to Rashad.
Re: ObjectColor
Posted: Sat Apr 16, 2022 12:32 pm
by ChrisR
breeze4me wrote: Sat Apr 16, 2022 11:17 am
It seems that the dark mode of the combobox can be set as the code below on Windows 10+.
But the image combobox is only partially possible.
Unfortunately only Windows 10, otherwise it's fine with the DarkMode theme.
Except indeed for editable image Combobox.
I just noted that the cursor is lost when hovering the Editable Combobox 0
Re: ObjectColor
Posted: Sat Apr 16, 2022 12:56 pm
by breeze4me
ChrisR wrote: Sat Apr 16, 2022 12:32 pm
I just noted that the cursor is lost when hovering the Editable Combobox 0
It's because of the background color. The code has been updated to use a brighter color.
Re: ObjectColor
Posted: Sat Apr 16, 2022 2:21 pm
by RASHAD
Hi ChrisR
PureBasic Combobox Gadget is a special enhanced Gadget propriety of Fred & crew
It's not based directly on OS API
It is been discussed several times in the forum
Be happy with what you achieved for now
For the Header if you mean ListIcon header search the forum for Colored header by srod,NM,RASHAD
Good luck
Re: ObjectColor
Posted: Sat Apr 16, 2022 3:27 pm
by ChrisR
Just before going out, it's not bad for the comboBox with your WM_DRAWITEM.
Themed or not, I think I'll forget the combo images.
However, if SetDarkTheme() is called, it may be a good to use the DarkMode_CFD theme for combos and forget about Cbs_OwnerDrawFixed.
But I don't know how to see if the DarkTheme is applied, GetWindowTheme_(GadgetID(0)) returns 0
I will look for ListIcon header, we miss Mr srod

Re: ObjectColor
Posted: Sun Apr 17, 2022 5:43 pm
by ChrisR
To note that it works almost here because the enumeration in the demo is done in the right order, Container then childrens.
I should be able to improve it with my last code
GetParent() to browse the gadgets in the right hierarchical order.
For a bit later

Re: ObjectColor
Posted: Tue Apr 26, 2022 10:26 am
by ChrisR
I have revised the way of defining the background colors and text colors of the Gadgets.
These colors are transmitted now by reading the hierarchical list of Windows, Children and GrandChildren.
This hierarchical list is built once at the 1st call.
So the colors of a window or a container are automatically passed to its Children at initialization, when calling SetObjectColor.
And the Gadgets are drawn using these colors without the need to search for the parent's color. It works much better this way.
I also added the color for the ListIcon and ExplorerList Gadget column header.
Usage:
Code: Select all
SetObjectColor([#Window, #Gadget, BackColor, TextColor])
#Window | #PB_All = All Window (Default).
| The Window number to use.
|
#Gadget | #PB_All = All Supported Gadgets (Default).
| The Gadget number to use.
|
BackColor | #PB_Auto = Same as parent container's color (Default).
| The new backgound color. RGB() can be used to get a valid color value.
| #PB_Default = to go back to the default system backgound color.
|
TextColor | #PB_Auto = White or Black depending on whether the background color is dark or light (Default).
| The new text color. RGB() can be used to get a valid color value.
| #PB_Default: to go back to the default system text color.
For all gadgets with automatic background color and text color use: SetObjectColor()
Example here with the containers drawn in another color:
The code is updated on the 1st post.
Re: ObjectColor
Posted: Tue Apr 26, 2022 11:43 am
by ChrisR
I cut the code into ObjectColor.pbi and ObjectColorDemo.pb.
And i added another simple demo to show that it is easy to give another skin to your app to make it look more "Modern"

Re: ObjectColor
Posted: Tue Apr 26, 2022 1:14 pm
by Caronte3D
Thanks! ChrisR, very nice
Would be possible to change also the color of the borders?
By default it's too much brighter if we used a dark background

Re: ObjectColor
Posted: Tue Apr 26, 2022 1:43 pm
by ChrisR
Hi Caronte3D,
Yes, It would be nice change the border color too, I'm not sure if it can be done simply and for all gadgets.
It seems it can be done with WM_NCPAINT message, an example would be welcome.
Re: ObjectColor
Posted: Tue Apr 26, 2022 3:23 pm
by Caronte3D
ChrisR wrote: Tue Apr 26, 2022 1:43 pm
...an example would be welcome.
Unfortunately, I know almost nothing about WinApi and callbacks
Maybe some guru on the forum can help on that (RASHAD, the magician?)

Re: ObjectColor
Posted: Wed Apr 27, 2022 12:07 pm
by ChrisR
I fixed an error when applying the dark theme.
And made some small adjustments, for the panel inactive tabs, change the style of the ListView, spin and string (+Ws_Border -Ws_Ex_ClientEdge) to have a thinner border.
It's a little better for bright borders when using a dark background

Re: ObjectColor
Posted: Fri May 06, 2022 1:40 am
by ChrisR
I have updated by also managing the disabled Gadgets now.
Thanks to Rashad for his help
And in just a few minutes, I was able to add the full dark mode and the light theme to IceDesign, except for the design part

Re: ObjectColor
Posted: Fri May 06, 2022 1:54 am
by BarryG
Suggestion: Edit the topic title from "ObjectColor" to something like "ObjectColor / Dark Mode" because it's not obvious that this topic is about giving a dark mode to your apps. (I originally overlooked this topic because of this).
Re: ObjectColor (Dark Mode)
Posted: Fri May 06, 2022 2:08 am
by ChrisR
You are right, it is done
However I could not update the code, it is too big now:
Your message contains 68942 characters.
The maximum number of allowed characters is 60000.
I'll upload it on GitHub but tomorrow it's late.