FixWindowXYPos |
FixWindowXYPos Procedure
This is where all the magic happens! You can call this method at any time and it will check your window position and move it to where it should be. The template calls this method only when the window opens, after it's position has been modified by the "Save and Restore Window Location" options in the ABC and Clarion (Legacy) templates.
This method works on Appframe, MDI and Non-MDI windows. Windows are NOT resized by the window fixer, only moved.
Appframe windows are placed on the monitor that they belong to or has the highest percentage of the window. Appframe windows are always placed in relation to the screen, i.e. in screen coordinates.
MDI windows are pulled into the appframe client area and the general rule is that the upper left corner is visible. If the window is larger than the appframe's client area then the window will be placed in position 0,0 in the upper left corner of the client area. If the window is too wide, the window will be placed at X position 0. If the window is too tall, then it will be placed at Y position 0. MDI windows are always placed in relation to their parent window (appframe) location, i.e. in client coordinates.
Non-MDI windows are pulled into the monitor visible rectangle. This takes into account the size and location of the taskbar on the primary monitor and also if the taskbar is set to auto-hide or not. On other monitors the full monitor rectangle is used. If a window is partially outside of a monitor, the ShowAllWindow and ShowMinPercent properties dictate how the window is handled. If the window is completely outside the virtual screen it will always be pulled in to be visible on the nearest monitor. If the window is inside the virtual screen area, but is visible on more than one monitor, the ShowAllWindows tells how to handle it. If it is true, then the window is placed on the monitor that has the highest percent of the window visible on it. If ShowAllWindow is false, then the window is left where it is. If the window is partially outside of the virtual screen then it will be pulled in unless ShowAllWindow is false. Then it is up to the ShowMinPercent value to determine how much of the window can be outside of the virtual screen. If it is 0, then none of the window can be outside and it will be pulled in - this setting works like when ShowAllWindow is set to True. If ShowMinPercent is set to 25% then that means that up to 25% of the total window area can be outside the virtual screen. If more than 25% is outside, the window will be pulled in so that it is completely visible. Non-MDI windows are always placed in relation to the screen, i.e. in screen coordinates.
This image shows 3 windows on two same sized monitors. Window 1 is partially outside the virtual screen in the bottom, right corner. It will be pulled up and to the left so that it is 100% visible. If ShowAllWindow is false and ShowMinPercent is set to 50%, then the window would be left where it is since there is more than 50% of the window visible on the virtual screen. Window 2 is visible on both monitors. If ShowAllWindow is set to True, then this window would be pulled into Monitor 2, since it has more than 50% of the window rectangle on it. Window 3 is completely outside both monitors and will always be pulled into Monitor 1 as it is the nearest one and placed at coordinates 0,0.