View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005370 | JEDI VCL | 00 JVCL Components | public | 2010-10-18 23:30 | 2010-10-19 21:37 |
Reporter | jkelley | Assigned To | jfudickar | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.39 | ||||
Target Version | Fixed in Version | ||||
Summary | 0005370: RestoreFormPlacement may restore windows off screen | ||||
Description | If TJvFormPlacement.RestorePlacement or JvJVCLUtils' RestoreFormPlacement is used to restore a form's position and size, then the form may be positioned off screen, if the screen resolution or number of monitors has been reduced since the form's position was saved. (This can happen with a laptop with an external monitor and when using Remote Desktop.) The attached patch checks that the form's position and size fit on screen and doesn't restore them if they don't. | ||||
Tags | No tags attached. | ||||
2010-10-18 23:30
|
RestoreFormPosition-offscreen.patch (1,059 bytes)
Index: JvJVCLUtils.pas =================================================================== --- JvJVCLUtils.pas (revision 4533) +++ JvJVCLUtils.pas (working copy) @@ -4030,6 +4030,17 @@ end; end; + function IsOnAnyMonitor(ARect: TRect) : Boolean; + var + BottomRight : TPoint; + begin + BottomRight := ARect.BottomRight; + Dec(BottomRight.X); + Dec(BottomRight.Y); + Result := (Screen.MonitorFromPoint(ARect.TopLeft, mdNull) <> Nil) and + (Screen.MonitorFromPoint(BottomRight, mdNull) <> Nil); + end; + begin if Options = [fpActiveControl] then Exit; @@ -4090,7 +4101,7 @@ AppStorage.ConcatPaths([StorePath, siPixels]), Screen.PixelsPerInch)); if DataFound then begin - if Placement.rcNormalPosition.Right > Placement.rcNormalPosition.Left then + if (Placement.rcNormalPosition.Right > Placement.rcNormalPosition.Left) and IsOnAnyMonitor(Placement.rcNormalPosition) then begin if not (csDesigning in Form.ComponentState) then begin |
|
Thanks for this patch! Added to svn Revision 12869 |
Date Modified | Username | Field | Change |
---|---|---|---|
2010-10-18 23:30 | jkelley | New Issue | |
2010-10-18 23:30 | jkelley | File Added: RestoreFormPosition-offscreen.patch | |
2010-10-19 21:37 | jfudickar | Note Added: 0017927 | |
2010-10-19 21:37 | jfudickar | Status | new => resolved |
2010-10-19 21:37 | jfudickar | Resolution | open => fixed |
2010-10-19 21:37 | jfudickar | Assigned To | => jfudickar |