Solved

Buttons on a form

Posted on 2000-03-20
7
137 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
[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
  • 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 50 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

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!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

752 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