Page 1 of 1

OnKeyDown TAB value "undocumented"

Posted: Thu May 14, 2020 9:26 pm
by lazi
Please check this test case!
If you press the TAB key, instead of a "TAB" string in msg.key it returns 8 bytes of $20 (TAB) characters as a string.
Is it at least an undocumented feature :)

(HollyWood 8, OS4)

Code: Select all

Function p_keys(msg)
	Cls
	Locate(0,0)
	NPrint("OnKeyDown key:",msg.key)
	NPrint("Length       :",StrLen(msg.key))
	NPrint("Unpacked:",Unpack(StrToArray(msg.key)))
EndFunction

InstallEventHandler({OnKeyDown=p_keys})

NPrint("Press a key")

Repeat
	WaitEvent
Forever
                 

Re: OnKeyDown TAB value "undocumented"

Posted: Sun May 17, 2020 1:24 pm
by airsoftsoftwair
This is normal behaviour (albeit not documented). If you want to have raw key codes, use the raw key down handlers.

Re: OnKeyDown TAB value "undocumented"

Posted: Sun May 17, 2020 10:58 pm
by lazi
Ahh, ok, but why is the 8 bytes?

Re: OnKeyDown TAB value "undocumented"

Posted: Thu May 21, 2020 12:00 pm
by airsoftsoftwair
lazi wrote: Sun May 17, 2020 10:58 pm Ahh, ok, but why is the 8 bytes?
That is my preferred tab width, I always use 8 :)