Alexander Halser 26 Posted November 28, 2023 When pressing the Windows key plus the right or left arrow key simultaneously, the window is moved to fill the right or left half of the screen, respectively. This works for FMX forms as well, out of the box. At least with D11, not sure about older FMX versions. However, when you release the Win key, Windows usually offers (if enabled in global settings) a list of windows to fill the other half of the screen. And this is the issue I am wondering about: A VCL form is shown in this "also snap..." list. An FMX form is not shown. I assume that either a param in CreateParams is responsible for this behavior, or a Windows message needs to be handled to enable it (which is implemented in VCL but not in FMX for Windows). Does anyone know what causes the FMX window to be hidden and how to overcome it? Share this post Link to post
Alexander Halser 26 Posted November 28, 2023 Partial answer: in VCL the behavior is triggered by MainFormOnTaskbar := true; More detailed answer: it is the param WS_EX_APPWINDOW in the window GWL_EXSTYLE that makes the window appear (automatically set by MainFormOnTaskbar). In FMX, the main form can be made visible in the selection list by setting the form's (Windows) window handle manually: procedure TForm1.Button1Click(Sender: TObject); var WND: HWND; begin wnd := FmxHandleToHWND(self.handle); SetWindowLong(wnd, GWL_EXSTYLE, GetWindowLong(wnd, GWL_EXSTYLE) or WS_EX_APPWINDOW); //now the form is visible in the "Also snap..." list end; New question: Any known downside or side effects due to this modification? 1 Share this post Link to post
Sherlock 663 Posted November 28, 2023 5 minutes ago, Alexander Halser said: Any known downside or side effects due to this modification? You should do this only for Windows environments. So be shure to wrap that in appropriate $IFDEFs in case you develop multi platform (what FMX is designed for). Share this post Link to post
Alexander Halser 26 Posted November 28, 2023 1 minute ago, Sherlock said: You should do this only for Windows environments. So be shure to wrap that in appropriate $IFDEFs in case you develop multi platform (what FMX is designed for). Sure. Winapi.Windows.pas and SetWindowLong would be difficult to compile anyway for MacOS, iOS and Android 😉 Are there any other negative side effects known? Share this post Link to post
Sherlock 663 Posted November 28, 2023 3 hours ago, Alexander Halser said: Are there any other negative side effects known? Not that I am aware of. Share this post Link to post