Title Banner

Previous Book Contents Book Index Next

Newton Developer Technical Information: Newton Programmer's Guide: 2.1 OS Addendum /
Chapter 4 - Keyboard Enhancements / Using the Keyboard Enhancements


Using Keys in Slips

This section describes how to use key in your slips.

Designating the Default Button In a Slip

To designate a button as a slip's default button, you need to create a _defaultButton slot in the view. This slot must contain a reference to the view that is the default button. The system automatically applies the highlighting graphical treatment to the default button.

You need to use a view that protos to the new protoContainerView. This allows the button to be tapped when the user presses the Return key. Note that protoApplication, protoDragger, protoFloater, protoFloatNGo, and many other built-in protos are based on protoContainerView.

Paragraph views that have the oneLineOnly view justification flag automatically send the key message _DoDefaultButton, which results in the default button being tapped. protoContainerView does the same thing in a *ViewKeyDownScript, and implements the _DoDefaultButton method, which calls *PressButton() for the view declared as _defaultButton.

Designating a Slip's Close Box

You need to let the system know which button is the close button in a slip by declaring the button in the slip as _closeBox. All of the supplied close box protos do this automatically; if you implement your own close box, you need to ensure that the button is declared properly in the slip.

When a slip is closed via the keyboard, the system simulates a tap on the close box (in the same way the default button is pressed when the user presses return).

Default and Close Buttons in Confirm Slips

Four new default button lists are now available for use in confirm slips. This makes it easy to add keyboard support to all of your confirm slips. Table 4-12 shows the new default button lists.

Table 4-12 New default button lists
Button listDescription
'okCancelThe user can select either Ok or Cancel. The system closes the slip when the user taps Cancel. The default value is Ok.
'okCancelDefaultCancelThe user can select either Ok or Cancel. The system does not provide a keyboard equivalent for the Ok button. The default value is Cancel.
'yesNoDefaultYesThe user can select Yes or No. The system closes the slip when the user taps No. The default value is Yes.
'yesNoDefaultNoThe user can select Yes or No. The system does not provide a keyboard equivalent for Yes. The default value is No.

If you are creating your own button list, you can add a slot to the buttonFrame named keyValue. The value of this slot can be 'nil, 'default, or 'close. The confirm slip will associate the appropriate keystroke with each button value. A value of nil means no key association.

A final note: the root view version of the Confirm method (:Confirm()) previously used the okCancel button list; it now uses the okCancelDefaultOk button list instead.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
26 APR 1997



Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help