Al T 12 Posted November 16, 2022 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
David Heffernan 2345 Posted November 16, 2022 Could you explain the requirement in more detail? I think that might help us understand how to solve the problem. Share this post Link to post
XylemFlow 8 Posted November 16, 2022 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
Rollo62 536 Posted November 16, 2022 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
Lajos Juhász 293 Posted November 16, 2022 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
Brandon Staggs 278 Posted November 16, 2022 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
Remy Lebeau 1394 Posted November 16, 2022 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
Al T 12 Posted November 19, 2022 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
Remy Lebeau 1394 Posted November 22, 2022 (edited) 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 November 22, 2022 by Remy Lebeau Share this post Link to post