Delphi Change modal form Caption
How Can I change a modal forms caption while it is showing, from within the开发者_如何转开发 modal form.
Thanks
Colin
The same way as you change the caption of any form.
There are a thousand ways, depending on when you want to change the caption. One way is this: Drop a TButton
on your modal form, and write
procedure TForm2.Button1Click(Sender: TObject);
begin
Caption := 'New caption';
end;
procedure MyMainForm.ShowForm(ACaption: String);
var
dlgForm: TForm;
begin
dlgForm:= TForm.Create(Nil);
try
dlgForm.Caption:= ACaption;
dlgForm.ShowModal;
finally
FreeAndNil(dlgForm);
end;
end;
精彩评论