TDINotebook

A different way instead of opening modal windows (SDI) or multiple documents (MDI) is to open them using tabs, a method known as TDI. The TDI Interface is generally used in two ways: (1) with several tabs, similar to Google Chrome or Firefox where each tab represents a different and independent window and the TDINotebook comes ready to use so, for those who were used to the interface MDI maybe this method is the closest or (2) keep a single tab with the “little ear” invisible and make forms be embedded inside them and then with the “little ears” invisible we can change tabs where each one of them (or just one) will have its own form.

The video below shows what a TDI interface is and how to install the TDINotebook component:

Note that the application is always taking advantage of the main window instead of creating a new window on top of it.

You can use a method similar to the #2 option by creating a form inside a panel or PageControl, but if you do, you must also remember to destroy it manually and that's where TDINotebook helps, because closing a tab is inside it(a form) will be destroyed too. There will also be less code when you need to return to a previous window.

Even mobile apps use this concept of tabs, but no app looks like Google Chrome or Firefox because only a single tab is visible and it is switched between forms, showing only one form at a time.

If you liked this approach then install this component.

More information at:
TTDINotebook – Lazarus wiki (freepascal.org)

I wrote a demo where you can see in practice the simplicity of creating programs like this:

https://github.com/gladiston/lazdemos_gsl

Basically, you include the TDINotebook component in your main window and for the application not to look like a Google Chrome or Firefox browser, you include these lines in the OnCreate of your main form:

// A TDINotebook doesn't work without a MainMenu to associate with.
// This is weird, but I have to accept it. The instruction below
// is innocuous, you have to make the association below in time
// of design
TDINoteBook1.MainMenu:=MainMenu1;
// TDINoteook will cover the entire area, uncomment it to
// let your application not look like a google chrome browser
// otherwise, leaving them will be practical, but with a google chrome look
TDINoteBook1.Align:=alClient;
// If your windows have a close or exit button then that's good
// hide close button "X" in tab with tbNone, otherwise
// use tbMenu or tbButtom to represent a closing ed option
//TDINoteBook1.CloseTabButtom:=tbButtom; // tbNone, tbMenu, tbButtom
// nboHidePageListPopup: There is no popup to show the tabs(pages)
//TDINoteBook1.Options:=TDINoteBook1.Options+[nboHidePageListPopup];
// nboShowAddTabButton: Does not show option to add new tab
//TDINoteBook1.Options:=TDINoteBook1.Options+[n
boShowAddTabButton];
// nboShowCloseButtons: Close buttons will not be displayed
//TDINoteBook1.Options:=TDINoteBook1.Options+[nboShowCloseButtons];
// Whether or not to show the ears in the tabs
TDINoteBook1.ShowTabs:=false;
// Since this is a commercial application and not a browser so
// it's better to hide other buttons
TDINoteBook1.TDIActions.CloseAllTabs.Visible:=false;
TDINoteBook1.TDIActions.CloseTab.Visible:=false;
TDINoteBook1.TDIActions.NextTab.Visible:=false;
TDINoteBook1.TDIActions.PreviousTab.Visible:=false;
TDINoteBook1.TDIActions.TabsMenu.Visible:=false;
procedure TForm1.actClientesExecute(Sender: TObject);
var
i:Integer;
begin
  i:=TDINoteBook1.FindFormInPages(fmClientes);
  if i<0 then
    fmClientes:=TfmClientes.Create(Self);
  TDINoteBook1.ShowFormInPage(fmClientes, i);

The code above is to be didactic, you can add much more.

Still in doubt? Watch the video on how to create a hands-on TDI application:

Of course, using the TDINotebook component can make creating a TDI application easier, but it's not the only way to do it, we can create a TDI application using the TPageControl component. How? Watch the video below where I demonstrate how to do it: