[lazarus] Patch: notebook page size win32

Micha Nelissen M.Nelissen at student.tue.nl
Fri Jul 25 04:41:04 EDT 2003


Hi,

Attached is a patch that fixes resizing for notebook pages. Apply in 
win32 interface please.

Regards,

Micha.



Index: win32object.inc
===================================================================
RCS file: /FPC/CVS/projects/lazarus/lcl/interfaces/win32/win32object.inc,v
retrieving revision 1.74
diff -u -w -r1.74 win32object.inc
--- win32object.inc	4 Jul 2003 17:46:27 -0000	1.74
+++ win32object.inc	25 Jul 2003 09:08:11 -0000
@@ -620,7 +620,7 @@
         End;
         LM_SETSIZE:
         Begin
-          If Sender Is TWinControl Then
+          If (Sender Is TWinControl) and TWinControl(Sender).HandleAllocated Then
           begin
             With PRect(Data)^ do
             begin
@@ -634,14 +634,12 @@
               begin
                 if (Sender As TWinControl).Parent.Handle<>0 then
                 begin
-                  Windows.GetClientRect((Sender As TWinControl).Parent.Handle, at R);
                   Windows.SendMessage((Sender As TWinControl).Parent.Handle, TCM_AdjustRect, 0, LPARAM(@R));
                   Left := R.Left;
                   Top := R.Top;
                 end
               end;
               R := Rect(Left, Top, R.Right - R.Left, R.Bottom - R.Top);
-              If TWinControl(Sender).HandleAllocated Then
                   ResizeChild(Sender, R.Left, R.Top, R.Right , R.Bottom);
             end;
           end;
@@ -2241,7 +2239,8 @@
     Windows.SendMessage(Handle, TCM_INSERTITEM, Index, integer(@TabControlItem));
     // Set page caption in tabcontrol
     SetLabel(NewPage, PChar(PageCaption));
-    // Adjust page size to fit in tabcontrol, no bounds needed.
+    // Adjust page size to fit in tabcontrol, need bounds of notebook in client of parent
+    Windows.GetClientRect(Handle, @R);
     IntSendMessage3(LM_SETSIZE, NewPage, @R);
     // Do the page switch. The are no tabcontrol notifications so we have to
     // do the hiding and showing ourselves.





More information about the Lazarus mailing list