ThinkC How to detect the cursor keys press?

Relating to ThinkC Development

pfuentes69

Active Tinkerer
Oct 27, 2021
380
293
63
Switzerland
Hello,
I need to process the KeyDown event for the cursor keys, but I can't figure out how to do it.
I managed to understand how to process key press for most keys, but not yet how to read the cursors.
For other keys I can do something like this:
Code:
        // The key is pressed while our windows are active
        theChar = theEvent->message & charCodeMask;
        switch (theChar){
            case kBackspaceChar:
                return;
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                break;
            case '+':
                break;
            case '-':
                break;
            case kReturnChar:
            case kEnterChar:
                break;           
            default:
                  // Nothing to do here
                return;
        }
Any hint would be appreciated
 

Mu0n

Active Tinkerer
Oct 29, 2021
609
560
93
Quebec
www.youtube.com
In THINK Ref Viewer, in the page named "Keyboard Compatibility" you get the following advice; the cursors first appear with the Mac Plus keyboard (they are not part of the original one).

1664479279043.png


Unless you program for System version before 4.1, you should stick with this above advice. You can use the exact notation 0x1C when you're using a short iirc. The compiler will deal with it.

The other parts of an event's message are as follows:
1664479548206.png

just use those masks as you do with charCodeMask to get to the other bits of info you need.
 

Attachments

  • 1664479151318.png
    1664479151318.png
    11 KB · Views: 45