Apple Newton Utilities Podręcznik Użytkownika Strona 270

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 942
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 269
CHAPTER 7
Controls and Other Protos
7-10 Button and Box Protos
Implementing a Simple Button 7
To provide a simple button in your application, pick a button proto to use, set the
appropriate slots in the button object, and (in most cases) dene one or more
scripts for the button.
The following is an example of a template that includes
protoTextButton:
aButton := {...
_proto: protoTextButton,
viewFont: ROM_fontSystem12Bold,
text: "My Button",
ButtonClickScript: func()
Print("ouch!");
// a handy way to fit a button around a string
ViewSetupFormScript: func()
viewbounds := RelBounds(10, 60,
StdButtonWidth(self.text), 13);
...}
The above example creates the following button on the Newton screen:
When the user taps this button in the Inspector, “ouch” is printed to the Inspector.
You implement a picture button with a similar template, as shown in the
following example:
pictButton := {...
_proto: protoPictureButton,
icon: namesBitmap,
viewBounds: SetBounds( 2, 8, 34, 40 ),
ButtonClickScript: func()
cardfile:Toggle()
...}
For more information on implementing specic button and box protos, see “Button
and Box Protos” (page 7-6) in Newton Programmers Reference.
Przeglądanie stron 269
1 2 ... 265 266 267 268 269 270 271 272 273 274 275 ... 941 942

Komentarze do niniejszej Instrukcji

Brak uwag