This should be simple... But I cannot get it to work.
This is in Delphi 7 - I've got 2 units, unit1 & unit2 with form1 and form2. Form1 has a single button 'Start'. Form2 has a progress bar and a button 'Cancel'.
procedure TForm1.StartClick(Sender: TObject);
i : integer;
for i := 1 to 1000000 do
Form2.ProgressBar1.Position := Form2.ProgressBar1.Position + 1;
procedure TForm2.CancelClick(Sender: TObject);
This is a very simplified example of what I have in my application - on running, Form1 shows - the Start button is clicked which starts a lengthy routine where I need to show the progress - so I show Form2 with a progress bar. What I want to do is be able to give the users the option of cancelling the routine by clicking on the cancel button on Form2. Trouble is that despite Form2 having focus it receives no events - specifically the CancelClick event never gets activated and so I can never escape from the routine.
How do I impliment this correctly? Thanks.