 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Gerhard Guest
|
Posted: Wed Jul 30, 2003 9:56 am Post subject: ModalResult doesn't work perfectly! |
|
|
hello,
in a dialog there is a button that is used for closing the dilaog,
its properties are:
Cancel = True
Caption = 'Cancel'
TabOrder = 1
ModalResult = mrNone
in the onclick handler, i just call Close; but in the following code,
the modal result is a non-zero(mrNone) value!
if ShowModal <> 0 then
....
as you see its modalresult is set to mrNone but when the user presses
the cancel button, the if statement will be executed!
i debugged the code, the result shows that when this button is clicked,
the modal result is set to 2!!
can anybody tell me what is the problem and what should i do to get rid
of it?
any comments would be appreciated,
Gerhard
|
|
| Back to top |
|
 |
Eric ten Westenend Guest
|
Posted: Wed Jul 30, 2003 10:22 am Post subject: Re: ModalResult doesn't work perfectly! |
|
|
Hello Gerhard,
The help file says with mrNone: Used as a default value before the user
exits.
So BEFORE the users exits. mrNone can never be the value of the modalresult
coming from modal form
You see this happen in the TCustomForm class in the Close method which is
called by your call to close
procedure TCustomForm.Close;
var
CloseAction: TCloseAction;
begin
if fsModal in FFormState then
ModalResult := mrCancel
..
..
..
Set the ModalResult property for the button to mrCancel and don't call
CLOSE yourself will do the job.
The form is closes, the modalresult <> 0
Eric
"Gerhard" <no (AT) spam (DOT) com> schreef in bericht
news:3f27963d$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
hello,
in a dialog there is a button that is used for closing the dilaog,
its properties are:
Cancel = True
Caption = 'Cancel'
TabOrder = 1
ModalResult = mrNone
in the onclick handler, i just call Close; but in the following code,
the modal result is a non-zero(mrNone) value!
if ShowModal <> 0 then
....
as you see its modalresult is set to mrNone but when the user presses
the cancel button, the if statement will be executed!
i debugged the code, the result shows that when this button is clicked,
the modal result is set to 2!!
can anybody tell me what is the problem and what should i do to get rid
of it?
any comments would be appreciated,
Gerhard
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|