Keyboard Devices

AreYouSure Funct Print "Are you sure" and waits for Y or N. CKbdStateGlbls Class class CKbdStateGlbls GetChar Funct Waits for non-zero ASCII key. GetDate Funct Prompt user for date expression. (Use Now() if you want current time.) GetF64 Funct Prompt user for F64 expression. GetI64 Funct Prompt user for I64 expression. GetKey Funct Waits for MSG_KEY_DOWN message and returns ASCII. GetS Funct Prompt into fixed length string. Size must include terminator. GetStr Funct Returns a MAlloc()ed prompted string. See Flags. KbdMsEvtTime Funct Timestamp of last key or mouse event. KbdTypeMatic Funct Set speed of repeated keys. PressAKey Funct Print "Press a key" and wait for non-zero ASCII key. ScanChar Funct Checks for MSG_KEY_DOWN and returns 0 immediately if no key. ScanKey Funct Checks for MSG_KEY_DOWN and returns FALSE immediately if no key. YorN Funct Wait for user to answer Y or N. kbd GlbVar CKbdStateGlbls kbd;

Keyboard Devices/System

The editor mostly stays in a GetKey()/PutKey() loop. The putkey portion is where keys are acted-upon. TempleOS has a chain of putkey hndlrs in a Circular Queue with priorities. The highest priority hndlrs can choose to terminate handling, otherwise, the keys get sent on down the chain. KeyDevAdd() defines a putkey device with a priority. "Device" might be a misnomer. Currently, the following are defined: Priority Hndlr ---------- --------- 0x20000000 MyPutKey() user hndlr 0x40000000 KDInputFilterPutKey() for In(), InStr(), and InFile() handling. 0x60000000 KDRawPutKey() nonwindowed direct to video mem debug output. 0x80000000 KDDocPutKey() standard document cmds Since handling individual keys is slow, TempleOS supports PutS() as well. If no puts hndlr is defined, individual keys are sent. CDoc.user_put_key and CDoc.user_put_s are call back routines which offer some neat tricks. See ::/Apps/Psalmody/JukeBox.HC. There is a var CDoc.user_put_dat a which gets passed to them. CtrlAltCBSet Funct Set callback for <CTRL-ALT-letter>. KeyDescSet Funct Call this from key hndlr to report desc in KeyMap(). KeyDevAdd Funct Places hook in StdOut chain. See Keyboard Devices. KeyDevRem Funct Remove StdOut hook and free.