Solved

Buttons on a form

Posted on 2000-03-20
7
135 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 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

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.

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 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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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