简体   繁体   中英

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM