View Issue Details

IDProjectCategoryView StatusLast Update
0027638LazarusIDEpublic2017-05-21 19:40
ReporterSerge AnvarovAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx32-x64OSWindowsOS VersionWindows 7
Product Version1.4RC2Product Build 
Target Version1.6.4Fixed in Version1.7 (SVN) 
Summary0027638: Top position of Form Designer depend of top position of Object Inspector
DescriptionWhen we change position and size of designer windows all saved when closed IDE, except Form. It's always same default size and it's top position some pixels (32?) below top position of Object Inspector.
 
IDE 64-bit and IDE 32-bit have same behavior.
Steps To ReproduceStart IDE. Move Object Inspector to top (and shrink main top window). Next time Form will be under Main top window.
TagsNo tags attached.
Fixed in Revisionr52829
LazTarget-
WidgetsetWin32/Win64
Attached Files
  • p1.jpg (151,906 bytes)
    p1.jpg (151,906 bytes)
  • p2.jpg (134,630 bytes)
    p2.jpg (134,630 bytes)
  • F1.jpg (95,236 bytes)
    F1.jpg (95,236 bytes)
  • F2.jpg (100,411 bytes)
    F2.jpg (100,411 bytes)
  • F3.jpg (111,537 bytes)
    F3.jpg (111,537 bytes)
  • F4.jpg (111,179 bytes)
    F4.jpg (111,179 bytes)
  • F5.jpg (89,056 bytes)
    F5.jpg (89,056 bytes)
  • sourcefilemanager.pas.patch (1,448 bytes)
    Index: ide/sourcefilemanager.pas
    ===================================================================
    --- ide/sourcefilemanager.pas	(revision 52824)
    +++ ide/sourcefilemanager.pas	(working copy)
    @@ -4433,7 +4433,7 @@
     var
       NewComponent: TComponent;
       new_x, new_y: integer;
    -  p: TPoint;
    +  MainIDEBarBottom: integer;
       r: TRect;
     begin
       if not AncestorType.InheritsFrom(TComponent) then
    @@ -4455,11 +4455,9 @@
     
       // Figure out where we want to put the new form
       // if there is more place left of the OI put it left, otherwise right
    -  p:=Point(0,0);
       if ObjectInspector1<>nil then begin
    -    p:=ObjectInspector1.ClientOrigin;
    -    new_x:=p.x;
    -    new_y:=p.Y+10;
    +    new_x:=ObjectInspector1.Left+10;
    +    new_y:=ObjectInspector1.Top+10;
       end else begin
         new_x:=200;
         new_y:=100;
    @@ -4467,7 +4465,13 @@
       if new_x>Screen.Width div 2 then
         new_x:=new_x-500
       else if ObjectInspector1<>nil then
    -    new_x:=new_x+ObjectInspector1.Width;
    +    new_x:=new_x+ObjectInspector1.Width+GetSystemMetrics(SM_CXFRAME) shl 1;
    +  if Assigned(MainIDEBar) then
    +  begin
    +    MainIDEBarBottom:=MainIDEBar.Top+MainIDEBar.Height+GetSystemMetrics(SM_CYFRAME) shl 1+GetSystemMetrics(SM_CYCAPTION);
    +    if MainIDEBarBottom<Screen.Height div 2 then
    +      new_y:=Max(new_y,MainIDEBarBottom+10);
    +  end;
       r:=Screen.PrimaryMonitor.WorkareaRect;
       new_x:=Max(r.Left,Min(new_x,r.Right-400));
       new_y:=Max(r.Top,Min(new_y,r.Bottom-400));
    

Activities

Juha Manninen

2016-03-12 13:38

developer   ~0090930

This makes no sense. Please test again with a clean Lazarus 1.6 installation.
You probably had a corrupt configuration.

Juha Manninen

2016-04-08 14:33

developer   ~0091852

No feedback. Resolving.

Serge Anvarov

2016-08-10 16:52

reporter   ~0094079

Lazarus 1.6. Clean install. The same error.
Start first time (screen 1). Shrink (move) top(main) panel to the right. Up Object Inspector to the top. Close. Open - error (screen2)

Serge Anvarov

2016-08-10 16:53

reporter  

p1.jpg (151,906 bytes)
p1.jpg (151,906 bytes)

Serge Anvarov

2016-08-10 16:53

reporter  

p2.jpg (134,630 bytes)
p2.jpg (134,630 bytes)

Bart Broersma

