Apple Newton Utilities Uživatelská příručka Strana 807

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 942
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 806
CHAPTER 22
Transport Interface
Using the Transport Interface 22-19
Application Messages 22
Applications can send messages directly to a single transport or to all transports by
using the
TransportNotify global function. This mechanism serves as a
general way for applications to communicate with transports. Here is an example
of using this function:
TransportNotify('_all,'AppOpened,[appSymbol])
The In/Out Box uses this mechanism to send three different messages to transports:
AppOpened, AppClosed, and AppInFront. The AppOpened message notifies
the transport that an application has opened and is interested in data from the
transport. The In/Out Box sends this message to all transports when it opens. This
method is not dened by default in
protoTransport since it’s transport-specic.
If you want to respond to the
AppOpened message, you must dene this method in
your transport.
This message is designed to support applications that might poll for data, such as a
pager. For example, when the application is open, it can notify the transport with
this message so that the transport can poll more frequently (and use more power)
than when the application is closed. Another use might be for an application to
notify a transport that automatically makes a connection whenever the application
is open.
The
AppClosed message noties the transport that an application has closed. The
In/Out Box sends this message to all transports when it closes. Again, this method
is not dened by default in
protoTransport since there is no default action—
it’s transport-specic. If you want to respond to the
AppClosed message, you
must dene this method in your transport.
Note that more than one application can be open at a time in the system. If you
want your transport to do something like disconnect when it receives this message,
keep track of how many times it’s received the
AppOpened message and don’t
actually disconnect until it receives the same number of
AppClosed messages.
The
AppInFront message noties the transport of a change in the frontmost
status of an application—either the application is no longer frontmost, or it now is.
The In/Out Box sends this message to all transports when another application is
opened in front of the In/Out Box view, or when the In/Out Box view is brought to
the front. Note that the
AppInFront message is not sent when an application is
opened or closed, so you need to check for the
AppOpened and AppClosed
messages to catch those occurrences.
Again, this method is not dened by default in
protoTransport since there is
no default action—it’s transport-specic. If you want to respond to the
AppInFront
message, you must dene this method in your transport. Not that this method is
used only in special circumstances and is not needed by most transports.
Zobrazit stránku 806
1 2 ... 802 803 804 805 806 807 808 809 810 811 812 ... 941 942

Komentáře k této Příručce

Žádné komentáře