The CanvasGadget won't return the correct character after a keydown, only the key pushed - which is useless imho.
we've got a workaround on windows to return the character, and I'm building one for MacOS.
The code below does what I want (i.e. it accepts capital letters), but doesn't take all characters.
For instance "é" returns -114.
changing to unsigned word in the callback won't return the correct character.
Anybody has an idea?
Code: Select all
ImportC ""
NewControlUserPaneKeyDownUPP.l(*userRoutine)
SetControlData ( ControlRef.l, ControlPartCode.l, inTagName.l, inSize.l,*inData)
EndImport
#kControlEntireControl = 0
#kControlUserPaneKeyDownProcTag = 1801812324
ProcedureC MacCanvasCallback(ControlRef.l, key.w, char.w, modifiers.w)
MessageRequester("",Str(key)+" "+Str(char)+" "+Str(modifiers))
EndProcedure
canvascallback.i = NewControlUserPaneKeyDownUPP(@MacCanvasCallback())
SetControlData(GadgetID(canvas), #kControlEntireControl,#kControlUserPaneKeyDownProcTag,SizeOf(Integer),@canvascallback)
Gaetan