Solved

Error while onening modal form

Posted on 1998-06-05
3
154 Views
Last Modified: 2010-04-06
At the and of a dialog execute fonction, I have a line like this:
Result := (ShowModal = mrOk);

When I try call the execute function, I got an error saying "Cannot make a visible window modal". What is that???
0
Comment
Question by:pjroy
  • 2
3 Comments
 
LVL 3

Expert Comment

by:rickpet
ID: 1350885
All you need is...

Result := ShowModal;

Somewhere in your code of the modalform...you set ModalResult to MrOk
like when the user hit's the Ok button.

Rick

0
 
LVL 3

Expert Comment

by:rickpet
ID: 1350886
Also your form's visible property needs to be set to false.

Rick
0
 
LVL 1

Accepted Solution

by:
Marcius earned 0 total points
ID: 1350887
Your Result := (ShowModal = mrOk) line is correct, since you want your function to return a boolean. My guess is that you have already used the show method on you form.

I understand the confusion here, the Result := (ShowModal = mrOK) actually calls the ShowModal function for the form, you do not need to call it before.

I guess this is what you are doing:

procedure TMyForm.callMyDialogue;
begin
  // DO SOME STUFF
  MyDialogue.Execute;
end;

function TMyDialogue.Execute : Boolean;
begin
  ShowModal;
  // DO SOME STUFF
  Result := (ShowModal = mrOK);
end;

If this is the case, you need to remove the first call to ShowModal. That will solve the problem.

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now