Re: Message while running
- From: Jamie <jamie_ka1lpa_not_valid_after_ka1lpa_@xxxxxxxxxxx>
- Date: Sat, 31 May 2008 14:10:18 -0400
Mike Glazer wrote:
I have a calculation running in a loop. I would like instead of showing an hourglass to indicate that the program is running, instead to show a message. How is this done?You could use Tprogress bar were you simply let it
Mike
scroll.. You need to call the Application.ProcessMessages
in your loop for that to update it's display or. Do your
calculations in a secondary thread and simply have a Ttimer
running to update the TprogressBar.
Or, I guess you could have a TLabel some where doing it's
own little thing..! :)
In any case, if you don't want to use secondary threads, you
need to make your code a bit more inteligent..
for example..
//IN global space some where.
Var
CodeShouldRUn :Boolean = false;
And in a button event for example that starts the code.
OnButtonClick(..)
Begin
If CodeShouldRun then exit else // prevent reentry.
CodeShouldRun := True;
Repeat
// Do something here to update some display for status..
SomeLabel.Text := 'Running+'+SomeTimewhatEver;
Application.ProcessMessages;
// do your code...
Until YourCodeIsDOne OR Not CodeShouldRUn; // incase it gets canceledl;
CodeShouldRin := False;
--- some where you have another button --
OnCancelCodeButtonClick...
CodeSHouldRUn := False;
et.c..
--
"I'd rather have a bottle in front of me than a frontal lobotomy"
"Daily Thought:
SOME PEOPLE ARE LIKE SLINKIES. NOT REALLY GOOD FOR ANYTHING BUT
THEY BRING A SMILE TO YOUR FACE WHEN PUSHED DOWN THE STAIRS.
http://webpages.charter.net/jamie_5"
.
- References:
- Message while running
- From: Mike Glazer
- Message while running
- Prev by Date: Message while running
- Previous by thread: Message while running
- Index(es):