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 PTCCRT

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.


James
looking at the list of constants in ptcpas, i find PTCKEY_SHIFT... i also
find, in Classes, the IPTCKeyEvent which has a GetShift function as well as
a Shift
property... seems like you should be able to the shift status with
something like

type myKeyEvent : IPTCKeyEvent;
type myShiftStatus : boolean;
myShiftStatus := myKeyEvent.Shift;
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to