Re: Calling a procedure with loop



On 15 Oct 2005 07:25:46 -0700, kinchun3@xxxxxxxxx wrote:

Apart from the other points, would this not be better in a Timer
Does it really need to run so fast ?

What are you doing in //Stuff ?

>procedure TForm1.ProcName;
>var i: integer;
>begin
>repeat
>begin
>//stuff
>Application.ProcessMessages;
>sleep (1);
>if (GetKeyState(VK_RETURN) and 1)=1 then break;
>until 0=1;
>end;
>
>procedure TForm1.Button1Click(Sender: TObject);
>begin
>ProcName;
>end;
>
>procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
>begin
>if Key = 'a' then
>ProcName;
>end;
>
>Basically what happens: When I press 'a', it would go into the loop,
>but break out of the loop without looping. The same thing happens when
>I click on Button1.
>
>How do I solve this problem?
>

.



Relevant Pages