beautypg.com

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

Page 328

background image

C H A P T E R 8

Text and Ink Input and Display

8-36

Using Text

Key dimensions are specified by summing a combination of horizontal and vertical
key unit constants within the

keyDescriptor

. For example, to specify a key that

is 2 3/4 units wide by 1 1/2 units high, specify these constants for

keyDescriptor

:

keyHUnit*2 + keyHQuarter*3 + keyVUnit + keyVHalf

Using the Keyboard Registry

8

If your application includes its own keyboard, you need to register it with the system
keyboard registry. This makes it possible for the system to call any keyboard-related
functions that you have defined and to handle the insertion caret properly.

The

RegisterOpenKeyboard

method of a view is for registering a keyboard for

use with that view.

Use the

UnregisterOpenKeyboard

method of a view to remove the keyboard

view from the registry. If the insertion caret is visible, calling this method hides it.

Note

The system automatically unregisters the keyboard when the
registered view is hidden or closed. The protokeypad proto
also automatically handles registration for you in its

viewSetupDoneScript

. You do not need to call the

UnregisterOpenKeyboard

method in these cases.

You can use the

OpenKeypadFor

function to open a context-sensitive keyboard

for a view. This function first attempts to open the keyboard defined in the view’s

_keyboard

slot. If the view does not define a keyboard in that slot,

OpenKeypadFor

determines if the view allows only a single type of input, such

as date, time, phone number, or numbers. If so,

OpenKeypadFor

opens the

appropriate built-in keyboard for that input type. If none of these other conditions
is met,

OpenKeypadFor

opens the

alphaKeyboard

keyboard for the view.

Note

The Newton System Software uses the

OpenKeypadFor

function to open a context-sensitive keyboard when the user
double-taps on a view in which a

_keyboard

slot is defined.

Theses methods and functions, as well as several others you can use with the
keyboard registry in your applications, are described in “Keyboard Registry
Functions and Methods” (page 7-44) in Newton Programmer’s Reference.

Defining Tabbing Orders

8

You can define the tabbing order for an input view with the

_tabChildren

slot,

which contains an array of view paths.