[fpc-pascal] Re: KeyPressed

Tomas Hajny XHajT03 at mbox.vol.cz
Sun Aug 28 23:10:17 CEST 2005


Date sent:      	Mon, 22 Aug 2005 21:45:05 +0200 (CEST)
From:           	Michael Van Canneyt <michael at freepascal.org>
To:             	FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Subject:        	Re: [fpc-pascal] Re:  KeyPressed
Send reply to:  	FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
	<mailto:fpc-pascal-request at lists.freepascal.org?subject=unsubscribe>
	<mailto:fpc-pascal-request at lists.freepascal.org?subject=subscribe>


> > Some, perhaps....I ran into this problem when I was still compiling
> > the program as a pure Pascal program.  (I had the interfaces to
> > other languages commented out.)
> > 
> > I'm using: CRT, IO, DOS, Video, Printer, Graph, and Drivers.  
> 
> This is the problem. You can't use the Drivers, CRT and Video unit
> together. Each of them tries to catch keystrokes, and they will
> randomly receive them. (depending on thread usage).
> 
> You should use only Video or only CRT or only Drivers 
> (though it can be that drivers and video work together)
> 
> > It's only one or
> > two modules that need Video, Printer, Graph and Drivers (not
> > necessarily the same ones).  But, of course when it all gets linked
> > together, you only need one reference to cause trouble, right?
> > 
> > And I don't care about multi-platform, so the C library DLL looks
> > kind of like the way to go.
> 
> It will still cause problems, because the C library also will
> interfere with the Video and CRT units...
> 
> It's planned to base the CRT unit on the video unit (so they would
> work together), but until now no-one had time.

Yes - it's specifically Crt plus Drivers (which in turn uses Keyboard 
and Mouse units), which interfere. Crt should be rewritten to use 
unit Keyboard for ReadKey and KeyPressed implementation - this should 
probably resolve most of the problems. The other part (Crt accessing 
console independently of the Video unit) isn't good design, but 
shouldn't be causing your problems.

Tomas




More information about the fpc-pascal mailing list