Object Theme Library (for Dark or Light Theme)
Re: Object Theme Library (for Dark or Light Theme)
Nah, it's definitely not trash. Don't know why I have problems, but there will be a solution.
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: Object Theme Library (for Dark or Light Theme)
Seems the line 1031: SendMessage_(lParam, #EM_SETSEL, -1, 0)
causes a new WM_CTLCOLOREDIT on some machines. So you will get endless recursion.
Maybe something like this could help (at least it does here).
causes a new WM_CTLCOLOREDIT on some machines. So you will get endless recursion.
Maybe something like this could help (at least it does here).
Code: Select all
Protected low, high
SendMessage_(lParam, #EM_GETSEL, @low, @high)
If low Or high
SendMessage_(lParam, #EM_SETSEL, -1, 0) ; Deselect the ComboBox editable string if not the active Gadget
EndIf
Re: Object Theme Library (for Dark or Light Theme)
Thanks fryquez
I understand if that's the case, here it send a WM_COMMAND but not a new WM_CTLCOLOREDIT.
Can you confirm the trick jacdelad, dcr3

I understand if that's the case, here it send a WM_COMMAND but not a new WM_CTLCOLOREDIT.
Can you confirm the trick jacdelad, dcr3
Re: Object Theme Library (for Dark or Light Theme)
I can and will test it on monday.
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: Object Theme Library (for Dark or Light Theme)
I guess you don't need to be worried.
I tried you module in three different laptops.
Two of them the module works great, no issues.
One, the laptop that has given me issues, the windows hasn't been updated for long time.
that is Win10 64bit.
So I replaced the hard drive,on this laptop with a clean, Win10 install all issues has gone.

I tried you module in three different laptops.
Two of them the module works great, no issues.
One, the laptop that has given me issues, the windows hasn't been updated for long time.
that is Win10 64bit.
So I replaced the hard drive,on this laptop with a clean, Win10 install all issues has gone.
Re: Object Theme Library (for Dark or Light Theme)
An inevitable disappointment when you've spent a bit of time on it and realize that it won't be used at all if it crashes for some people, build Windows version probably here.
I tested with Fryquez's solution and by changing "If low <> high", I'm pretty confident it will do the job. Thanks again.
In this way, SendMessage_(lParam, #EM_SETSEL, -1, 0) will be called once for each editable ComboBox and it's enough

I've updated to version 1.4
And I've also added the attributes #PB_Gadget_GrayBackColor and GrayTextColor for the Editor, Spin and String. For their colors when they are disabled.
Re: Object Theme Library (for Dark or Light Theme)
@ChrisR See, no bug. You just had an undocumented feature that version checked Windows 10 to see if it was up to date! 

Best wishes to the PB community. Thank you for the memories. 
Re: Object Theme Library (for Dark or Light Theme)
I have updated to version 1.5
ObjectTheme is no longer split into 3 parts: ObjectTheme, CreateGadget and DataSection for easy handling.
Add #PB_Gadget_HighLightBorder attribute for button and ButtonImage Gadget and revised a bit their border drawing.
JellyButtons (included in IceDesign) which are ButtonGadget, can work together with ObjectTheme ButtonGadget. A JellyButtons remains a JellyButtons and is not processed by ObjectTheme.
I'll add ObjectTheme soon in IceDesign replacing ObjectColor, as it goes further and it performs better.
ObjectTheme is no longer split into 3 parts: ObjectTheme, CreateGadget and DataSection for easy handling.
Add #PB_Gadget_HighLightBorder attribute for button and ButtonImage Gadget and revised a bit their border drawing.
JellyButtons (included in IceDesign) which are ButtonGadget, can work together with ObjectTheme ButtonGadget. A JellyButtons remains a JellyButtons and is not processed by ObjectTheme.
I'll add ObjectTheme soon in IceDesign replacing ObjectColor, as it goes further and it performs better.
Re: Object Theme Library (for Dark or Light Theme)
Argh, I forgot to test: I just downloaded 1.5 and it no longer crashes for me. Thanks Chris!!!
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: Object Theme Library (for Dark or Light Theme)
I am usually working with dialogs, not windows (which is just a matter of creation and some auto functions like auto-arranging). However, ObjectTheme does not work with it. Since you use (mostly) "normal" controls: Is there a way to adapt it to work with dialogs too? I already thought about it, and given the handle of a window you should be able to retrieve all children of it.
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: Object Theme Library (for Dark or Light Theme)
Hi jacdelad,
Thank you for your interest, it's a bit difficult here these days...
ObjectTheme should also be compatible with the Dialog library.
When calling SetObjectTheme(), gadgets are retrieved with PB_Object_Enumerate.
For dynamic windows, SetObjectTheme() must be called after each new OpenXMLDialog().
See the note below for ComboBox, its drop-down list is not painted with Dialog.
Ex:
Thank you for your interest, it's a bit difficult here these days...
ObjectTheme should also be compatible with the Dialog library.
When calling SetObjectTheme(), gadgets are retrieved with PB_Object_Enumerate.
For dynamic windows, SetObjectTheme() must be called after each new OpenXMLDialog().
See the note below for ComboBox, its drop-down list is not painted with Dialog.
Ex:
Code: Select all
#Dialog = 0
#Xml1 = 1
#Xml2 = 2
; Note: For ObjectTheme ComboBox, #CBS_HASSTRINGS | #CBS_OWNERDRAWFIXED flags should be added to have the drop-down list painted.
; But I don't know how they could be added with XML dialog, they must be added at creation time but the Dialog library does not accept them.
; And it does not work if they are added later With SetWindowLongPtr_()
XIncludeFile "ObjectTheme.pbi"
UseModule ObjectTheme
XML1$ = "<window id='1' name='test1' text='test1' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
" <panel>" +
" <tab text='Premier Onglet'>" +
" <vbox expand='item:2'>" +
" <hbox>" +
" <button id='0' text='Bouton 1'/>" +
" <checkbox id='1' text='Case à cocher 1'/>" +
" <button id='2' text='Bouton 2'/>" +
" </hbox>" +
" <editor id='3' text='Contenu...' height='150'/>" +
" </vbox>" +
" </tab>" +
" <tab text='Second Onglet'>" +
" <vbox expand='No'>" +
" <combobox id='4' Height='28' flags='#PB_ComboBox_Editable'/>" +
" <string id='5' text='String' height='24'/>" +
" <progressbar id='6' height='25' min='1' max='100' value='66'/>" +
" <trackbar id='7' invisible='No' Flags='#PB_TrackBar_Ticks' height='25' min='1' max='100' value='66'/>"+
" <hbox>" +
" <option id='8' text='option 1' name='option1'/>"+
" <option id='9' text='option 2' name='option2'/>"+
" </hbox>" +
" </vbox>" +
" </tab>" +
" </panel>" +
"</window>"
XML2$ = "<window id='2' name='test2' text='Gridbox' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
" <gridbox columns='5' rowexpand='yes'>" +
" <button text='Bouton 1' />" +
" <button text='Bouton 2' />" +
" <button text='Bouton 3' colspan='3' />" +
" <button text='Bouton 4' rowspan='2' />" +
" <button text='Bouton 5' />" +
" <button text='Bouton 6' />" +
" <button text='Bouton 7' />" +
" <button text='Bouton 8' />" +
" <button text='Bouton 9' />" +
" <button text='Bouton 10' />" +
" </gridbox>" +
" </window>"
If ParseXML(#Xml1, XML1$) And XMLStatus(#Xml1) = #PB_XML_Success
If ParseXML(#Xml2, XML2$) And XMLStatus(#Xml2) = #PB_XML_Success
If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml1, "test1")
For i = 1 To 5
AddGadgetItem(4, -1,"Combo Element : " + Str(i))
Next
SetGadgetState(4, 0)
SetGadgetState(8, 1)
SetObjectTheme(#ObjectTheme_DarkBlue)
SetGadgetColor(6, #PB_Gadget_FrontColor, $005636) ; Or SetObjectColor(6, #PB_Gadget_FrontColor, $005636). To do after SetObjectTheme
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
If EventWindow() = 1
OpenXMLDialog(#Dialog, #Xml2, "test2")
CloseWindow(1)
SetObjectTheme(#ObjectTheme_DarkBlue) ; For dynamic Dialog, SetObjectTheme() must be added after each OpenXMLDialog()
Else
Break
EndIf
Case #PB_Event_Gadget
EndSelect
ForEver
Else
Debug "Dialog error: " + DialogError(#Dialog)
EndIf
Else
Debug "XML2 error: " + XMLError(#Xml2) + " (Line: " + XMLErrorLine(#Xml2) + ")"
EndIf
Else
Debug "XML1 error: " + XMLError(#Xml1) + " (Line: " + XMLErrorLine(#Xml1) + ")"
EndIf
Re: Object Theme Library (for Dark or Light Theme)
Ah yes, now it worked. Very nice! Unfortunately it doesn't paint the statusbar, has this been mentioned before?
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: Object Theme Library (for Dark or Light Theme)
Yes, I'm aware that nothing has been done for the Menu, ToolBar and StatusBar.
For ToolBar, it uses the window's background color but keeps the default black text color, which isn't great at all for a dark background.
If anyone tells me how to paint the Menu, ToolBar or StatusBar, I'll be happy to add them.
For ToolBar, it uses the window's background color but keeps the default black text color, which isn't great at all for a dark background.
If anyone tells me how to paint the Menu, ToolBar or StatusBar, I'll be happy to add them.
Re: Object Theme Library (for Dark or Light Theme)
I can't help you with that. For me, I use my Ribbon-Menu which can be colored to my liking.
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: Object Theme Library (for Dark or Light Theme)
Thank you so much for this ChrisR !