I have a FormPrincipal
which has a Tmenu
with Tactionlist
, and from this form I want to call several other Forms, according to the menu items.
In the main form, I have a Panel
and I want the other forms to open inside this panel.
I adjusted the code below, after help from other StackOverflow colleagues in English, and it worked:
procedure TFormPrincipal.AbreFormBancoExecute(Sender: TObject);
begin
Formbanco := Tformbanco.Create(Self);
Formbanco.Parent := PanelCorpo;
Formbanco.Align := alclient;
Formbanco.BorderIcons := [];
Formbanco.BorderStyle := bsNone;
Formbanco.Show;
end;
But now I need to know which form is active in the Panel so I can close it once I close the other, ie I need to modify the above routine:
procedure TFormPrincipal.AbreFormBancoExecute(Sender: TObject);
begin
// identificar qual form está ativo dentro do FormPrincipal
// fechar este form e em seguida rodar o código abaixo
Formbanco := Tformbanco.Create(Self);
Formbanco.Parent := PanelCorpo;
Formbanco.Align := alclient;
Formbanco.BorderIcons := [];
Formbanco.BorderStyle := bsNone;
Formbanco.Show;
end;
Is this a good approach for handling Forms calls from a correct main form?
. Adjust the code to get the form currently open . At Formbanco I put the following:
procedure TFormbanco.FormShow(Sender: TObject);
begin
Edit1.text := Screen.Activeform.Name; // não mostra Formbanco !!
// só mostra FormPrincipal !!
end;