DesktopListBox keydown: why?

What am I doing wrong? Behaviour (Mac) is as follows.

Any "Keyboard.xxx; nothing
Any Key = “x”; nothing on the first press, a very quiet beep on the 2nd (rapid) press and then normal beeps thereafter (3rd rapid etc)

All this means that, for cmd-mousedown for instance, the keydown is not registered, so no action.

Any ideas?

If Keyboard.ShiftKey Then
beep
Elseif
Key = "g" Then
beep
End if
Return True

Modifier keys don’t trigger a KeyDown event. Try this:

if Key = "g" Then
  if Keyboard.ShiftKey then
    System.Speak( "Shift Plus G" )
  elseif Keyboard.CommandKey then
    System.Speak( "Command Plus G" )
  else
    System.Speak( "G" )
  End If
End if
Return True

So, in your MouseDown event, check Keyboard.CommandKey:

var result() as String
if Keyboard.ShiftKey then result.Add( "Shift" )
if Keyboard.CommandKey then result.Add( "Command" )
if Keyboard.AltKey then result.Add( "Alt" )
if Keyboard.ControlKey then result.Add( "Control" )

if IsContextualClick then
  result.Add( "Right Click" )
else
  result.Add( "Left Click" )
end if

System.Speak( String.FromArray( result, " plus " ) )

Also: Welcome to the forums!

2 Likes

Thanks Anthony. That’s what I was doing wrong :smiley:. And thanks for the welcome. I used to be on here a bit years back but had to take a break. Great to see the vibe is still so nice.

4 Likes

Just happy to help! And welcome back!