C++ Builder 10.2 how to support Windows 10 App Mode - c++builder

I'm using C++ Builder 10.2 to create some small apps that will be ran on Windows 10.
I would like to support the Windows 10 Theme "app mode" Light and Dark. (You can see this by RMB on desktop > Personalize..., Settings dialog > Themes > Color, 'Choose your default app mode')
I don't think I'm referring to the VCL styles? I can't seem to make these work automagically when the user toggles their windows theme from Light to Dark or vice versus.
I've tried setting the background color of the main TForm to color 'clWindow' but this doesn't seem to respect the theme app mode when I toggle it from Light to Dark and vice versus.
What do I need to to do to support the Windows 10 app mode?

Related

How to set dark mode for NSToolbar in macOS Catalyst app?

In my iOS/macOS app the user can choose between a light and a dark appearance.
This is done by setting the overrideUserInterfaceStyle of the app window, for example
window.overrideUserInterfaceStyle = .dark
It works fine on iOS/iPadOS.
On macOS (Catalyst) the app uses an NSToolbar, which always appears in the mode chosen in the system settings, regardless what ist set for the overrideUserInterfaceStyle of the window (see screenshot).
Since this is not a good visual impression, I would like to know how I can set light/dark mode for the NSToolbar too.
Add UIUserInterfaceStyle with a value Dark to your app’s Info.plist. That will force the whole app to dark mode on iOS 13+ and Mac Catalyst (you won’t need to set overrideUserInterfaceStyle).
Docs: https://developer.apple.com/documentation/bundleresources/information_property_list/uiuserinterfacestyle
This can be done by adding an macOS plugin which has access to the whole AppKit API. Instructions can be found here:
How to Access the AppKit API from Mac Catalyst Apps
Then you can set the desired appearance there at runtime, for example:
NSApplication.shared.appearance = NSAppearance(named: .darkAqua)

32-bit transparent PNG problem in a legacy Delphi project

I try to modernize a legacy Delphi VCL project using Delphi 10.3.3. I can compile and build the application without any problem. The only problem is backgrounds of transparent PNG are displayed as black in runtime.
Here is what I do:
Add MainMenu1 to the form and create menu items.
Add ImageList1.
Change ImageList1's ColorDepth to cd32Bit.
Add transparent PNG files into ImageList1.
Connect ImageList1 to MainManu1.
Here is the result in runtime:
These steps work perfect in a new Delphi 10.3.3 VCL project but there are black backgrounds in this legacy project.
What can I do to solve the black background issue?
Transparent images require Runtime Themes being activated in the Manifest section of the Project options.

How can I have Win98 style buttons?

I am using Delphi 10.3 Community Edition and I'm on Windows 7.
By default the buttons generated by Delphi are (of course) Win7 style.
How can I have "old-style" Win98 buttons (see attached picture).
Thanks.
Uncheck the enable runtime themes option.

NSScrollView in a popup became transparent under MacOS Mojave

In a view displayed as a Popover, I implement a help subview (a NSView with a NSScrollView as a subview) that appears when user click on a button. With Sierra & High Sierra, everything was all right, but since I upgraded the dev MacPro to Mojave, the help bubble became slightly transparent. Elements (NSTextField or NSButton) being the help view are still visible as a white strip in Dark Mode (or as a gray strip in Light Mode)
I have defined the help view and its scroll view to have their own layer and these two layers are set as opaque
[help setWantsLayer:YES];
help.layer.opaque = TRUE;
help.backgroundColor = [NSColor colorWithRed:1. green:1. blue:140./255. alpha:1.];
[help.scrollView setWantsLayer:YES];
help.scrollView.layer.opaque = TRUE;
[help.scrollView setBackgroundColor:[NSColor colorWithRed:1. green:1. blue:140./255. alpha:1.]];
All background colours are set to this yellow tone.
This problem occurs only if the view that display the help view was presented as a NSPopover, not as a NSView from an ordinary window. Any idea?
add NSRequiresAquaSystemAppearance = YES in your info.plist
To run any app in Dark Mode, you must to be running macOS Mojave 10.14 or greater. By default, all existing apps will run in Light Mode even if the system is configured to run in Dark Mode. An app that is launched on macOS Mojave will run in Dark Mode when two criteria are met:
The system considers the app to be compatible with Dark Mode
The running application’s appearance is set to Dark Aqua
An app’s compatibility with Dark Mode is determined by a combination of the SDK it was built against, and the value of the “NSRequiresAquaSystemAppearance” Info.plist key. If your app is built against the 10.14 SDK or later, it will be considered compatible unless the key is set to YES. If your app is built against the 10.13 SDK or earlier, it is considered incompatible unless the Info.plist key is set to NO.

Migrated C++ Builder project lose Imagelist transparency

I Upgraded from C++ Builder XE7 to C++ Builder Berlin and I have a project with about 100 images in 6 ImageList controls.
In XE7 the transparency worked fine, but after the upgrade all images now have a black solid background instead of transparency.
I double checked that the ImageList's ColorDepth still was cd32bit, and it is. Everything looks file in the IDE, images are transparent, but as soon I run my application, all images have a black background instead of transparency.
I tried to drop a new TImageList, cd32bit depth and added some transparent PNG:s that worked fine in XE7. Still they show up with a black background in Runtime, but not in the IDE.
Finally figured it out!
I noted that all controls had the old Win XP style so I suspected that the wrong version of Comctl32.dll was loaded, the question was only how to change it?
The project is very old and was created before C++ Builder supported manifests. But in the project options, under Application you will find a section named "Manifest File".
Set it to "Auto Generate" and tick the checkbox "Enable Runtime Themes" and it will use the correct version of Comctl32.dll

Resources