Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
DisableBlinkFeatures does not seem to work
DisableBlinkFeatures does not seem to work
Hi,
I noticed in my Delphi application that the Windows dark mode theme are applied to all the menu items of main menu and popup menu. This happens only when I have CEF running. I tried to fix this by setting GlobalCEFApp.DisableBlinkFeatures := 'AutoDarkMode', but this flag does not seem to work.
I am using the latest release version.
The dark mode is removed when I use SetThemeAppProperties(0), but of course all controls will look old which is not the desired outcome. Btw, this also happens to the demo projects.
Any idea how to disable the dark theme in CEF so it won't interfere the theme of other controls? Thank you in advance.
I noticed in my Delphi application that the Windows dark mode theme are applied to all the menu items of main menu and popup menu. This happens only when I have CEF running. I tried to fix this by setting GlobalCEFApp.DisableBlinkFeatures := 'AutoDarkMode', but this flag does not seem to work.
I am using the latest release version.
The dark mode is removed when I use SetThemeAppProperties(0), but of course all controls will look old which is not the desired outcome. Btw, this also happens to the demo projects.
Any idea how to disable the dark theme in CEF so it won't interfere the theme of other controls? Thank you in advance.
You do not have the required permissions to view the files attached to this post.
- salvadordf
- Posts: 4304
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: DisableBlinkFeatures does not seem to work
I haven't checked the dark mode settings lately but if that doesn't work I would remove all the context menu items and then send a message to the main application thread to show a custom popup menu. You can also use custom JavaScript dialogs.
Use the TChromium.OnBeforeContextMenu event and call model.clear to remove all menu items. Save the params.XCoord and params.YCoord values to show your custom popup menu.
Use the TChromium.OnBeforeContextMenu event and call model.clear to remove all menu items. Save the params.XCoord and params.YCoord values to show your custom popup menu.
Re: DisableBlinkFeatures does not seem to work
I will try this way for the context menus. Thank you so much.
But what do you suggest for the main menu which is filled during design time?
But what do you suggest for the main menu which is filled during design time?
Re: DisableBlinkFeatures does not seem to work
It did not work because my menu items are actually from Delphi controls. I am using the browser in some forms of my app, but somehow it affects the theme of all menu items when Windows dark mode is enabled.
- salvadordf
- Posts: 4304
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: DisableBlinkFeatures does not seem to work
This seems to be an issue for some Chrome users too.
We had a similar discussion here :
https://www.briskbard.com/forum/viewtopic.php?f=8&t=1927
A workaround is to use any Delphi style.
We had a similar discussion here :
https://www.briskbard.com/forum/viewtopic.php?f=8&t=1927
A workaround is to use any Delphi style.
Re: DisableBlinkFeatures does not seem to work
Indeed, it works when using any Delphi style which puzzled me. But this is already a good workaround. Thank you so much!
Re: DisableBlinkFeatures does not seem to work
Hi Salvador,
I found the version where this dark mode issue on Delphi menus first occurred, and that is CEF4Delphi 106.0.5249.119. I compared the version before it (105.0.5195.127), and I didn't see changes in the sources that may cause this issue or maybe I am just wrong. Do you think it is CEF related issue?
I found the version where this dark mode issue on Delphi menus first occurred, and that is CEF4Delphi 106.0.5249.119. I compared the version before it (105.0.5195.127), and I didn't see changes in the sources that may cause this issue or maybe I am just wrong. Do you think it is CEF related issue?
- salvadordf
- Posts: 4304
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: DisableBlinkFeatures does not seem to work
The CEF4Delphi's code changes between 105 and 106 were totally unrelated to this issue.
This was probably a change in Chromium's code.
This was probably a change in Chromium's code.
Re: DisableBlinkFeatures does not seem to work
Thank you for the confirmation.
- salvadordf
- Posts: 4304
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: DisableBlinkFeatures does not seem to work
Another user in the official CEF forum has requested a new feature to disable the dark mode :
https://magpcss.org/ceforum/viewtopic.php?f=6&t=19495
https://github.com/chromiumembedded/cef/issues/3534
Chromium is calling an undocumented Windows API function called "AllowDarkModeForApp" here :
https://source.chromium.org/chromium/chromium/src/+/main:content/app/content_main_runner_impl.cc;l=872?q=AllowDarkModeForApp&ss=chromium
In case someone wants to test those undocumented functions, the Double Commander project includes all the functions related to the dark mode here :
https://github.com/doublecmd/doublecmd/blob/master/src/platform/win/udarkstyle.pas
https://magpcss.org/ceforum/viewtopic.php?f=6&t=19495
https://github.com/chromiumembedded/cef/issues/3534
Chromium is calling an undocumented Windows API function called "AllowDarkModeForApp" here :
https://source.chromium.org/chromium/chromium/src/+/main:content/app/content_main_runner_impl.cc;l=872?q=AllowDarkModeForApp&ss=chromium
In case someone wants to test those undocumented functions, the Double Commander project includes all the functions related to the dark mode here :
https://github.com/doublecmd/doublecmd/blob/master/src/platform/win/udarkstyle.pas