Migrated C++ Builder project lose Imagelist transparency - 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

Related

Can we increase the font size of the delphi IDE, like tab, menu, etc. (not only the editor)

in the last version of delphi, can we increase the font size of the delphi IDE itself, like tab, menu, etc. (not only the editor) ?
It depends on the Delphi version. At least in Delphi 10.3.3 you can tweak the font size as described in the documentation: System Registry Keys for IDE Visual Settings

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.

C++ Builder 10.2 how to support Windows 10 App Mode

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?

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.

Reliable iOS image flipping for RTL languages

I'm trying to get image flipping to work reliably, but i'm seeing some issues. I manage my images in an Xcode asset catalog, and the ones that need to be flipped in RTL languages have been configured with the 'Direction' property set to 'Left to right, Mirrors'.
In some cases I have 2 separate assets, since flipping was not enough. Those are configured with the 'Direction' property set to 'Both' and two separate image assets are provided.
All images are PDF assets with 'Preserve vector data' enabled.
This all worked great as long as I test with iOS 11 and Xcode 9.2.
The problems start when I test on iOS 9. Images that are configured for RTL don't show up when I launch the app, even when I'm not running in a RTL language.
Since Xcode 9.3, I seem to have a new problem. The asset catalogs get updated automatically; the RTL images are reconfigured to direction 'Both' and changes are made to the json files in the catalog. Selecting 'Left to right, Mirrors' does not work anymore.
Is there anyone who has figured out how to get this to work reliably? Or am I just looking at the latest bugs in Xcode and some old issues with iOS9?
[edit]
After further analysis of the IPA file that is generated, it seems that the Assets.car file does not contain .png files for the RTL images. It seems that they are not generated (since the source files are PDF), so that would explain the missing images in iOS 9 (which does not use PDF images).
I fixed it, but it took someone at the Apple Developer Forum to point out that the asset catalog 'direction' property was not introduced until Xcode 8 / iOS 10.
This means it just doesn't work in iOS 9, and it is probably an Xcode bug that you can even select it when the deployment target is set below iOS 10.
So, don't try to use this feature when you want to be compatible with older iOS devices! You can still get it to work programatically.
If you have an image in for example a UIBarButtonItem, you can make an outlet to this button and run the following in the viewDidLoad:
self.someButton.image = [self.someButton.image imageFlippedForRightToLeftLayoutDirection];
This works because imageFlippedForRightToLeftLayoutDirection is supported by iOS 9. It only flips the image when your app is in RTL mode.
If you need to load a completely different image, you can do that as follows:
if ([UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) {
self.someButton.image = [UIImage imageNamed:#"someRTLImage"];
}

Resources