Apple Newton Utilities Podręcznik Użytkownika Strona 772

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 942
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 771
CHAPTER 21
Routing Interface
21-24 Using Routing
Performing the Routing Action 21
The important slot in each frame in the routeScripts array is the
RouteScript slot. This slot contains either a symbol identifying a method, or a
function directly, that is called if the user chooses this action from the Action
picker. This function is where you perform the routing action. The function you
dene is passed two parameters,
target and targetView, which dene the data object
to be routed and the view that contains it, respectively.
The two values,
target and targetView, are obtained from your application by the
Routing interface. As soon as the Action button is rst tapped, the Routing interface
sends the Action button view the
GetTargetInfo message to obtain these two
values. The
GetTargetInfo method returns a frame containing these and other slots.
If you set up and use
target and targetView slots in your views, you don’t
need to implement the
GetTargetInfo method because this is a root view
method that is found by inheritance. The root view method looks for the slots
target and targetView, starting from the receiver of the message, which is the
Action button view. It returns these slots in a frame called the target information
frame. If you don’t use these slots in your views, you’ll need to implement the
GetTargetInfo method to return them.
The
RouteScript slot can contain either a symbol identifying a function or it
can contain a function directly. If you are dening the
routeScripts array in a
registered view denition, the
RouteScript slot must contain a function directly.
Alternatively, if your view denition is used only within your application, you can
specify an
appSymbol slot in the routeScripts frame and specify a symbol
for the
RouteScript slot. The appSymbol slot tells the system in what
application to nd the method identied by the
RouteScript slot. Using the
latter alternative ties the view denition to a single application.
Here is an example of how you might dene the function identied by the
RouteScript slot shown in the example frame above:
MyActionFunc: func(target,targetView) begin
targetView:DeleteStuffFunc(target);
end,
Handling Multiple Items 21
The target item, as returned by GetTargetInfo, may actually be a multiple-item
target object that encapsulates several individual items to be routed. You can check
if this is the case by using the function
TargetIsCursor. If the target item is a
multiple-item target object, and you need to act separately on the individual items,
you can obtain a cursor for the items by using the function
GetTargetCursor.
Then you can use the standard cursor methods
Entry, Next, and Prev to iterate
over the cursor and return individual items. For more information about using
Przeglądanie stron 771
1 2 ... 767 768 769 770 771 772 773 774 775 776 777 ... 941 942

Komentarze do niniejszej Instrukcji

Brak uwag