Make a TFindDialog and TReplaceDialog Modal?
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
.
精彩评论