[fpc-devel] Coding Questions

VisionForce webmaster at visionforceweb.com
Sat Dec 3 19:44:11 CET 2005

the readkey() function freezes the whole app until you press a key; this is 

----- Original Message ----- 
From: "Felipe Monteiro de Carvalho" <felipemonteiro.carvalho at gmail.com>
To: "FPC developers' list" <fpc-devel at lists.freepascal.org>
Sent: Saturday, December 03, 2005 5:12 AM
Subject: Re: [fpc-devel] Coding Questions

On 12/2/05, VisionForce <webmaster at visionforceweb.com> wrote:
> 1. Is there a synchronous readkey function, instead of that asynchronous
> one? I'm trying to make a simple game to help me learn Pascal, but I got
> stuck on this. I know that Turbo Pascal 7 has the synchronous readkey, but
> isn't there a way to do this in normal Pascal?

What exactly is the difference between synchronous readkey and asynchronous?

Are you trying to read keys from the keyboard?

> 2. How would I delay the movement of something? When I use Delay(250), it
> delays the whole program. In VB, I would write this:

Normally I would use a timer. Set it´s interval property to the
desired delay, set it's execute event to point to a method and set
it's Enable to True when needed.

On the execute method would be something like:

MyTimer. Enabled := False;
// Code to be executed

but I think this requires Lazarus LCL to be used.

If you want something to execute without halting the main program and
can't use a Timer component, then you really should think about using
a separate Thread from this.


Felipe Monteiro de Carvalho
fpc-devel maillist  -  fpc-devel at lists.freepascal.org

More information about the fpc-devel mailing list