Capture Ctrl+Period and Ctrl+Comma

How do I capture these keystrokes in a TextArea?

I can capture Ctrl+[a-z] combinations, but I cannot capture Ctrl+[.|,].

What’s the trick?

Thank you!

[quote=216127:@Christopher Lester]How do I capture these keystrokes in a TextArea?

I can capture Ctrl+[a-z] combinations, but I cannot capture Ctrl+[.|,].

What’s the trick?

Thank you![/quote]

Use KeyboardAsyncControlKey http://documentation.xojo.com/index.php/Keyboard

Michel, thank you. I should have mentioned that I had tried that solution prior to posting. Doesn’t work for me for some reason.

Here’s what I’m trying to use:

  if Keyboard.AsyncControlKey Then
    if Key = "." then
      msgbox "going to next field"
      return True 'handled it
    elseif Key = "," then
      msgbox "going to prior field"
      return True 'handled it
    else
      msgbox "Stop it."
      return False
    end if
  end if

ADD: This code is in the KeyDown event of my TextArea.

Have you tried a menu handler for those keys? You are on Windows, correct? Ctrl-. and Ctrl-, don’t have a special meaning like on the Mac side?

Beatrix, I have not tried a menu handler. Wouldn’t know how at this point, but I’ll look into it.

(I don’t know if those are special keys in Windows.)

Interesting, I can capture a Ctrl+k but not a Ctrl+h, so I’m guessing you’re right. Windows is managing it first and not letting me have a chance to respond to those keystrokes.

@Beatrix Willius I set up menu items and their handlers and it works fine. THANK YOU!