• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 524
  • Last Modified:

wait user action in Delphi

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
What is the easiest way to achieve this ? (events, timer, flags ...)
A sample is welcome...
  • 2
1 Solution
1.) Set global variable, when your script reaches the point, where user interaction is required

2.) Pause your script in a WHILE loop
WHILE Stop do begin

3.) If user has done his work, reset global variable in OnClick or OnDrag events to continue your script
LeTayAuthor Commented:
More simple than that is difficult !
Many thanks Tommy
Geert GOracle dbaCommented:
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
Geert GOracle dbaCommented:
ah it was closed already ...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now