Jump to content
Al T

Can you mix VCL and FMX?

Recommended Posts

Hi,

 

Can you mix VCL and FMX?

 

Cause I need to be able to use or replicate Vcl.Controls.TWinControl and be able to handle HWND (windows handles) in FMX.

 

 

Share this post


Link to post

Yes you can, but of course it will only compile under Windows. I have used several VCL features in my FMX application. I just place them inside {$IFDEF MSWINDOWS} so they don't compile under other platforms.

Share this post


Link to post

There was an old project MonkeyMixer, that was intended to do so, if that is what you need.

But it is not recommended, since you will carry VCL and FMC resources in your project and make it unnecessary heavy.

Share this post


Link to post
2 hours ago, Al T said:

Cause I need to be able to use or replicate Vcl.Controls.TWinControl and be able to handle HWND (windows handles) in FMX.

You can access the windows handle using WindowHandleToPlatform.

.

Share this post


Link to post
5 hours ago, Al T said:

be able to handle HWND (windows handles) in FMX.

FMX works very differently than VCL in this respect and you probably will not be able to do what you want to do. But you haven't said what you want to do so that is a guess.

 

Win32/VCL has every control (and then some) being its own window. That is not the FMX model. You're going to need to make a fundamental shift in your thinking when it comes to how your forms work.

Share this post


Link to post
3 hours ago, Lajos Juhász said:

You can access the windows handle using WindowHandleToPlatform.

That will only work for TForm handles (and alternatively, you can use FormToHWND() instead).  In FMX, only a TForm has an actual Win32 HWND assigned, its child control do not have their own HWNDs, like they do in VCL.  FMX child control are custom-drawn directly onto the TForm's window.

Share this post


Link to post
On 11/16/2022 at 11:51 AM, Remy Lebeau said:

That will only work for TForm handles (and alternatively, you can use FormToHWND() instead).  In FMX, only a TForm has an actual Win32 HWND assigned, its child control do not have their own HWNDs, like they do in VCL.  FMX child control are custom-drawn directly onto the TForm's window.

How does FMX TForm know who is the child or parent of a form?

Share this post


Link to post
On 11/19/2022 at 3:28 AM, Al T said:

How does FMX TForm know who is the child or parent of a form?

Via object hierarchies in memory, like any other.  FMX's TForm establishes object hierarchies via its Parent, ParentForm, and Children properties.  Just as VCL's TForm establishes object hierarchies via its Parent and Controls properties.

Edited by Remy Lebeau

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×