2016-08-10 18:03

developer   ~0094080

Can you try 1.6 fixes branch?

Juha Manninen

2016-08-11 14:02

developer   ~0094096

Last edited: 2016-08-11 14:03

View 2 revisions

Bart, I don't think 1.6 fixes has any changes that would affect this.

I am also pretty sure there is no code in Lazarus that adjusts the location of designer form based on Object Inspector.
Could it be a corrupt configuration? Can you please test with a clean configuration by either deleting/renaming the exiting one or by using --pcp= parameter.

Serge Anvarov

2016-08-15 13:32

reporter  

F1.jpg (95,236 bytes)
F1.jpg (95,236 bytes)

Serge Anvarov

2016-08-15 13:32

reporter  

F2.jpg (100,411 bytes)
F2.jpg (100,411 bytes)

Serge Anvarov

2016-08-15 13:32

reporter  

F3.jpg (111,537 bytes)
F3.jpg (111,537 bytes)

Serge Anvarov

2016-08-15 13:33

reporter  

F4.jpg (111,179 bytes)
F4.jpg (111,179 bytes)

Serge Anvarov

2016-08-15 13:33

reporter  

F5.jpg (89,056 bytes)
F5.jpg (89,056 bytes)

Serge Anvarov

2016-08-15 13:40

reporter   ~0094127

OK. Uninstall all. Install, select "Clear old..."
1. First start - F1.jpg. Form designer under main form, menu on russion (default system language, ignored install language select)
2. Second start (after change IDE language) - F2.jpg.Form designer already not intersect with main. After it some start/exit IDE not change forms layout.
3. Move main form to right - F3.jpg. Some start/exit IDE not change forms layout.
4. Move object inspector to top - F4.jpg.
5. After restart form designer position is wrong - F5.jpg

Michl

2016-08-15 14:03

developer   ~0094128

Last edited: 2016-08-15 14:12

View 4 revisions

Yes, the position of a NEW GUI application form is relative to the Object Inspector (Lazarus 1.2, 1.4, 1.6 and 1.7 trunk (without Sparta Docked Form Editor)).

Simple move Object Inspector and click Project -> New Project -> Application. Now move again and click again.

If you save your project, the forms should be at the designed positions.

Juha Manninen

2016-08-17 22:00

developer   ~0094164

Last edited: 2016-08-17 23:10

View 2 revisions

Yes, I can reproduce it with new applications. The Top position is set in TLazSourceFileManager.CreateNewForm.

This is not a serious bug because most often the application and its forms are saved. New applications are created only sometimes.
I will fix it somehow anyway.

Michl

2016-08-18 09:05

developer   ~0094169

> New applications are created only sometimes.

No, for test cases, I do it very often.

I added a patch (tested Windows 7, Linux Mint GTK2). It fixes this issue and the new form isn't over the Object Inspector. Maybe you find a better solution.

Michl

2016-08-18 09:06

developer  

sourcefilemanager.pas.patch (1,448 bytes)
Index: ide/sourcefilemanager.pas
===================================================================
--- ide/sourcefilemanager.pas	(revision 52824)
+++ ide/sourcefilemanager.pas	(working copy)
@@ -4433,7 +4433,7 @@
 var
   NewComponent: TComponent;
   new_x, new_y: integer;
-  p: TPoint;
+  MainIDEBarBottom: integer;
   r: TRect;
 begin
   if not AncestorType.InheritsFrom(TComponent) then
@@ -4455,11 +4455,9 @@
 
   // Figure out where we want to put the new form
   // if there is more place left of the OI put it left, otherwise right
-  p:=Point(0,0);
   if ObjectInspector1<>nil then begin
-    p:=ObjectInspector1.ClientOrigin;
-    new_x:=p.x;
-    new_y:=p.Y+10;
+    new_x:=ObjectInspector1.Left+10;
+    new_y:=ObjectInspector1.Top+10;
   end else begin
     new_x:=200;
     new_y:=100;
@@ -4467,7 +4465,13 @@
   if new_x>Screen.Width div 2 then
     new_x:=new_x-500
   else if ObjectInspector1<>nil then
