Ver Mensaje Individual
  #1  
Antiguo 01-04-2020
wilcg wilcg is offline
Miembro
 
Registrado: abr 2014
Posts: 107
Reputación: 11
wilcg Va por buen camino
Controlar instancias de un Tform dentro de un TPanel

Amigos del foro, de antemano agradecerles su ayuda.
estoy tratando de meter muchos Forms dentro de un Panel mediante una función, pero al mismo tiempo quiero controlar las instancias de los formularios que ya se encuentran dentro del TPanel. Si ya esta dentro simplemente hacerlo visible a dicho form.
Código Delphi [-]
Procedure ShowFormTPanel( TfrmClass: TFormClass; bMultiInstace : boolean );
var
  i : SmallInt;
  F : TForm;
begin
  if not bMultiInstace then
    for i := TPanel1.ComponentCount - 1 downto 0 do
    begin
      F := TPanel1.Components[i];
      if F.ClassType = TfrmClass then
      begin
        F.BringToFront;
        Exit;
      end;
    end;

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

end;

Para ser llamado así
Código Delphi [-]
ShowFormTPanel( TfClientes, False );
Por el momento no esta funcionando, necesito de ustedes.
Responder Con Cita