beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 324

background image

C H A P T E R 8

Text and Ink Input and Display

8-32

Using Text

row1 := [ keyVUnit, keyVUnit,

"4",4, keyHUnit+keyVUnit+keyFramed+2*keyInsetUnit+keyAutoHilite,

"5",5, keyHUnit+keyVUnit+keyFramed+2*keyInsetUnit+keyAutoHilite,

"6",6, keyHUnit+keyVUnit+keyFramed+2*keyInsetUnit+keyAutoHilite ];

row2 := [ keyVUnit, keyVUnit,

"7",7, keyHUnit+keyVUnit+keyFramed+2*keyInsetUnit+keyAutoHilite,

"8",8, keyHUnit+keyVUnit+keyFramed+2*keyInsetUnit+keyAutoHilite,

"9",9, keyHUnit+keyVUnit+keyFramed+2*keyInsetUnit+keyAutoHilite ];

row3 := [ keyVUnit, keyVUnit,

"*",$*, keyHUnit+keyVUnit+keyFramed+2*keyInsetUnit+keyAutoHilite,

"0",0, keyHUnit+keyVUnit+keyFramed+2*keyInsetUnit+keyAutoHilite,

"#",$#, keyHUnit+keyVUnit+keyFramed+2*keyInsetUnit+keyAutoHilite ];

keypad := {...

viewClass: clKeyboardView,

viewBounds: {left:65, top:65, right:153, bottom:145},

viewFlags: vVisible+vClickable+vFloating,

viewFormat: vfFrameBlack+vfFillWhite+vfPen(1),

keyDefinitions: [ row0, row1, row2, row3 ], // defined above

keyPressScript: func (key)

begin

Print("You pressed " & key);

end,

...}

The Key Legend

8

The key legend specifies what appears on the keycap. It can be one of the following
types of data:

nil

, in which case the key result is used as the legend.

A string, which is displayed centered in the keycap.

A character constant, which is displayed centered in the keycap.

A bitmap object, which is displayed centered in the keycap.

An integer. The number is displayed centered in the keycap and is used directly
as the key result, unless the

keyResultsAreKeycodes

slot is set to

true

, as

described in the next section.

A method. The method is evaluated and its result is treated as if it had been
specified as the legend.