RETURN & ENTER in Unicode

Richmond richmondmathewson at gmail.com
Wed Apr 2 13:18:59 EDT 2014


So; here I am bu**ering around in my Devawriter Pro

[ http://andregarzia.on-rev.com/richmond/dwriterpro.html ]

which is in what I, slightly pompously, call its 3rd System Development
Life-Cycle . . .

Anyway . . .

Inside a socking great rawKeyDown Case statement one of the 
possibilities runs a bit like this:

case 65293
     set the useUnicode to true
     set the unicodeText of the selectedText to (numToChar(13) & 
numToChar(10))
     select after the selectedText
break

now 65293 is the raw key code for the 'Return' key [ the one above the 
right-hand SHIFT key ],
so, in theory, when an end-user hits that key they should end up with a 
carriage return in the
text field: BUT they don't.

Just to really confuse the issue, when an end-user hits the 'Enter' key 
[ over on the right, on
those keyboards that have a number pad ] they get a carriage return: 
this seems to make
no sense at all considering that the raw key code for the 'Enter' key is 
65421.

So; just "for a laugh" I threw this into the soup:

case 65421
     set the useUnicode to true
     set the unicodeText of the selectedText to (numToChar(13) & 
numToChar(10))
     select after the selectedText
break

and that blocked the 'Enter' key as well.

This tells me that my rawKeyDown for those keys is doing "sweet FA", and 
merely serving to block
them.

Of course the easy thing to do is just to remove the case 65293 code so 
that the

default
   pass rawKeyDown

at the end of the switch statement just lets the OS strut its funky 
stuff with the 'Return' key
rather than attempting to over-ride it in the app.
-------------------------------------------------------------------------

BUT; this is not entirely satisfying, and I wonder if anyone can tell me 
what I should
have in my case 65293 code instead of

(numToChar(13) & numToChar(10))

to get a carriage return?

--------------------------------

LiveCode 4.5 Commercial in Mac OS 10.6.7

-------------------------------

Richmond.




More information about the use-livecode mailing list