cash@csmil.umich.edu (Howard Cash) (03/06/89)
Here is a standard way to uppercase a character: #define toupper(c) ((c) - 'a' + 'A') Can someone recommend to me an efficient function or macro, tooptchr(c), that will convert c to option-c? This is for use with a long string of characters in a custom font (representing musical notes). -howard cash cash@csmil.umich.edu (313)663-0156
kazim@Apple.COM (Alex Kazim) (03/07/89)
In article <11218@mailgw.cc.umich.edu> cash@csmil.umich.edu (Howard Cash) writes: >Here is a standard way to uppercase a character: > > #define toupper(c) ((c) - 'a' + 'A') > >Can someone recommend to me an efficient function or macro, tooptchr(c), >that will convert c to option-c? This is for use with a long string >of characters in a custom font (representing musical notes). > >-howard cash cash@csmil.umich.edu (313)663-0156 I can't think of an easy "math" solution. The following might work, and I really wish I had time to check it out, so swim at your own risk... 1) Get the virtual keycode from the Event Message 2) Call KeyTrans() (see Inside Mac V, pg 195). Set the option modifier in the high byte of the parameter "keycode". 3) KeyTrans() will return a longint containing the ascii value. Like I said, this is off the top of my head. You might have to watch out for dead-key processing as well... ===================================================================== Alex Kazim, Apple Computer This is ***NOT*** an Apple sanctioned way of doing this. =====================================================================