DELPHI XE5 跨平台 Form ShowModal 官方示例

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;
posted @ 2014-08-05 21:58  happyhills  阅读(720)  评论(0编辑  收藏  举报