开发者

Make a TFindDialog and TReplaceDialog Modal?

开发者 https://www.devze.com 2023-03-06 00:35 出处:网络
I am using some TFindDialog and TReplace Dialogs in m开发者_如何学运维y Application. How can I show the Dialogs Modally, like the Open and Save Dialogs do? I dont want any user to be able to select a

I am using some TFindDialog and TReplace Dialogs in m开发者_如何学运维y Application.

How can I show the Dialogs Modally, like the Open and Save Dialogs do? I dont want any user to be able to select any controls in the Application when the Find and Replace Dialog is open.


For the simple case of a single-window application I might try something like this:

procedure TYourForm.FindButtonClick(Sender: TObject);
begin
  Self.Enabled := False;
  FindDialog.Execute;
end;
...
procedure TYourForm.FindDialogClose(Sender: TObject);
begin
  Self.Enabled := True;
end;

That is, the first method is the click handler of a button. The second one is the FindDialog.OnClose event handler.

For a more complex case I would probably have a look at the source code of TCustomForm.ShowModal.

0

精彩评论

暂无评论...
验证码 换一张
取 消