This may have to be answered by either @Björn_Eiríksson , @Christian_Schmitz or one of the Xojo engineers but please chime in if you have a suggestion.
I’m using @Björn_Eiríksson’s latest build (1.1.2) of the TextInputCanvas
plugin in a complex project but the bug I’m seeing is easily reproducible (project attached below).
Essentially, I’m trying to capture the key combination Ctlr /
(control and the forward slash key). No matter what I do, I can’t seem to intercept it.
On macOS, I’m using the key combo Cmd /
and I intercept that in the DoCommand
event of the TextInputCanvas
. For some reason, it gets intercepted as a "noop:"
command. I capture it like so:
If command = "noop:" Then
If Keyboard.AsyncCommandKey Then
' Command key held down.
If Keyboard.AsyncKeyDown(&h2C) Then
' Cmd-/
End If
End If
Return True
End If
The Ctrl /
combo on Windows doesn’t raise a "noop:"
command in DoCommand
so I have tried to intercept it within TextInputCanvas.KeyDown
but to no avail. If you start a new desktop project and drag a TextInputCanvas
onto the window and put the following code into the KeyDown
event of the canvas you can see from the comments what happens.
If Keyboard.AsyncControlKey Then
// Works if you press Ctrl-Enter on Windows but not just the control key.
Break
End If
If Keyboard.AsyncControlKey And Key = "/" Then
// Never occurs with Ctrl+/
Break
End If
If Keyboard.AsyncControlKey And Keyboard.AsyncKeyDown(&h2C) Then
// Also never occurs with Ctrl+/
Break
End If
If Keyboard.AsyncKeyDown(&h2C) Then
// Occurs if you press the "/" key but NOT if Ctrl is also held down.
Break
End If
If Key = "/" Then
// Occurs if only the "/" key is pressed.
Break
End If
Essentially, if you hold the Ctrl
key down and certain other keys, the event fires (for example Ctrl Enter
) but not for others (e.g: Ctrl /
). Am I misunderstanding the use of the Keyboard
module here?
What’s really odd is I can capture Ctrl Enter
on Windows in the KeyDown
event but not Ctrl /
.
Any ideas?