DarkMode
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: DarkMode
Hi Jeff,
This (?):
Have you tried playing with:
So:
IXV_Inst.Settings['CustomUI.Theme'] := 'Dark Gray';
Inst.FireAppPrefsChanged(PXV_AppPrefsChange_CustomUI, nil);
-žarko
This (?):
Have you tried playing with:
So:
IXV_Inst.Settings['CustomUI.Theme'] := 'Dark Gray';
Inst.FireAppPrefsChanged(PXV_AppPrefsChange_CustomUI, nil);
-žarko
Re: DarkMode
Also, is there a place I can get a comprehensive list of all Settings, like CustomUI.Theme.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: DarkMode
Hi Jeff,
https://github.com/tracker-software/CABNodeExplorer/releases
-žarko
https://github.com/tracker-software/CABNodeExplorer/releases
-žarko
- Tracker Supp-Stefan
- Site Admin
- Posts: 17929
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: DarkMode
Another general Dark Mode issue has come up in my application.
As a bit of background, I am embedding your ActiveX Editor SDK into my Delphi Application or exe.
So here's the new issue.
When I open my Delphi Application, I click on a certain tab which displays your embedded Editor in my program. When the Editor initially displays I load a settings file and then what you see are the Editor Toolbars, etc. At this point I can open a file and work with the editor.
Then while the Editor is in this state, I choose an option in my Delphi application that changes the Theme of my entire program to Dark Mode. Whether or not I subsequently change your Dark Mode setting, the Editor looses all it's toolbars and seems to go into a sort of shell looking or blank state. Again, this is a result of the Delphi application changing Themes. Since your Editor is embedded in my application, the theme change seems to affect the Active X control in a negative way.
Does this make any sense? And if so, is there some call I can make within the Editor after such a theme switch that would put the Editor back in the state it was in (with the toolbars, etc.) before the switch. It's almost as if I need to reinitialize the editor in some way once this happens, but I don't know how to do that, especially if there was already a document loaded in the editor that needs to remain open.
Any help here would be greatly appreciated.
Again, to clarify, this happens independent of my changing or not the setting IXV_Inst.Settings['CustomUI.Theme'] from this origin thread request.
--Jeff
As a bit of background, I am embedding your ActiveX Editor SDK into my Delphi Application or exe.
So here's the new issue.
When I open my Delphi Application, I click on a certain tab which displays your embedded Editor in my program. When the Editor initially displays I load a settings file and then what you see are the Editor Toolbars, etc. At this point I can open a file and work with the editor.
Then while the Editor is in this state, I choose an option in my Delphi application that changes the Theme of my entire program to Dark Mode. Whether or not I subsequently change your Dark Mode setting, the Editor looses all it's toolbars and seems to go into a sort of shell looking or blank state. Again, this is a result of the Delphi application changing Themes. Since your Editor is embedded in my application, the theme change seems to affect the Active X control in a negative way.
Does this make any sense? And if so, is there some call I can make within the Editor after such a theme switch that would put the Editor back in the state it was in (with the toolbars, etc.) before the switch. It's almost as if I need to reinitialize the editor in some way once this happens, but I don't know how to do that, especially if there was already a document loaded in the editor that needs to remain open.
Any help here would be greatly appreciated.
Again, to clarify, this happens independent of my changing or not the setting IXV_Inst.Settings['CustomUI.Theme'] from this origin thread request.
--Jeff
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: DarkMode
Hi Jeff.
In C#, to change theme:
To just enable the inheritance of the system's 'Dark Mode for apps' you need to specify CustomUI.Theme="" and CustomUI.CanUseSysDarkMode=true. Do it once and then Editor will autoupdate its whole UI every time when user change that system's DarkMode option (in System/Colors/YourDefaultAppMode=Dark|Light).
We tested that code in our FullDemo and its works well, without loosing toolbars customization. Can you confirm that on your side with the latest version of our SDK?
Cheers.
In C#, to change theme:
Code: Select all
{
PDFXEdit.ICabNode pr = pdfCtl.Inst.Settings["CustomUI"];
pr["Theme"].v = "Black"; // "DarkGray", "White", "Black"
// "" - it inherits system's UI style
}
pdfCtl.Inst.FireAppPrefsChanged(PDFXEdit.PXV_AppPrefsChanges.PXV_AppPrefsChange_CustomUI);
We tested that code in our FullDemo and its works well, without loosing toolbars customization. Can you confirm that on your side with the latest version of our SDK?
Cheers.
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Re: DarkMode
I guess I wasn't clear in my last message. The issue has nothing to do with how Dark Mode or any theme is set in your Editor.
With your Editor being embedded as an Active X control inside my Delphi application, something happens to the Editor when I change themes inside my Delphi app. This is not related to the setting you showed me in my initial post to this thread.
It seems to be the way the ActiveX is affected by a change in theme from the application that you Editor is embedded in.
Any ideas here as to what this may be?
--Jeff
With your Editor being embedded as an Active X control inside my Delphi application, something happens to the Editor when I change themes inside my Delphi app. This is not related to the setting you showed me in my initial post to this thread.
It seems to be the way the ActiveX is affected by a change in theme from the application that you Editor is embedded in.
Any ideas here as to what this may be?
--Jeff
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: DarkMode
Hi Jeff,
How do you change the theme in your app. Let's see a few lines of code.
p.s.
What probably happens is that pxv_control's window hadle gets recreated when you do theme change.
p.s.2.
The same thing would happen for TWebBrowser.
-žarko
How do you change the theme in your app. Let's see a few lines of code.
p.s.
What probably happens is that pxv_control's window hadle gets recreated when you do theme change.
p.s.2.
The same thing would happen for TWebBrowser.
-žarko
Re: DarkMode
In the Delphi Vcl.Themes.pas unit, I call this
TStyleManager.TrySetStyle('Windows 10 Dark', False);
You'll need to make sure that Theme is turned on in your IDE.
Yes, it does feel like a Window handle recreation issue. When I make that call, the entire application seems to disappear and reappear.
Is there a way deal with the Window handle of your embedded ActiveX control when this happens?
--Jeff
TStyleManager.TrySetStyle('Windows 10 Dark', False);
You'll need to make sure that Theme is turned on in your IDE.
Yes, it does feel like a Window handle recreation issue. When I make that call, the entire application seems to disappear and reappear.
Is there a way deal with the Window handle of your embedded ActiveX control when this happens?
--Jeff
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: DarkMode
Hi Jeff,
Yes, SetStyle calls RecreateWnd - and all handles are recreated - and that's causing pxv_control to "lose its state".
How important is to allow style change for user on-the-fly?
Let them choose a style (save it somewhere) and restart the app - then apply the style (before doing anything with pxv_control).
-žarko
Yes, SetStyle calls RecreateWnd - and all handles are recreated - and that's causing pxv_control to "lose its state".
That would be super tricky (if possible at all) and I would suggest not to go that way.Is there a way deal with the Window handle of your embedded ActiveX control when this happens?
How important is to allow style change for user on-the-fly?
Let them choose a style (save it somewhere) and restart the app - then apply the style (before doing anything with pxv_control).
-žarko
Re: DarkMode
I was doing it on a restart of the app before. Looks like I'll need to return to that way of doing it.
Thanks for your help here.
--Jeff
Thanks for your help here.
--Jeff
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: DarkMode
Zarko - thanks for your helpful help!
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: DarkMode
Hi Jeff,
You got me thinking here ... so I was not settled until either I'm sure there's "no solution" or "solution found"
What happens here is that RecreateWnd calls CreateWnd / DestroyWnd where standard VCL controls would re-apply their "state" (check what TWinControl or TCustomTreeView does) when the handle was destroyed/created.
Since we cannot save pxv_control's state and since you will not be styling the pxv_control via VCL styling - we do not really need the handle to be destroyed / created.
In other words the handle needs to be preserved in between DestroyWnd / CreateWnd - when we are really not destroying it - meaning we need to override the implementation of those two methods.
If pxv_control is on a form, you can do the task simply by using class intercepting/interposing:
and the implementation:
HTH
-žarko
You got me thinking here ... so I was not settled until either I'm sure there's "no solution" or "solution found"
What happens here is that RecreateWnd calls CreateWnd / DestroyWnd where standard VCL controls would re-apply their "state" (check what TWinControl or TCustomTreeView does) when the handle was destroyed/created.
Since we cannot save pxv_control's state and since you will not be styling the pxv_control via VCL styling - we do not really need the handle to be destroyed / created.
In other words the handle needs to be preserved in between DestroyWnd / CreateWnd - when we are really not destroying it - meaning we need to override the implementation of those two methods.
If pxv_control is on a form, you can do the task simply by using class intercepting/interposing:
Code: Select all
//form's unit where TPXV_Control is used
type
TPXV_Control = class(PDFXEdit_TLB.TPXV_Control)
strict private
TheHandle : THandle;
protected
procedure DestroyWnd; override;
procedure CreateWnd; override;
end;
Code: Select all
procedure TPXV_Control.CreateWnd;
begin
if (TheHandle <> 0) AND IsWindow(TheHandle) then
begin
WindowHandle := TheHandle;
TheHandle := 0;
WinApi.Windows.SetParent(WindowHandle, Parent.Handle);
end
else
inherited CreateWnd;
end;
procedure TPXV_Control.DestroyWnd;
begin
if csRecreating in self.ControlState then
begin
WinApi.Windows.SetParent(WindowHandle, Application.Handle);
TheHandle := WindowHandle;
WindowHandle := 0;
end
else
inherited DestroyWnd;
end;
-žarko
Re: DarkMode
YES!
The seems to work. I'll do some more testing, but thanks so much for sticking with this one.
You guys are awesome. As always!
--Jeff
The seems to work. I'll do some more testing, but thanks so much for sticking with this one.
You guys are awesome. As always!
--Jeff
- TrackerSupp-Daniel
- Site Admin
- Posts: 8600
- Joined: Wed Jan 03, 2018 6:52 pm
DarkMode
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Tracker Software Products (Canada) LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com