
CHAPTER 21
Routing Interface
Using Routing 21-25
cursors, refer to Chapter 11, “Data Storage and Retrieval.” Note that only these
three cursor methods are supported for use with cursors returned by
GetTargetCursor.
Note that
GetTargetCursor works with any kind of target data, whether or not
it’s a cursor. So you don’t need to call
TargetIsCursor to check before calling
GetTargetCursor.
Here’s an example of a
RouteScript method that uses GetTargetCursor to
operate on multiple items:
MyActionFunc := func(target,targetView)
begin
local curs := GetTargetCursor(target,nil);
local e := curs:Entry();
while e do begin
:DoMyAction(e); // do the operation
e := curs:Next();
end;
// update display here
end;
Handling No Target Item 21
If the target item returned by GetTargetInfo is nil, this indicates that no target
item is selected or there is nothing to do when the Action button is pressed. In this
case, the system displays a warning message to inform the user of that fact. To take
advantage of this warning message feature, all application-specific routing actions
must be disabled when there is no target. (You may want to include some actions
even when there is no target; in this case, you can ignore this section.)
To disable application-specific routing actions when there is no target, you can do
one of two things:
■ Define a GetTitle method in the routeScripts frame for each action,
instead of a
title slot. Then return nil from the GetTitle method to
prevent that action from showing up on the picker.
■ Define a GetRouteScripts method in your application, instead of a
routeScripts slot. Then return nil or an empty array from the
GetRouteScripts method to prevent any actions from showing up on
the picker.
Note that there are different messages displayed when there is no target item (the
target is
nil) and when there are no actions available for the target item.
Komentarze do niniejszej Instrukcji