background image
C H A P T E R 1 9
Built-in Applications and System Data
Auxiliary Buttons
19-37
Figure 19-9
The Notes application with and without an auxiliary button
Using Auxiliary Buttons
19
You can add buttons to the status bars or other locations in the Notes and Names
applications. Your application may also use this mechanism to allow itself to be
extended.
RegAuxButton
and
UnRegAuxButton
are the functions that add and remove a
button from the auxiliary button registry; they are called by button providers.
Button providers can ignore the descriptions of the other functions, which are
called by button hosts.
Here is an example of registering a button with the Notes application:
RegAuxButton('|smileButton:PIEDTS|,
{destApp: 'paperroll,// Add buttons to Notes
_proto: protoTextButton,
text: "Smile!",
viewBounds: RelBounds(0,0,40,10),
buttonClickScript: func() print("Cheese!")
});
This code added the auxiliary button shown in Figure 19-9.
The following code shows how this button should be removed:
UnRegAuxButton('|smileButton:PIEDTS|);
You should be careful what assumptions you make about the environment where
the button will appear. The buttons may not be on a
protoStatusBar
or have a
base
slot available by inheritance, and the implementation details of the built-in
applications may well change in the future. Remember to check your assumptions
and catch exceptions.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна