Fórum Como posso Impedir diversas aberturas de um mesmo form MDI #324944
07/07/2006
0
Desde já obrigado galera.
Cabal
Curtir tópico
+ 0Posts
07/07/2006
Paullsoftware
// Verifica se o form a ser criado já esta carregado function FormExiste(aberto: Tform): Boolean; var I:Integer; begin FormExiste := false; for I := 0 to Screen.FormCount -1 do if Screen.Forms[i] = aberto then begin FormExiste := true; Break; end end;
if not FormExiste(FrmCadClientes) then begin FrmCadClientes := TFrmCadClientes.Create(nil); FrmCadClientes.BringToFront; FrmCadClientes.Focused; end else begin FrmCadClientes.BringToFront; FrmCadClientes.Focused; end;
Gostei + 0
07/07/2006
Aasn
é bem simples:
procedure TForm1.Button1Click(Sender: TObject);
var i : integer;
begin
{ verifica se ja existe o form aberto }
for i := 0 to MDIChildCount -1 do
if MDIChildren[i].ClassType = TForm2 then
Abort;
{ caso nao exista cria e abre }
Application.CreateForm(TForm2, Form2);
Form2.Show;
end;[]´s
AASN
Gostei + 0
07/07/2006
Imoreira
application.createform(TSeuForm,SeuForm);
SeuForm.show;
end else begin
SeuForm.WindowState:=wsNormal;
SeuForm.BringToFront;
end;
No onClose do SeuForm faça:
SeuForm:=nil;
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)