Solved

Error while onening modal form

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
problem when i try to pack my dll file with upx 9 72
add combobox item based on numbers 9 125
Delphi: Connect to running MS Outlook 4 49
Delphi and Access based Enumeration 9 48
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

864 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

23 Experts available now in Live!

Get 1:1 Help Now