How I can apply a vcl style to a TPopupmenu? - delphi

I'm using the vcl styles in a Delphi XE2 application, but when i popup a TPopupmenu this is show using the native windows look and feel, exist any way to apply the vcl style colors to the TPopUpMenu?

Replace the TPopupmenu for a TPopupActionBar or use a interposer class to cast the TPopupMenu to TPopupActionBar.
TPopupMenu=class(Vcl.ActnPopup.TPopupActionBar);
Also you can read this Adding VCL Styles support to a TPopupMenu in 2 lines of code

Related

Adding Custom Control Into TListView In Firemonkey

Can I add custom control into TListView other than the official provided in Firemonkey Delphi, if can, how to do it?

How can I disable VCL Style for PopupMenu/Menu for Delphi 10.1 Berlin?

How can I disable VCL Style for PopupMenu/Menu for Delphi 10.1 Berlin?
Because it's not running properly with long menus. So, I want to use windows style for menu/popup menu items.
Is this possible?
To disable the styling of the menus under the VCL Styles you must remove the shMenus element of the TStyleManager.SystemHooks property.
TStyleManager.SystemHooks := TStyleManager.SystemHooks - [shMenus];

TPagecontrol equivalent for Firemonkey

while changing software development from VCL frame work to Firemonkey, I can not understand where is the TPagecontrol component gone from the good old VCL framework.
I already placed a TTabControl on my Form and added several Tabitemn, bit now I can not find the replacement for the TPagecontrol.
You can take Firemonkey's TTabControl as a replacement for VCL's TPageControl. Their tabs are containers just like everything else in Firemonkey (so unlike the VCL's TTabControl their tabs are real containers).

There is a TCustomStyleServices in Delphi 7?

In order to override TPanel's Paint procedure to make the background color clwhite in delphi 7, I am following #RRUZ Answer, but I can't find the TCustomStyleServices class.
There is an alternative to do what I want?
I'm using XPMan resource (IDK if changes anything).
Since Delphi7 does not support VCL-Styles, setting Parentbackground to false and Color to clWhite should fit your requirements.
You can see that the question, your link to, is tagged with VCL Styles tag.
How I can change the color of a TPanel with the VCL Styles enabled?
You can click on tthe tag below the question text and read it's description:
https://stackoverflow.com/tags/vcl-styles/info
The information says that VCL styles were introduced with Delphi XE2.
Since Delphi 7 was released somewhat before XE2 it can not contain that feature.

Delphi Xe2 with Firemonkey : Can you have a non-client area that is painted in a style other than the default Windows nonclient paint style?

Here is a sample of a delphi application I am making using firemonkey + Delphi XE2.
As you can see, you can use the visual style "stylebook" in Firemonkey to customize the appearance of most things inside the window frame. However the outside of the window frame is drawn using whatever style Windows decides. Now if I was using VCL instead of Firemonkey, I could apply "VCL Styles" and "skin" the whole VCL application in a dark color scheme.
My guess is that this is NOT YET posssible with Delphi XE2 + Firemonkey. Can anyone show how to do this?
At designtime, the "preview" of your form shows a nice black border. But when I run my app, the Windows XP "Luna" theme border (the blue parts in the picture below) looks atrocious. Ironically, the VCL is prettier (in XE2 with styles) than Firemonkey...
You can create a VCL Forms application as usual, with styles if you like, at runtime load your Firemonkey form and set your VCL form as its parent:
uses
FMX.Platform.Win, FMX.Forms,
Unit2;
procedure TForm1.FormCreate(Sender: TObject);
var
Form2: TForm2;
begin
Form2 := TForm2.Create(nil);
Form2.BorderStyle := FMX.Forms.TFmxFormBorderStyle.bsNone;
Form2.SetBounds(0, 0, ClientWidth, ClientHeight);
Winapi.Windows.SetParent(FmxHandleToHWND(Form2.Handle), Handle);
Form2.Show;
end;
In the following screenshot, Form1 is the VCL application main form (with Carbon style) and the dark-grey area with the button is the embedded Firemonkey form:
Note that I'm not handling resizing of the parent window - it should resize the emebedded form, too, emulating alClient alignment.
It seems there are many potential problems with this approach - I think there's a reason why the IDE doesn't let you easily mix Firemonkey forms with VCL forms - it warns about possible "compilation errors or unexpected behavior."
Firemonkey is cross platform. By and large you cannot do anything that is platform dependent within the FMX framework itself. You can however make calls to the underlying platform (be it windows, OSX or iOS) to access platform specific functionality. This should be done within conditionally compiled code.
eg.
{$IF DCC}
something;
{$ENDIF}
{$IF FPC}
somethingelse;
{$ENDIF}
Looking at it from another viewpoint, it may be possible for you do do all of your FMX work on a TRectangle (for example), then use AddObject (or assign its parent), to a VCL form.
If you change the forms BorderStyle to bsNone, you can add whatever chrome you want. You will, of course, need to manually handle maximise, minimise, close, resize etc actions.

Resources