Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Error while onening modal form

Posted on 1998-06-05
3
Medium Priority
?
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

722 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