Solved

Error while onening modal form

Posted on 1998-06-05
3
163 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

830 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