Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

wait user action in Delphi

Posted on 2011-03-08
4
Medium Priority
?
504 Views
Last Modified: 2012-05-11
I am developping Delphi GUI application
That application process "commands" that come from a "script" (via a for loop)
Some commands request the user to do some "action"
For example, the user has to confirm something : I do this with a "modal" request.
But now, some command requests the user to click on a button on the form.
Only when the user will click on that will the "process" continue its execution.
Another command "asks" the user to drag and drop something on the form
Etc..
What is the easiest way to achieve this ? (events, timer, flags ...)
A sample is welcome...
0
Comment
Question by:LeTay
[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
4 Comments
 
LVL 19

Accepted Solution

by:
Thommy earned 2000 total points
ID: 35068287
1.) Set global variable, when your script reaches the point, where user interaction is required
STOP:=true;

2.) Pause your script in a WHILE loop
WHILE Stop do begin
  Application.ProcessMessages;
end;

3.) If user has done his work, reset global variable in OnClick or OnDrag events to continue your script
STOP:=false;
0
 

Author Closing Comment

by:LeTay
ID: 35068735
More simple than that is difficult !
Many thanks Tommy
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 35069320
it all depends on how you have setup your script to run

let's assume that you want feedback from the script ... it's progress
and that you want a responsive app
and you want user input via the front-end

you still need to divide the script in 2 divisions
1: all user input is asked before the script starts
2: user input depends on results from inside the script

from all the apps i have written/maintained,
having to use application.processmessages indicates a flaw in design

threads are the best approach to solve this problem
and syncronisation objects to control the flow
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 35069332
ah it was closed already ...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

730 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