Pessoal, eu consegui, porem a moda Portuguesa...rs

function SearchForm(NameForm:String) : TForm;
var
 i : Integer;
begin
  for i := 1 to Screen.FormCount - 1 do
      if Screen.Forms[i].Name = NameForm then
         Result := Screen.Forms[i];
end;

 TFirstForm(SearchForm('FirstForm')).Label1.Caption := 'aaa';

.......

alguém tem uma forma mais simples para propor??rs

Marcelo

--- Em delphi-br@yahoogrupos.com.br, Joao Morais <jcmorai...@...> 
escreveu
>
> 2009/2/4 contato.pcsolution <contato.pcsolut...@...>:
> > procedure CreateFormFromName(const FormName : string);
> > var
> > fc : TFormClass;
> > f : TForm;
> > begin
> > fc := TFormClass(FindClass(FormName));
> > f := fc.Create(Application);
> > f.Show;
> > end;
> 
> Essa rotina tá perigosa. Arruma pra algo mais ou menos assim:
> 
> function CreateFormFromName(const FormName : string): Boolean;
> var
>   fc : TClass;
>   f : TForm;
> begin
>   fc := FindClass(FormName);
>   Result := Assigned(fc) and fc.InheritsFrom(TForm);
>   if Result then
>     fc.Create(Application).Show;
> end;
> 
> Se retornar False, o form não foi encontrado.
> 
> 
> > PARTE QUE ACONTECE O ERRO..
> >
> > procedure TMainForm.Button1Click(Sender: TObject);
> > begin
> > FirstForm.Label1.Caption := 'Testando';
> > end;
> 
> Adapte a rotina acima com os truques desse artigo:
> 
> http://blog.joaomorais.com.br/2008/08/31/dica-gerenciamento-
form.html
> 
> Joao Morais
>



Responder a