-    new_x:=new_x+ObjectInspector1.Width;
+    new_x:=new_x+ObjectInspector1.Width+GetSystemMetrics(SM_CXFRAME) shl 1;
+  if Assigned(MainIDEBar) then
+  begin
+    MainIDEBarBottom:=MainIDEBar.Top+MainIDEBar.Height+GetSystemMetrics(SM_CYFRAME) shl 1+GetSystemMetrics(SM_CYCAPTION);
+    if MainIDEBarBottom<Screen.Height div 2 then
+      new_y:=Max(new_y,MainIDEBarBottom+10);
+  end;
   r:=Screen.PrimaryMonitor.WorkareaRect;
   new_x:=Max(r.Left,Min(new_x,r.Right-400));
   new_y:=Max(r.Top,Min(new_y,r.Bottom-400));

Juha Manninen

2016-08-18 16:34

developer   ~0094173

Michl, your solution is quite perfect. Applied, thanks.

Serge Anvarov

2016-11-26 19:37

reporter   ~0096268

Lazarus 1.6.2 revision 53354. Bug still here.

Bart Broersma

2016-11-26 22:12

developer   ~0096277

Should this be merged to fixes 1.6?

Ondrej Pokorny

2016-11-26 22:31

reporter   ~0096278

> Should this be merged to fixes 1.6?

IMO it won't do any harm. So yes, I added it to merge list.

Issue History

Date Modified Username Field Change
2015-03-10 06:52 Serge Anvarov New Issue
2016-03-12 13:38 Juha Manninen LazTarget => -
2016-03-12 13:38 Juha Manninen Note Added: 0090930
2016-03-12 13:38 Juha Manninen Assigned To => Juha Manninen
2016-03-12 13:38 Juha Manninen Status new => feedback
2016-04-08 14:33 Juha Manninen Note Added: 0091852
2016-04-08 14:33 Juha Manninen Status feedback => resolved
2016-04-08 14:33 Juha Manninen Resolution open => unable to reproduce
2016-08-10 16:52 Serge Anvarov Note Added: 0094079
2016-08-10 16:52 Serge Anvarov Status resolved => assigned
2016-08-10 16:52 Serge Anvarov Resolution unable to reproduce => reopened
2016-08-10 16:53 Serge Anvarov File Added: p1.jpg
2016-08-10 16:53 Serge Anvarov File Added: p2.jpg
2016-08-10 18:03 Bart Broersma Note Added: 0094080
2016-08-11 14:02 Juha Manninen Note Added: 0094096
2016-08-11 14:03 Juha Manninen Note Edited: 0094096 View Revisions
2016-08-15 13:32 Serge Anvarov File Added: F1.jpg
2016-08-15 13:32 Serge Anvarov File Added: F2.jpg
2016-08-15 13:32 Serge Anvarov File Added: F3.jpg
2016-08-15 13:33 Serge Anvarov File Added: F4.jpg
2016-08-15 13:33 Serge Anvarov File Added: F5.jpg
2016-08-15 13:40 Serge Anvarov Note Added: 0094127
2016-08-15 14:03 Michl Note Added: 0094128
2016-08-15 14:05 Michl Note Edited: 0094128 View Revisions
2016-08-15 14:06 Michl Note Edited: 0094128 View Revisions
2016-08-15 14:12 Michl Note Edited: 0094128 View Revisions
2016-08-17 22:00 Juha Manninen Note Added: 0094164
2016-08-17 23:10 Juha Manninen Note Edited: 0094164 View Revisions
2016-08-18 09:05 Michl Note Added: 0094169
2016-08-18 09:06 Michl File Added: sourcefilemanager.pas.patch
2016-08-18 16:34 Juha Manninen Fixed in Revision => r52829
2016-08-18 16:34 Juha Manninen Note Added: 0094173
2016-08-18 16:34 Juha Manninen Status assigned => resolved
2016-08-18 16:34 Juha Manninen Resolution reopened => fixed
2016-11-26 19:37 Serge Anvarov Note Added: 0096268
2016-11-26 19:37 Serge Anvarov Status resolved => assigned
2016-11-26 19:37 Serge Anvarov Resolution fixed => reopened
2016-11-26 22:12 Bart Broersma Note Added: 0096277
2016-11-26 22:31 Ondrej Pokorny Note Added: 0096278
2016-11-26 22:31 Ondrej Pokorny Status assigned => resolved
2016-11-26 22:31 Ondrej Pokorny Resolution reopened => fixed
2016-11-26 22:32 Ondrej Pokorny Fixed in Version => 1.7 (SVN)
2016-11-26 22:32 Ondrej Pokorny Target Version => 1.6.4
2017-05-21 19:40 Serge Anvarov Status resolved => closed