Ver Mensaje Individual
  #5  
Antiguo 01-04-2020
wilcg wilcg is offline
Miembro
 
Registrado: abr 2014
Posts: 107
Reputación: 11
wilcg Va por buen camino
Gracias amigos por los aportes,
la idea de esta función es poder usarla de manera independiente desde toda la aplicación con tan solo invocar la función y una linea de código. Hasta el momento lo he hecho de esta manera y funciona perfecto, si hay un aporte en que se pueda corregir o mejorar excelente.
Código Delphi [-]
Procedure ShowFormTPanel( TfrmClass: TFormClass; Panel :TPanel );
var
  i : SmallInt;
  Lista: TList;
begin

  Lista := TList.Create;
  try
    Panel.GetTabOrderList(Lista);
    for i := 0 to Lista.Count - 1 do
      if TWinControl(Lista[i]) is TForm then
        if TForm(Lista[i]).ClassType = TfrmClass then
        begin
          TForm(Lista[i]).BringToFront;
          Exit;
        end;

    with TfrmClass.Create(Application) do
    begin
      Parent   := Panel;
      Align    := alClient;
      Position := poMainFormCenter;
      Show;
    end;

  finally
    Lista.Free;
  end;
end;

Uso:
Código Delphi [-]
ShowFormTPanel( TForm2, Pane1 );
y con respecto a liberar el form, en el evento OnClose de esta manera.
Código Delphi [-]
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;
Responder Con Cita