How to apply DEFAULT style for all the project - delphi

I work with VCL and FMX on this application, we are updating pack by pack of the software to FMX.
Something I did on the code, changed the STYLE of the application.
On the design view, it is the DEFAULT style, without any style edition.
However, when the application is compiled the STYLE for all FMX forms are changed, and the screen become a mess, the buttons disappears, etc...
I don't know what has been done to achieve it, but I could not find a manner to set all project to DEFAULT LAYOUT.
I tried to use
TStyleManager.SetStyleFromFile('light.style')
using the samples from delphi folder.
However, noon of the .STYLE are the DEFAULT.
Is there any DEFAULT.STYLE?
Or any manner to set DEFAULT.STYLE on RUNTIME?

Related

Delphi 11.2 Speedbuttons don't show border at design time

Running windows 10 21H2. Just upgraded to Delphi 11.2 (from 11.1).
Speedbuttons (with Flat=False) do not show the button rectangle at design time. It does appear at runtime.
Most/all of our VCL projects have an empty style name. I have noticed that if I set the Stylename for the button (or even the form), then it shows normally. But is this the best way of handling it? Is there a global setting somewhere that can restore "normal" behaviour?
In 11.2 the Form Designer Options have a new option Mimic the system style, which is active by default. Disabling that should solve your problem.
Form Designer Options

TBitBtn displays only using legacy Windows theme

I created the manifest file for my Delphi 6 application so it can display controls according to the theme defined by Windows (controls 6.0). Everything looks fine, except TBitBtn component, which is displayed using the legacy theme:
The behavior is the same on Windows XP and Windows 7, regardless of the current theme, even when no image is assigned to the TBitBtn component.
Now, when I put a regular TButton component on a form, it displays OK. If I then programmatically set an image to this button in runtime (using SendMessage(Handle, BM_SETIMAGE, IMAGE_ICON, LPARAM(Icon))), it immediately reverts its style to the legacy one.
Is there a way to either make TBitBtn use a proper style, or to display glyph on a regular TButton without reverting to the legacy one in Delphi 6?
In Delphi 6 it is not enough just to add the comctl32 v6 manifest. You also need to modify the VCL to be theme aware. The TBitBtn control is a VCL implemented control that, in its Delphi 6 incarnation, does not know anything about XP themes.
The standard way to deal with this is to add some third party software that performs the magic. That's the XP theme manager from Mike Lischke.
Here's a screenshot from a Delphi 6 application that includes the theme manager:

TComboBoxEx with VCL-Styles: Borders flicker

