小弟对showmodal方法不太理解
也不知道怎么个用法
哪位高手帮解释解释
要是有个小例子那就更好了
------------------------------------
谢谢!
详细点的在delphi的帮助有:
Shows a form as a modal dialog.
function ShowModal: Integer; virtual;
Description
Use ShowModal to show a form as a modal form. A modal form is one where the application can抰 continue to run until the form is closed. Thus, ShowModal does not return until the form closes. When the form closes, it returns the value of the ModalResult property.
To close a modal form, set its ModalResult property to a nonzero value.
Note: If the form contains buttons with a ModalResult property set to a value other than mrNone, the form automatically closes when the user clicks one of those buttons and returns the ModalResult value as the return value of ShowModal.
You can check the return value against common return values using the global IsAbortResult, IsAnAllResult, IsNegativeResult, or IsPositiveResult functions.
//example:
The following methods are used for buttons in a form that is used as a modal dialog box. The methods cause the dialog box to terminate when the user clicks either the OK or Cancel button, returning mrOk or mrCancel from ShowModal, respectively. You could also set the ModalResult value to mrOk for the OK button and mrCancel for the Cancel button to accomplish the same thing. When the user clicks either button, the dialog box closes.
procedure TMyDialogBox.OKButtonClick(Sender: TObject);
begin
ModalResult := mrOK;
end;
procedure TMyDialogBox.CancelButtonClick(Sender: TObject);
begin
ModalResult := mrCancel;
end;
This code brings up the modal dialog from Form1 when a button is clicked. It causes a Beep if the OK button is clicked.
procedure TForm1.Button1Click(Sender: TObject);
begin
if MyDialogBox1.ShowModal = mrOK then
Beep;
end;
很多东西可以看帮助的,还可以学英语,多好,showmodal是模式窗体