Forum > Unix

Haiku:How to receive information about pressing/releasing a key on the keyboard?

(1/1)

CandyMan30:
How to receive information about pressing/releasing a key on the keyboard in Haiku OS? My code is:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---type  {$PACKRECORDS C}  TRawKeyInfo = record    TimeStamp : Int64;    KeyCode   : DWord;    IsKeyDown : Boolean;  end; const  KB_READ = 9999; var  fd:LongInt;  S:TRawKeyInfo;begin  fd:=fpopen('/dev/input/keyboard/at/0',O_RDWR);  if fd>=0 then  repeat    if LnxIoCtl(fd,KB_READ,@S)=0 then      WriteLn(S.TimeStamp,' ',S.IsKeyDown,' ',S.KeyCode)  until False;end.My code is not working. What am I doing wrong?

[Edited title to add Haiku.]

Handoko:
Do you need to use it in console mode? If no, that can be done easily using Lazarus. Here has a demo:
https://forum.lazarus.freepascal.org/index.php/topic,57229.msg425440.html#msg425440

Navigation

[0] Message Index

Go to full version