[fpc-devel] Coding Questions

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Sat Dec 3 12:12:52 CET 2005

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.

Read: http://wiki.lazarus.freepascal.org/index.php/Multithreaded_Application_Tutorial

Felipe Monteiro de Carvalho

More information about the fpc-devel mailing list