Page 1 of 1

Setting Themes

Posted: Tue Jan 14, 2025 10:09 am
by RMan
I've noticed that if the user sets a custom color for something (say the "base") in the UI in the Preferences dialog that when you set a new theme programmatically that it doesn't update the custom color which is different than how it works in the interface when you pick a new theme.

I'm working in VB6 in this case

Dim pr As PDFXEditCtl.ICabNode
Set pr = AxPXV_Control1.Inst.Settings("CustomUI")
pr("Theme").v = "DarkGray"
Call AxPXV_Control1.Inst.FireAppPrefsChanged(PXV_AppPrefsChange_CustomUI)

I found a workaround by clearing the Colors, Fonts, and Backgrounds prior to setting the theme but just wondering if I'm missing something or if there is a better way to set a theme?

AxPXV_Control1.Inst.Settings("CustomUI.Colors").Clear
AxPXV_Control1.Inst.Settings("CustomUI.Fonts").Clear
AxPXV_Control1.Inst.Settings("CustomUI.Backgrounds").Clear
Dim pr As PDFXEditCtl.ICabNode
Set pr = AxPXV_Control1.Inst.Settings("CustomUI")
pr("Theme").v = "DarkGray"
Call AxPXV_Control1.Inst.FireAppPrefsChanged(PXV_AppPrefsChange_CustomUI)

Also I don't see a CustomTheme property to check I do it by seeing if the Count is greater than 0 for any of them.
If AxPXV_Control1.Inst.Settings("CustomUI.Colors").Count > 0 then
bCustomUI = True
End if
If AxPXV_Control1.Inst.Settings("CustomUI.Fonts").Count > 0 then
bCustomUI = True
End if
If AxPXV_Control1.Inst.Settings("CustomUI.Backgrounds").Count > 0 then
bCustomUI = True
End if

Thanks

Re: Setting Themes

Posted: Thu Feb 20, 2025 1:08 am
by Vasyl - PDF-XChange
Hi RMan.

Your workaround will work well. Because the main idea is: that when you have specified something in Colors/Fonts/Backgrounds inside the CustomUI section of parameters then the Editor will interpret this as "Custom" theme, which is based on theme specified in "CustomUI.Theme" parameter (if it is empty - then Default theme will be as a base). When Colors/Fonts/Backgrounds aren't specified at all, then it will be just a genuine theme specified in "CustomUI.Theme" parameter, without any alterations.

HTH.