MDI ChildForm lazarus / 21-General ---------------------------------------------------------------------- astar · 2025-07-06 20:38 Hello. I don't know where to put this? I have a problem with displaying the MDIchild window. Before the window is displayed, several frames flash and then the form is displayed. When stopped, you can see it, see **. The position of the frames does not match the entry in the Object Inspector. Does anyone know how to solve this? Lazarus v 4.0 Milan ** https://fotoalba.xchat.cz/~$13186661~90021bd95bfdbc3b8005dffc8b1659b9/ original.php?pid=28152211&psize=2# ---------------------------------------------------------------------- CharlyTango · 2025-07-06 20:59 Since Delphi 7 there are known problems with frames used at design time. Frames work fine if of you  create them at runtime. ---------------------------------------------------------------------- astar · 2025-07-06 21:17 In Delphi7 it didn't work. I also tried creating Form2 automatically with the main one, then just showing it with a button visible:= true. Same result. procedure TForm1.Button5Click(Sender: TObject); begin   {  form2:=tform2.Create(self);     form2.Show;     form2.left:=50;     form2.top:=50;      tag:=1; }     form2.Visible:=true;     tag:=1; end; ---------------------------------------------------------------------- astar · 2025-07-06 21:57 Sorry, wrong image link correct https://f.ximg.cz/img11/2224/28152224_1_r3gjwsre8.jpg ---------------------------------------------------------------------- Dzandaa · 2025-07-07 10:03 Hi, @astar: Some ideas: Did you set the "Formstyle" properties of the main window to "fsMDIForm" and that of the child window to "fsMDIChild"? Your O.S. is Windows or Linux? if in Linux do you try to change the LCLWidgeType to gtk2 or qt6 B-> ---------------------------------------------------------------------- CharlyTango · 2025-07-07 10:11 Basically, the question is whether an MDI interface is the method of choice. But that's for you to decide. MDI is hardly used anymore, is outdated, not cross-platform, and so on, so there is little to no support for it. Even Microsoft no longer supports the format and would prefer to get rid of it altogether. Currently, Single Document Interface (SDI) or Tabbed Document Interface (TDI) is used. If you are interested in building a user interface, take a look at the TDINotebook package (can be installed via OPM). I use it myself and it works quite well. Another option is to use JvTabBar from the Jvcllaz package. But in the end you have to decide for yourself. If this all is still too complicated then try a simple TPageControl to organize your forms. You can stick each and every TForm into a TTabsheet (o sheet within TPageControl) at runtime More or less Aircode but gives you a hint 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 TMainForm.AddOneTab;var  aForm: TForm1;  //TForm1's unit must be included in uses section  NewTab: TTabSheet;begin   NewTab := TTabSheet.Create(PageControl1);   NewTab.PageControl := PageControl1; NewTab.Caption := 'Something';            // Optional: Titel des Tabs   aForm:=TForm1.Create(self);  aForm.Parent := NewTab;  aForm.BorderStyle:=bsNone;  aForm.Align:=alclient;  aForm.Show; end; ---------------------------------------------------------------------- astar · 2025-07-07 10:41 Thanks for the answer. I have a project with about 15 windows (here it was just an illustration). In older versions of Lazar the MDI setting didn't work, so I had it created as SDI, which I didn't like very much. In version 3.4 I found out that it already works, so I reworked it. I'll try the procedure. What bothered me was the flashing before displaying the ChildForm, it's distracting ---------------------------------------------------------------------- CharlyTango · 2025-07-07 12:25 What do you really like about MDI ? ;-) ---------------------------------------------------------------------- astar · 2025-07-07 13:19 I like that the windows don't extend beyond the main window frame. It feels so cohesive to me. That's why I redesigned the SDI. The individual windows feel so scattered to me. Yes, it's just my own feeling. Maybe a little nostalgia ---------------------------------------------------------------------- CharlyTango · 2025-07-07 13:27 Quote from: astar on July 07, 2025, 03:19:00 pmI like that the windows don't extend beyond the main window frame. That's the same with a tabbed interface. All browsers certainly  use it for reason. Have fun ---------------------------------------------------------------------- Dzandaa · 2025-07-07 17:27 Hi, @CharlyTango I didn't use tabbed interfaces I haven't watched this part of Lazarus yet. How do you display multiples windows in a tabbed interface without clicking each tab? For example to compare different pictures? The human eye is better at some things. B-> ---------------------------------------------------------------------- astar · 2025-07-07 17:35 I tried it through the PageControl and it looks practically the same as MDI. I use this option when I want to make excel spreadsheets and it didn't occur to me to use it for a Form. I'll see how I can apply it to a project ---------------------------------------------------------------------- Remy Lebeau · 2025-07-07 17:59 Quote from: CharlyTango on July 07, 2025, 12:11:44 pmMDI is hardly used anymore, is outdated, not cross-platform, and so on, so there is little to no support for it. Even Microsoft no longer supports the format and would prefer to get rid of it altogether. That's funny, because Embarcadero just spent a considerable effort revitalizing MDI in Delphi 12. ---------------------------------------------------------------------- Thaddy · 2025-07-08 07:54 Well, the deprectation of MDI was always policy by Microsoft. Maybe that changed? "The deprecation of MDI (Multiple Document Interface) has been a long- standing policy from Microsoft, especially in the context of modern UI design guidelines. - It is not very portable across platforms - Doesn't align well with touch or accessibility - Leads to confusion in navigation." (That is from Microsoft) But: E.g. visual studio uses a tab based interface, but still tries to mimic some MDI traits. Because of popular demand it seems still supported. Pragmatic approach it seems. I might add the "long standing policy" is well over 20 years.... Btw: I just tried touch: won't work as expected. Acer win 10 64bit touch. ---------------------------------------------------------------------- CharlyTango · 2025-07-08 10:17 Quote from: Dzandaa on July 07, 2025, 07:27:59 pmI didn't use tabbed interfaces I haven't watched this part of Lazarus yet. How do you display multiples windows in a tabbed interface without clicking each tab? For example to compare different pictures? The human eye is better at some things. B-> i use such objects as TPageControl, TExtendedNotebook, JvTabBar and similar Objects as some kind of control structure to organize my windows/forms (TForm) where the real action takes place. The Forms are "glued" on the single tabs in these control structures by giving them the right parent. 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   aForm.Parent := NewTab;  aForm.BorderStyle:=bsNone; The BorderStyle prevents the Form from showing the usual frame drawings. This way a user can use several windows in a tabbes UI at once. BTW: all Forms are created at runtime except the main form which is created by Lazarus. The same way you glue the form to a tab you can "un-glue" it by 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   aForm.Parent := nil; //or another parent  aForm.BorderStyle:=bsSingle; I am pragmatic when it comes to using the options and use what works. If it is necessary to compare two windows, I detach one or both from the tabs so that they can be placed next to each other on the fly. After the comparison they are reattached again or possibly destroyed. You also can glue these two windows into one tab with a slider in between. ---------------------------------------------------------------------- Dzandaa · 2025-07-08 10:40 Hi, @CharlyTango: Is it possible to Title Horizontally or Vertically the Tabs like this ? Thank you. B-> ---------------------------------------------------------------------- CharlyTango · 2025-07-08 11:35 a tabbed UI works like any modern Internetbrowser. What you do on the tabs depends on you, even if you glue multiple windows on a tab. But what ist the purpose? If it should to choose a picture a TGrid or TDrawgrid would be a better solution. They show the picture in a grid-form without the frames of a form/window https://wiki.lazarus.freepascal.org/TDrawGrid ---------------------------------------------------------------------- Dzandaa · 2025-07-08 11:40 Hi, @CharlyTango: O.K. and you can magnify or minimize each Windows independently? Thank you. B-> ---------------------------------------------------------------------- CharlyTango · 2025-07-08 17:17 I assume so, even if your specifications seem to be no more than ideas and far from precise requirements in a program situation. It's more like asking: can you create a wormhole with folded space? The answer would always be “yes”, but it wouldn't get you anywhere ---------------------------------------------------------------------- Dzandaa · 2025-07-08 17:25 Hi, @CharlyTango: So Tabs cannot replace MDI Forms. Thank you. B-> ---------------------------------------------------------------------- CharlyTango · 2025-07-08 18:41 IMO: They can  But if you're cought in MDI thinking nothing will convince you. I don't want to proselytize. With me, everyone has the right to transport themselves to their own personal hell, or what they think is heaven, in their own individual way. That is the burden of choice. I claim the same right for myself. Have fun PS: I'm out ---------------------------------------------------------------------- astar · 2025-07-10 16:03 Hi I thought of using a parent for the second window as a replacement for MDI - the first - the main form. It doesn't even flash as much as with the classic MDI. 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.Button2Click(Sender: TObject);begin    NewTab := TTabSheet.Create(PageControl1);    NewTab.PageControl := PageControl1;    NewTab.Caption := 'New windows';     Form2:=TForm2.Create(self);    Form2.Parent :=form1;      //NewTab;  Form2.BorderStyle:= bsSizeable;          //bsNone;    Form2.Show;end;