Message Box, multiple lines

Ken Ray kray at sonsothunder.com
Thu Dec 29 15:57:42 EST 2005


On 12/29/05 10:43 AM, "Jerry Muelver" <jerry at hytext.com> wrote:

> I see. Well, in 24 years of computing, I've never, until the G3, even SEEN a
> keyboard with both Enter and Return keys. The distinction must be a "Mac"
> thing.

Well, yes, sort of. Basically the ASCII codes that are used for going to the
next line differ by platform. ASCII(13) is a true "carriage return" (CR)
that draws its origins from the old typewriters (as Richard mentioned).
ASCII(10) is the "line feed" (LF) character, that was used (at least) on
ancient computer terminals (especially those with built-in dot matrix
printers) to move the display/paper up a line. In those days, the LF didn't
return the "carriage" to the beginning of the next line.

On the keyboard, the key above the shift key (labeled "Return" on Mac and
"Enter" on Windows/Linux) is supposed to implement the CR, and the key on
the keypad is supposed to implement the LF.

When Windows was created, it set the end-of-line (EOL) method to be CR+LF;
Macs (pre OS X) used CR only, and Unix machines used LF only (IIRC). So
because Windows didn't make the distinction between the two characters, both
keys on the keyboard mapped to the CR+LF combination and were labeled as
"Enter". And although the raw key codes are different (65293 for "return"
and 65421 for "enter"), they get mapped to the same result. Here's a simple
test - create a stack in Windows with one field with the following script:

on rawKeyDown pKey
  put pKey && the keysDown
end rawKeyDown

Switch to browse, click in the field and hit the "return" and "enter"
keys... here's what you get:

"return" key:   65293 65293
"enter" key:    65421 65293

On Macs, the distinction is kept, which is why the keys are mapped to
different results - using the test above, this is what you get:

"return" key:   65293 65293
"enter" key:    65421 65421

And I'd assume Linux is doing something similar to Windows (I don't have
Linux handy to test at the moment).

However on all platforms the raw key codes are different between the two
keys so they really are different keys.

The other thing to take into account is that Revolution came from MetaCard,
which was implemented as an xTalk for Unix (originally), and so it was
designed to be "HyperCard for Unix" and as such the 'returnKey'/'enterKey'
and 'returnInField'/'enterInField' came from HyperCard originally and were
implemented in MetaCard (now Rev) as well.

Hope this helps,


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list