With SophiaFramework, developers can use both the standard BREW events and the extended events for SophiaFramework.
Moreover, their own specific events can be defined.
The SophiaFramework equivalent for BREW AEEEvent is defined as SFCEventEnum.
In SophiaFramework, the BREW standard event names such as EVT_KEY and EVT_APP_START are
replaced with events of which names start with SF
like SFEVT_KEY and SFEVT_APP_START.
The event "Type" used by GUI Framework are of SFCEventEnum event types,
"P16" is the first parameter of UInt16 type,
"P32" is the second parameter of UInt32 type.
The name of event type related with GUI Framework starts with SREVT_.
Table 9.1. Typical Events for Standard BREW
| Event Name |
Description |
| SFEVT_APP_START |
Application start |
| SFEVT_APP_STOP |
Application stop |
| SFEVT_APP_RESUME |
Application resume |
| SFEVT_APP_SUSPEND |
Application suspend |
| SFEVT_KEY |
Key input event |
| SFEVT_KEY_PRESS |
Key press event |
| SFEVT_KEY_RELEASE |
Key release event |
| SFEVT_CHAR |
Character input event |
| SFEVT_ALARM |
Alarm event |
| SFEVT_COMMAND |
Application specific event |
| SFEVT_APP_CONFIG |
Application start: indicating config screen |
| SFEVT_APP_HIDDEN_CONFIG |
Application start: indicating hidden config screen |
| SFEVT_APP_MESSAGE |
SMS message receiving event |
| SFEVT_ASYNC_ERROR |
Asynchronous error notificating (only effective with BREW SDK version 2.1 or later) |
| SFEVT_APP_TERMINATE |
Application terminate (only effective with BREW SDK version 2.1 or later) |
| SFEVT_EXIT |
BREW exit (only effective with BREW SDK version 2.1 or later) |
| SFEVT_USER |
User defined event |
Table 9.2. Typical Events for SophiaFramework
| Event Types |
Description |
| Type: SREVT_RESPONDER_RENDER |
| P16: SRP16_RENDER_INVOKE |
| P32: Bool type |
|
| The event for redrawing the Responder instance. |
| P32 is passed as true when redrawing the Responder instance that is not registered as object for redrawing. |
| *1. It is possible to dispatch to the instance of the application class |
| *2. This event cannot be handled. |
|
| Type: SREVT_RESPONDER_RENDER |
| P16: SRP16_RENDER_BASE |
| P32: SFXGraphicsPtr Type |
|
| The event for redrawing the base region of Responder instance. |
| P32 is pointer to the SFXGraphics instance. This instance is used to redraw it. |
| * To handle this event, registered the handler function. |
|
| Type: SREVT_RESPONDER_RENDER |
| P16: SRP16_RENDER_CONTENT |
| P32: SFXGraphicsPtr Type |
|
| The event for redrawing the content region of Responder instance. |
| P32 is pointer to the SFXGraphics instance. This instance is used to redraw it. |
| * To handle this event, registered the handler function. |
|
| Type: SREVT_RESPONDER_TERMINATE |
| P16: SRP16_TERMINATE_INVOKE |
| P32: Bool type |
|
| The event for destroying the Responder instance. |
| P32 is true in case of destroying it forcedly. |
| * This event must not be handled. |
|
| Type: SREVT_RESPONDER_TERMINATE |
| P16: SRP16_TERMINATE_TRY |
| P32: Bool type |
|
| The event notified before the Responder instance is destroyed. |
| P32 indicates whether it is destroyed forcedly or not. |
| When handling this event, return true to cancel, false to continue. |
| This event is also dispatched to all the child Responder instances of Responder instance being destroyed.
If any child Responder instance returns true, the destroying is canceled. |
|
|
| The event for the Dialog such as key event on the Dialog. |
| P16 indicates the reason why the Dialog is closed.
SRP16_OK is set if the OK button is pressed,
SRP16_ESCAPE if the CLEAR key is pressed. |
| P32 is a pointer to the Dialog instance. |
|
| Type: SREVT_MENU |
| P16: UInt16 Type |
| P32: SFRMenuPtr Type |
|
| The event for the Menu such as key event on the Menu item. |
| P16 indicates the reason why the Menu is closed.
SRP16_OK is set if the OK button is pressed,
SRP16_ESCAPE if the CLEAR key is pressed.
and the index of Menu item if a Menu item is selected. |
| P32 is a pointer to the Menu instance. |
|
|
| The event for the Control such as key event on the control. |
| P16 is the value of Control instance. |
| P32 is a pointer to the Control instance. |
|
Example 9.1. Redraw Forcedly
SFRApplicationPtr app(SFRApplication::GetInstance());
app->Invoke(SFXEvent(SREVT_RESPONDER_RENDER,
SRP16_RENDER_INVOKE,
true));
Example 9.2. Redraw the content region
RegisterHandler(SREVT_RESPONDER_RENDER,
SRP16_RENDER_CONTENT,
HANDLER_BEFORE,
HANDLER_FUNCTION(OnRenderContent));
Example 9.3. Destroy the responder
SFRButtonControlPtr button;
if ((button = ::new SFRButtonControl(window, SFXRectangle(10, 10, 100, 20), "OK")) != null) {
if (button->static_catch() == SFERR_NO_ERROR) {
button->Invoke(SFXEvent(SREVT_RESPONDER_TERMINATE,
SRP16_TERMINATE_INVOKE,
true));
}
else {
::delete button;
}