View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0027771 | Lazarus | LCL | public | 2015-04-02 06:06 | 2016-03-24 14:20 |
Reporter | CudaText man | Assigned To | Ondrej Pokorny | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | win | OS | w7 x64 | ||
Product Version | 1.5 (SVN) | ||||
Target Version | 1.8 | Fixed in Version | 1.7 (SVN) | ||
Summary | 0027771: Position "screen center" don't give vert-center | ||||
Description | Img. Top indent 135; bottom 95. 1.4RC same. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 51111 | ||||
LazTarget | 1.8 | ||||
Widgetset | |||||
Attached Files |
|
related to | 0020952 | assigned | Ondrej Pokorny | Form ClientWidth |
related to | 0029371 | closed | Ondrej Pokorny | Error location in the form Form.Position: = poScreenCenter; |
related to | 0029887 | closed | Ondrej Pokorny | Form position "poMainFormCenter" don't work correctly |
|
|
|
Details. test shows: a) form Height is 603, while image has visible height about 640. b) form ClientHeight 603!! so issue exists: Height=ClientHeight while it's not ok for win32, do you agree? or is it done special? to not handle Win stuff, not calc wnd border? |
|
customform.inc.patch (1,617 bytes)
Index: customform.inc =================================================================== --- lcl/include/customform.inc (revision 51106) +++ lcl/include/customform.inc (working copy) @@ -1279,9 +1279,9 @@ end; var - X, Y: integer; + X, Y, BorderW, BorderH: integer; p: TPosition; - AForm: TCustomForm; + AForm: TCustomForm; rcWindow, rcClient:TRect; begin if (Parent <> nil) or (ParentWindow <> 0) then exit; @@ -1291,6 +1291,12 @@ X := Left; Y := Top; + {$IFDEF Windows} + rcClient:=GetClientRect; GetWindowRect(Handle, rcWindow); + BorderW := (rcWindow.Right - rcWindow.Left) - rcClient.Right; + BorderH := (rcWindow.Bottom - rcWindow.Top) - rcClient.Bottom; + {$ENDIF} + p := Position; if (Position = poMainFormCenter) and (Application.Mainform=nil) then p := poScreenCenter; @@ -1297,13 +1303,13 @@ case P of poDesktopCenter: begin - X := Screen.DesktopLeft + (Screen.DesktopWidth - Width) div 2; - Y := Screen.DesktopTop +(Screen.DesktopHeight - Height) div 2; + X := Screen.DesktopLeft + (Screen.DesktopWidth - (Width{$IFDEF Windows}+BorderW{$ENDIF})) div 2; + Y := Screen.DesktopTop +(Screen.DesktopHeight - (Height{$IFDEF Windows}+BorderH{$ENDIF})) div 2; end; poScreenCenter: begin - X := (Screen.Width - Width) div 2; - Y := (Screen.Height - Height) div 2; + X := (Screen.Width - (Width{$IFDEF Windows}+BorderW{$ENDIF})) div 2; + Y := (Screen.Height - (Height{$IFDEF Windows}+BorderH{$ENDIF})) div 2; end; poMainFormCenter, poOwnerFormCenter: |
|
My patch seems resolved the problem. |
|
Good that patch is only here (calc position).Not inside calc of Height/Width. So noone should break. |
|
A cross-platform solution (no ifdef's)would be nice(er). |
|
Yes, I know... This is temporary workaround only for Windows, but it is better than nothing ;) |
|
Fixed with a cross-platform solution. Info: it works on Windows. It doesn't work on Linux/X11, but this is another problem (related to WM, see http://stackoverflow.com/questions/7408082/how-to-get-the-width-of-a-window-frame-before-creating-any-windows ). The real form bounds can be obtained from X11 only after the form has been shown. |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-04-02 06:06 | CudaText man | New Issue | |
2015-04-02 06:06 | CudaText man | File Added: indent-incorr.png | |
2015-04-03 15:39 | CudaText man | Note Added: 0082567 | |
2015-04-03 16:16 | Bart Broersma | Relationship added | related to 0020952 |
2016-01-01 20:20 | Janusz Tomczak | File Added: customform.inc.patch | |
2016-01-01 20:26 | Janusz Tomczak | Note Added: 0088507 | |
2016-01-01 20:50 | CudaText man | Note Added: 0088508 | |
2016-01-01 20:50 | CudaText man | Note Edited: 0088508 | View Revisions |
2016-01-01 23:28 | Bart Broersma | Note Added: 0088513 | |
2016-01-02 01:47 | Janusz Tomczak | Note Added: 0088517 | |
2016-01-02 09:17 | Ondrej Pokorny | Assigned To | => Ondrej Pokorny |
2016-01-02 09:17 | Ondrej Pokorny | Status | new => assigned |
2016-01-02 10:15 | Ondrej Pokorny | Fixed in Revision | => 51111 |
2016-01-02 10:15 | Ondrej Pokorny | LazTarget | => 1.8 |
2016-01-02 10:15 | Ondrej Pokorny | Note Added: 0088518 | |
2016-01-02 10:15 | Ondrej Pokorny | Status | assigned => resolved |
2016-01-02 10:15 | Ondrej Pokorny | Fixed in Version | => 1.7 (SVN) |
2016-01-02 10:15 | Ondrej Pokorny | Resolution | open => fixed |
2016-01-02 10:15 | Ondrej Pokorny | Target Version | => 1.8 |
2016-01-11 13:45 | Ondrej Pokorny | Relationship added | related to 0029371 |
2016-03-24 14:20 | Ondrej Pokorny | Relationship added | related to 0029887 |