Size of Child Form lazarus / 31-LCL ---------------------------------------------------------------------- xasrtp · 2023-10-13 06:44 I have created a small project and i have one problem. I have main form and one child form. In my project the child form has properties "Align:=alCustom", and "WindowsState:=wsNormal". When the child form is not maximized, there is no problem. When the child window is maximized, its initial size is the size of the main form. But when main form is resized, i want the size of the child form to change according to the main form. When the child form is maximized, I want it to behave like it has the property "Align:=alClient", if it isnt maximized then I want it to behave like it has the property "Align:=alCustom". My code : procedure TFMyChild.FormWindowStateChange(Sender: TObject); begin   if self.WindowState = wsMaximized then self.Align:=alClient   else self.Align:=alCustom; end; this does not work. I need help. Thanks. ---------------------------------------------------------------------- jamie · 2023-10-13 21:21 OS Please ? And how are you making it a child form? ---------------------------------------------------------------------- xasrtp · 2023-10-14 17:30 Hi, i created Child form from menu of the main form: procedure TMForm.MyChildFormClick(Sender: TObject); begin   MyChildForm:=TMyChildForm.Create(self);   MyChildForm.Parent:=self.Panel;   MyChildForm.Visible:=true; end; OS: W10 This procedure procedure TFMyChild.FormWindowStateChange(Sender: TObject);  works perfectly after pressing the menu from the main form Thanks for reply. ---------------------------------------------------------------------- jamie · 2023-10-14 21:00 I can't tell if you have solved your issue or not? In any case, have you looked at the MDI interface?  There you can make the main form a MDIParent and another form as MDIchild.  it's possible you are looking for different controlling aspects but also, using your method, you can use the OnResize event of the main form to also resize the child form. ---------------------------------------------------------------------- xasrtp · 2023-10-15 07:36 I apologize for the unclear description. Procedure procedure TFMyChild.FormWindowStateChange(Sender: TObject); it works as it should in the event of a click on the main menu of the main form, but it does not work as it should in the case of the FormWindowStateChange event. I did not use the "resize" event, because it also occurs in unnecessary situations. I didn't look at the MDI interface, I will. So I watched a short video with MDI. I'll probably go back to C++ and QT. Thanks. ---------------------------------------------------------------------- jamie · 2023-10-15 15:43 Maybe a Child form interface is not what you are looking for.  Could be a Tabbed client interface with all the different screen layouts per tab?  is it possible to post a link to a video or image of what you are looking for? ---------------------------------------------------------------------- xasrtp · 2023-10-17 06:56 So here is an example. https://www.asrtp.com/test.webm On the left is a project in lazarus, on the right is an application in QT. I see the problem in the behavior of the child window in the maximized state. The right turns as I want, the left doesn't. ---------------------------------------------------------------------- KodeZwerg · 2023-10-17 08:09 Something like this? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormWindowStateChange(Sender: TObject);begin  if unit2.Form2.Visible then    case Self.WindowState of      wsNormal:  begin                   unit2.Form2.WindowState := wsNormal;                 unit2.Form2.Show;                   unit2.Form2.Width := Self.Width;                   unit2.Form2.Height := Self.Height;               end;      wsMinimized: unit2.Form2.Hide;      wsMaximized: unit2.Form2.WindowState := wsMaximized;      wsFullScreen: //;    end;end; procedure TForm1.FormResize(Sender: TObject);begin  if unit2.Form2.Visible then    begin      unit2.Form2.Width := Self.Width;      unit2.Form2.Height := Self.Height;    end;end; ---------------------------------------------------------------------- xasrtp · 2023-10-17 08:19 yes, this is the solution. However, I was looking for a more optimal solution, not to manually program the behavior of the child window. Thanks. ---------------------------------------------------------------------- TRon · 2023-10-17 08:23 Quote from: xasrtp on October 17, 2023, 10:19:01 amyes, this is the solution. However, I was looking for a more optimal solution, not to manually program the behavior of the child window. You could approach that by creating your own custom (visual) container that contains the childwindow(s), traversing it childs (and make the modifications) when the state of the main form changes. Are you still using the childform itself as owner on creation ? ---------------------------------------------------------------------- xasrtp · 2023-10-17 08:38 I am currently trying to switch from QT to Lazarus and testing the environment. Already during the installation, I noticed that Lazarus has a different approach to the placement of windows than I am used to. Now I'm trying to set up my solution the way I'm used to and I'm looking for an optimal solution. At this point, I tried to find out if I had missed something. In any case, thanks for the responses.