Object Theme Library (for Dark or Light Theme)

Share your advanced PureBasic knowledge/code with the community.
User avatar
jacdelad
Addict
Addict
Posts: 1385
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: Object Theme Library (for Dark or Light Theme)

Post by jacdelad »

Nah, it's definitely not trash. Don't know why I have problems, but there will be a solution.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
fryquez
Enthusiast
Enthusiast
Posts: 344
Joined: Mon Dec 21, 2015 8:12 pm

Re: Object Theme Library (for Dark or Light Theme)

Post by fryquez »

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).

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
User avatar
ChrisR
Addict
Addict
Posts: 1094
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Object Theme Library (for Dark or Light Theme)

Post by ChrisR »

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
User avatar
jacdelad
Addict
Addict
Posts: 1385
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: Object Theme Library (for Dark or Light Theme)

Post by jacdelad »

I can and will test it on monday.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
dcr3
Enthusiast
Enthusiast
Posts: 161
Joined: Fri Aug 04, 2017 11:03 pm

Re: Object Theme Library (for Dark or Light Theme)

Post by dcr3 »

I guess you don't need to be worried. :D

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.
User avatar
ChrisR
Addict
Addict
Posts: 1094
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Object Theme Library (for Dark or Light Theme)

Post by ChrisR »

dcr3 wrote: Fri Nov 24, 2023 8:59 pm I guess you don't need to be worried. :D
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 8)

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.
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: Object Theme Library (for Dark or Light Theme)

Post by Kuron »

@ChrisR See, no bug. You just had an undocumented feature that version checked Windows 10 to see if it was up to date! :mrgreen:
Best wishes to the PB community. Thank you for the memories. ♥️
User avatar
ChrisR
Addict
Addict
Posts: 1094
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Object Theme Library (for Dark or Light Theme)

Post by ChrisR »

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.
User avatar
jacdelad
Addict
Addict
Posts: 1385
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: Object Theme Library (for Dark or Light Theme)

Post by jacdelad »

Argh, I forgot to test: I just downloaded 1.5 and it no longer crashes for me. Thanks Chris!!!
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Post Reply