Solved

Stopping Processing...

Posted on 1998-10-05
3
123 Views
Last Modified: 2010-04-06
Hi..
  I wish to have a 'Stop' or 'cancel' button in my application such that when clicked by the user in the middle of a processing job, the app will cease processing and return to the ready state. How can I do this?

Cheers
   Shawn Halfpenny
0
Comment
Question by:aztec
3 Comments
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
And what state is that??? Give some sample codes or something similar...

Regards,
Viktor Ivanov
0
 

Accepted Solution

by:
gdebiasa earned 50 total points
Comment Utility
You'll have to put Application.ProcessMessages throughout the process you want to have interrupted. Then, you'll be able to receive an event (like the button click), and set a boolean (StopNow := true, for example).

Then, (I presume you're looping over something, or a similar operation), at the top of the loop, check StopNow and exit the loop/procedure (using break or exit).

The major problem with this is that Application.ProcessMessages will greatly slow down whatever process you're performing (I wouldn't use it more than once per loop, but you might need more, depending on exactly what's happening in your process).

Hope this helps,
Glen
0
 

Author Comment

by:aztec
Comment Utility
Thanks Glen!

Shawn
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

15 Experts available now in Live!

Get 1:1 Help Now