Board index » delphi » Modal Formsnot close until second button click

Modal Formsnot close until second button click

I have a basic question about Modal Forms. I have created them successfully
and can access them without a problem, however when I want to close them
using a modal button (ie ModalResult =mrOK) the form does not close until
the second time I click a button.

I have read various manuals and looked for another instance like this in the
newsgroups but can not find a solution.

I am using Delphi 4 professional.
Thanks in advance.

Michael

 

Re:Modal Formsnot close until second button click


That shouldn't be happening. Check the OnCloseQuery and OnClose event handlers
to see if the form's ModalResult is being changed somehow. Also step through
your code to verify that the button's ModalResult property isn't being changed.

Does your problem happen on every model form you create, or is it a specific
form in your application that has the problem? The answer will help determine
whether something is messed up with your install od Delphi versus having a bug
in a specific form.

Quote
Michael Rawlings wrote:
> I have a basic question about Modal Forms. I have created them successfully
> and can access them without a problem, however when I want to close them
> using a modal button (ie ModalResult =mrOK) the form does not close until
> the second time I click a button.

> I have read various manuals and looked for another instance like this in the
> newsgroups but can not find a solution.

> I am using Delphi 4 professional.

> Thanks in advance.

> Michael

--
http://www.rahder.org/max
1 (608) 239-4128

Re:Modal Formsnot close until second button click


HEy, I would bet that you are doing something wrong. Because it works fine here
for a long time in D4.

Try this. Make a one form app and put one buttone on it. And make it modal and
have a modal result. It should work. If so, then COPY your bad form to the
clipboard then switch into your new one form app, then click on the FORM's
background and then click PASTE. Then POOF you have your old bad form in your
new app. Then get rid of any references in your events etc to your other apps
code. Then see if it blows up. If so, then start removing things one at a time
until it doesn't. If you get it down to where all you have left is the button
and it doesn't work, then ZIP UP the one form test app and email it to me and I
will tell you where your problem is.

Davie

Quote
Michael Rawlings wrote:
> I have a basic question about Modal Forms. I have created them successfully
> and can access them without a problem, however when I want to close them
> using a modal button (ie ModalResult =mrOK) the form does not close until
> the second time I click a button.

> I have read various manuals and looked for another instance like this in the
> newsgroups but can not find a solution.

> I am using Delphi 4 professional.

> Thanks in advance.

> Michael

Other Threads