[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

designing the execute method in a dialog

Posted on 1998-06-05
3
Medium Priority
?
223 Views
Last Modified: 2010-04-06
I want to design a dialog component that with an execute method like in Delphi own dialog. When I call :
if dialog.execute then
...

I want to program to wait in the dialog until the user press the ok button. How can I do 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 1

Accepted Solution

by:
Marcius earned 160 total points
ID: 1350722
This is simple answer. I once had to solve this problem, and came to a solution using threads and wait for events etc. However, I have a simple solution for you.

function MyDialogue.Execute : boolean;
begin

  //Set up code here

  //Whatever code you want here

  Result := (ShowModal = mrOk);

end;

Then set the modal result value of your button to mrOk. Your dialogue will process the execute method, reach the ShowModal call, then allow your user to play with the dialogue whilst it waits for a modal result.

Yes ! It really is that simple :)
0
 

Author Comment

by:pjroy
ID: 1350723
Ok, I have deleted the ok botton. My dialog is a form with no border containing a DBGrid. The user can press ESC to quit, the arrow to browse a record, and enter to select it and quit.

How can I do the same thing than with the button but without having a button on my form.
0
 
LVL 1

Expert Comment

by:Marcius
ID: 1350724
You can set ModalResult anywhere in your code, it doesn't have to be bound to a button.

e.g.

  if Count > 0 then ModalResult = true;

This will have the same effect as tying the result to a button press. This is really much more simple than you thought isn't it ?
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

649 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