[fpc-pascal] Getting Shift key with PTCCRT

Tomas Hajny XHajT03 at hajny.biz
Mon Sep 12 22:48:05 CEST 2022

On 2022-09-12 21:41, Nikolay Nikolov via fpc-pascal wrote:
> On 9/10/22 17:57, James Richters via fpc-pascal wrote:
>> Thanks for the suggestion
>> I think the syntax should be:
>> type myKeyEvent = IPTCKeyEvent;
>> Var myShiftStatus : boolean;
>> myShiftStatus := myKeyEvent.Shift;
>> but I get IPTCKeyEvent not found.  I wonder if it's only designated as
>> internal.. or if I need to use something other than PTCGraph and 
> It's internal if you use ptccrt and ptcgraph, but it's available if
> you use ptc directly. These are two different APIs:
> ptc - low level, non-Borland compatible API
> ptcgraph, ptccrt, ptcmouse - these use ptc to provide a Borland
> BGI-compatible and CRT-unit compatible support (plus mouse, which was
> never supported by Borland, but is nice to have also ;-) ). Recently,
> I don't have much time to work on ptc (unfortunately), but you can
> look at the source yourself and write a patch by yourself to get what
> you need. The conversion of ptc key events to CRT-like key codes
> happens in ptccrt.pp, procedure GetKeyEvents (lines 113..534). It
> tries to convert ptc key events to what CRT in dos used to return.
> There are lots of compatibility factors involved, which results in
> some key data loss, but you can modify it at your will for your own
> purposes. Perhaps we can extend ptccrt to be able to return the whole
> ptc key event as well? It can be done, unfortunately, the Borland
> ReadKey/KeyPressed API wasn't designed to do that, so new functions
> appear to be necessary.

Old TP/BP programs were usually accessing the BIOS ShiftState "variable" 
(using direct BIOS memory access). TV unit Drivers provided this 
functionality using function GetShiftState (available in FreeVision as 
well, of course). If you're looking for adding something compatible to 
TP/BP functionality, ShiftState (e.g. as a property), or GetShiftState 
function might be good candidates for such an addition, IMHO.


More information about the fpc-pascal mailing list