Solved

Error while onening modal form

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

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…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

710 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