I`m using Delphi XE3. When using the custom styles (e.g. Carbon) that are available since Delphi XE2, there is a visible white flickering when moving the mouse over the borders of the TComboBoxEx control (MouseExit/Enter).
Steps to reproduce: Create a new VCL Forms app, drop a TComboBoxEx on the form, select e.g. Carbon in project options --> Application\Appearance and start the application
Is this a known problem/bug and is any solution known?
Thank you
This Border flicker issue is not the product of using Delphi VCL Styles.
(The same problem can be observed without using VCL styles)
The culprit here is the Desktop Window Manager which is an essential part of Windows Visual Styles and Themes.
The reason why you are seeing this issue and others may not, is because you have at some point changed the default Windows Theme (aero theme) or you've changed a specific Visual effect property of your selected theme.
You perhaps also have intentionally or unintentionally disabled the Desktop Window Manager since it runs as a Windows service.
To be more exact, the issue is resolved if you enable the Desktop composition feature.
This feature is only available in Aero themes(default) but not in Basic or Classic, tho sometimes it can appear to be available even when it is not.
Control Panel --> System --> Advanced System Settings --> Advanced --> Performance Settings --> Visual Effects
When desktop composition is enabled, individual windows no longer draw
directly to the screen or primary display device as they did in
previous versions of Windows. Instead, their drawing is redirected to
off-screen surfaces in video memory, which are then rendered into a
desktop image and presented on the display.
As you might have guessed, the functionality of this function is to basically act as a Buffer which in a very neat way explains the border flickering when this option is turned off.
Important Fact
Desktop composition feature can only be enabled if your current theme is an Aero theme and using Windows Visual Styles.(It is by default enabled for every Aero Theme)
Visual Styles are enabled by default in Aero Themes, you can check that it is enabled by making sure that the Use Visual Styles on Windows feature is enabled in the Performance Settings. When the Classic or Basic Themes are in effect the desktop composition feature is never in play and cannot be enabled. (Classic theme has been deprecated since Windows 8)
Sometimes in Windows 7, the Desktop composition feature can show itself in the Performance Options even when using a Basic or Classic Theme but do not be fooled, this is an internal bug.
Steps to reproduce this bug :
Start With default Windows Aero Theme
Go into Performance Settings as described above
Uncheck the Desktop composition from the list
Mouse over the border of TComboBoxEx, it should now be flickering as
you enter/leave.
But what happens if I uncheck Use Visual Styles on Windows checkbox? Why does this solve the flickering issue?
This will cause the Desktop Window Manager(DWM) to disable themes all together for all Windows Controls. What this means is that controls will be drawn using an older rendering style as oppose to using the newer Aero rendering style.
You can turn off Visual Styles for individual controls without turning it off globally with the following method SetWindowTheme(Handle, nil, nil)
This is also why the flickering issue for TComboBoxEx border is resolved when Visual Styles are disabled.
It's also worth mentioning that since Windows 8 you cannot disable Visual Styles anymore because as I said the Classic theme is deprecated.
Regarding the solution, I don't think you've got much of a choice really. Given how much freedom is left to the user when it comes to modifying the visual effects of Windows themes, this sort of thing is bound to happen. At least you can be certain that this issue does not happen on the default Windows Theme.

Delphi XE2 modern looking MainMenu

I am trying to modernize the look of our older Delphi 7 application now that we are using Delphi XE-2. I experimented with the TRibbon, and although I like it, it probably is not the correct solution since we currently use a TMainMenu and make many runtime changes to it - our users can modify the main menu. But the default Mainmenu looks old, especially compared to the image shown.
What I am trying to do is something very close to the attached image, especially with the background color, but I don't quite understand how this was done. Can anyone tell me if this example (the File/View/Insert section) uses a TMainMenu, or is it Buttons on a Toolbar ? If we require a customizable main menu, do you think the example shown is an option ?
This example image comes from DevExpress Print Sample library.
Edit : I am new here so I can't include the image. Here is the link :
http://www.devexpress.com/Products/VCL/ExPrintingSystem/gallery.xml
The second image, the green one that says "Print Preview".
You could use the TActionMainMenuBar but the simpler solution for you is to Use Vcl styles, pick a theme, modify the graphical properties of a MainMenu component and then use StyleHooks to force the style just for the MainMenu component without using it for the whole application.

TButtons and "runtime themes": peculiar behavior

Have you seen this?
I have a little utility application (for easy load / test xml generation from CDS and/or DBGo), and I had put some buttons (the poorest button of all, TButton) to trigger some actions.
I never paid attention to appearance, because I'm the only one that uses it. So today I added a new button, and they appeared different from the others in designer - but not when running. It's just an copy and paste process (change the button name, caption and event - the rest is equal to the origin).
When I looked the other buttons have an grey gradient and round corners, the button I copied and pasted not (just a bare rectangle). When running all buttons where just bare rectangles.
So I discovered that on designer, W7 and delphi are applying themes. On running, they are obeying the Project/Options/Application/Enable runtime themes flag.
This is annoying. There's a way to make Delphi doing that obeying the project options flag on forms designer?
(Or even manually if is not possible to automate that)?
EDIT:
The toolbars on the form are from CNWizards ;-)
EDIT II:
Apart of disabling themes for the IDE executable, all buttons get themed equally if the form (or project) is reloaded. But it's really weird.
If you want to enable/disable themes in the IDE, then open the properties of bds.exe, select the 'Compatibility' tab, and make sure that the 'Disable visual themes' checkbox is unchecked/checked.
Programs that you run from the IDE will inherit the compatibility settings of the IDE.
Delphi IDE itself is an application and the way the designer draw the form is using the setting for the IDE application (delphi32.exe or bds.exe's compatibility settings) so the answer is no. The default behaviour is different between IDE versions, for eg. the opposite behaviour (not drawing themed) happened in past.

Resources