Calling ShowModal as an Anonymous Method on All Platforms
procedure THeaderFooterForm.btnPickClick(Sender: TObject); var dlg: TForm1; begin dlg := TForm1.Create(nil); // select current value, if available in the list dlg.ListBox1.ItemIndex := dlg.ListBox1.Items.IndexOf(edit1.Text); dlg.ShowModal(procedure(ModalResult: TModalResult) begin if ModalResult = mrOK then // if OK was pressed and an item is selected, pick it if dlg.ListBox1.ItemIndex >= 0 then edit1.Text := dlg.ListBox1.Items [dlg.ListBox1.ItemIndex]; dlg.DisposeOf; end); end;
DELPHI XE5 跨平台 Form ShowModal 官方示例,布布扣,bubuko.com
时间: 2024-10-25 07:41:49