Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Buttons on a form

Posted on 2000-03-20
7
Medium Priority
?
140 Views
Last Modified: 2010-04-04
How do you get more than one button on a form to be activated at a given time. I have a program performing a simulation which is in a loop and this simulation is started after clicking one of the buttons(start), the other button is a stop button. I want to know how I can stop the simulation despite of it being in a loop therefore how to activate the stop button. I am using delphi 2.0.
0
Comment
Question by:Dushi
  • 4
  • 2
7 Comments
 
LVL 7

Expert Comment

by:RBertora
ID: 2636085
Place this line of code in your loop:
Application.ProcessMessages;

Rob;-)
0
 
LVL 7

Expert Comment

by:RBertora
ID: 2636099


0
 
LVL 7

Accepted Solution

by:
RBertora earned 200 total points
ID: 2636108
//global variable:
var
  Stop : Boolean;

//onformcreate:
  Stop := False;

//button2click:
Stop := True;


//button1click:
begin
  //your loop condition
  while (blateblah ) and (Stop := False)
  //lalalla
  application.processmessages;
  end;
  Stop := False;
end;

Rob;-)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Expert Comment

by:kretzschmar
ID: 2636111
wow, what for an empty comment, rob :-))
0
 
LVL 7

Expert Comment

by:RBertora
ID: 2636305
I suddenly realised my first comment (posted as an answer was insufficient) so I removed it as answer and posted the answer instead... I suppose its just the thought of going up a position ont the top15 that made me trigger happy... Doup!

Rob;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2636401
:-)))
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2636615
has started to use again (i got told off so many time for it) make comment as answer.....  and i have to use this method or nobody reads my comment :(

(if everyone stops answering questions for about a 100 years i may get into the top 15)

Craig C, getting depressed
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

972 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