Chapter 9: Application Control Flow
85
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
When the application receives the CM_DEACTIVATE message, it should call
WinDeactivate
to unhighlight its window, then forward the message to the
default event handler which releases menu memory resources.
The CM_QUIT message tells the application to save the user’s work and close its
window (
WinClose
).
If the user has the calculator in split screen mode, he can switch the focus to the
application on the other side of the screen. When this happens, the application
receives CM_UNFOCUS and CM_DEACTIVATE messages in that order. When
the user switches focus back to the application, it receives CM_ACTIVATE and
CM_FOCUS messages.
The user may select the same application from the
O
key as the application
already running. The application receives the CM_RESTART command. This is
important for applications which have a Current/Open/New submenu on the
APPS menu. The user’s choice from the submenu is sent in a field of the restart
event message.
9.5. Keyboard Events
The application receives a CM_KEY_PRESS message when the user presses a
key on the calculator keyboard. The message includes which key was pressed.
The OS provides default behavior for most keypress messages. The application
should check for and process significant keypresses. Keypresses the app does
not understand should be passed to
EV_defaultHandler
, which implements
system wide behavior for keys such as
3
,
O
,
½
, etc.
The application can pass keypress messages to the text editor’s event handler
(
TE_handleEvent
) if it has an active text edit field in its window.
TE_handleEvent
returns TRUE if it acted on the event. The application should
test the return value of
TE_handleEvent
and pass the message to
EV_defaultHandler
if the text editor did not act on the message.
9.6. Menu Processing
Each item in a menu has associated with it a command number. The OS uses
the command number to communicate to the application which menu item the
user chose. Menu processing proceeds as follows.