<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Testing the “Keyboard” unit on my Mac.<div class=""><br class=""></div><div class="">CODE:</div><div class=""><div class=""><font face="Courier New" color="#4d22b3" class="">{$mode delphi}{$H+} // DOES NOT MATTER IF THIS IS INCLUDED OR NOT //</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""><br class=""></font></div><div class=""><font face="Courier New" color="#4d22b3" class="">uses</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> keyboard;</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""><br class=""></font></div><div class=""><font face="Courier New" color="#4d22b3" class="">var</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> K:TKeyEvent;</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""><br class=""></font></div><div class=""><font face="Courier New" color="#4d22b3" class="">begin</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> InitKeyboard;</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> While GetKeyEventChar(K)<>'q' do begin</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> If Keypressed then begin</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> K:=GetKeyEvent;</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> K:=TranslateKeyEvent(K);</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> Write('* Got key event with ');</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> Case GetKeyEventFlags(K) of</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> kbASCII :Writeln('ASCII key');</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> kbUniCode :Writeln('Unicode key');</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> kbFnKey :Writeln('Function key');</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> kbPhys :Writeln('Physical key');</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> kbReleased:Writeln('Released key event');</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> end;</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> Writeln('Got key : ',KeyEventToString(K),' #',Ord(GetKeyEventChar(K)));</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> End;</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> End;</font></div><div class=""><font face="Courier New" color="#4d22b3" class=""> DoneKeyboard;</font></div><div class=""><font face="Courier New" color="#4d22b3" class="">end.</font></div></div><div class=""><br class=""></div><div class="">I found so far using iTerm2:</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Function Key - working</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Ctrl-A must be pressed twice to return #$01</div><div class=""><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>Ctrl-Z must be pressed twice to return #$1A</div></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>All other Ctrl sequences worked fine</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Alt-Left returns Key with scancode 39680</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Alt-Right returns Key with scancode 40192</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Alt-Up returns Key with scancode 38912</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Alt-Down returns Key with scancode 40960</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>However, Alt-Key sequences are not returning as Unicode (as I thought they should), instead it lops twice and gives me #195 then #165 for Alt-A, while Alt-[ returns #226, #128, #156 as “ASCII key”.</div><div class=""><br class=""></div><div class="">Switching to Apple’s Terminal:</div><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>Function Key - working</div><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>Ctrl-A must be pressed twice to return #$01</div><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>Ctrl-Z must be pressed twice to return #$1A</div><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>All other Ctrl sequences worked fine</div><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>Alt-A works fine.</div><div class="">DIFF:<span class="Apple-tab-span" style="white-space:pre"> </span>Alt-Up Arrow, Alt-Down Arrow does not return anything, yet…</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Alt-Left returns Key with scancode 12288</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Alt-Right returns Key with scancode 8448</div><div class=""><br class=""></div><div class="">* Obviously, I am seeing a variance based upon the terminal app. Is this expected? I never see “released key event”, is that expected in a terminal also?</div><div class=""><br class=""></div><div class="">Also on both terminals, if I do Ctrl-A release, then Alt-A, I see “Got key : SHIFT" and the ALT-A output.</div><div class=""><br class=""></div><div class="">Ozz</div></body></html>