SophiaFramework UNIVERSE 5.3 |
The responder system (hereafter called "responder system") of SophiaFramework UNIVERSE represents a group of classes whose name has the prefix of SFY or SFZ.
The responder system has the distributer to distribute an event and the renderer to draw GUI components on the device screen. By default, the standard GUI components such as a window, a menu, a dialog, or a control(button, label, tab and so on) are available.
If the responder system is used, there will be no need to implement the complex event dispatching, draw the GUI components, nor manage the states and the memories of the GUI components.
Therefore, you can rapidly and easily develop your BREW applet with the complex user interface.
Responder | |
---|---|
In the responder system, the GUI component is called "responder". Every responder inherits from SFYResponder, where GUI functions common among various responders are defined and implemented. |
The responder system is the GUI framework to automatically dispatch the event and draw graphical user interface on the device screen only by placing GUI components called responder such as window, menu, dialog, control, or frame there.
Since there is no need to program the following complex processing if the responder system is used, productivity of applet development and maintenance improves remarkably.
Main features of the responder system:
Table 9.1. Main Standard General Purpose Responders Provided with SophiaFramework UNIVERSE
Class name | Description |
---|---|
SFYApplication | Template for the application class of an applet using the responder system. |
SFYResponder | All responders inherit from this class where features common to them are implemented. There is almost no possibility that this class is directly used in the general applet development. |
SFZRoot | General purpose root to place a window, dialog, menu, or frame. |
SFZContainer | General purpose container to place controls. |
SFZWindow | General purpose window to place controls or containers. |
SFZDialog | General purpose dialog to place controls or containers. |
SFZMessageDialog | Dialog to display a notification message. |
SFZQuestionDialog | Dialog to display a selection message. |
SFZGridMenu | Grid menu. |
SFZTextMenu | Text menu. |
SFZFlexListMenu | Flex list menu. |
SFZTableView | Responder which provides a view of tabular form with a table model. |
SFZSingleTextLabelControl | Label control to display a single uneditable text. |
SFZSingleEditLabelControl | Label control to display a single editable text. |
SFZMultipleTextLabelControl | Label control to display a multiple uneditable text. |
SFZMultipleEditLabelControl | Label control to display a multiple editable text. |
SFZImageLabelControl | Label control to display an image. |
SFZSingleTextBoxControl | Box control to display a single uneditable text. |
SFZSingleEditBoxControl | Box control to display a single editable text. |
SFZMultipleTextBoxControl | Box control to display a multiple uneditable text. |
SFZMultipleEditBoxControl | Box control to display a multiple editable text. |
SFZImageBoxControl | Box control to display an image. |
SFZTextButtonControl | Button control to display a text. |
SFZImageButtonControl | Button control to display an image. |
SFZComboBoxControl | Combo box control. |
SFZListBoxControl | List box control. |
SFZFlexListBoxControl | Flex list box control. |
SFZCheckboxControl | Check box control. |
SFZRadiobuttonControl | Radio button control. |
SFZTabControl | Tab control. |
SFZTabPage | Tab page for tab control. |
SFZScrollBarControl | Scroll bar control. |
SFZContainerScrollBarControl | Scroll bar control for container. |
SFZSoftKeyControl | SoftKey control. |
SFZWebBrowserControl | Simple web browser control. |
SFZPlainFrame | Plain frame. |
SFZFlatFrame | Flat frame. |
SFZBevelFrame | Bevel frame. |
SFZTitlePlainFrame | Plain frame with a title. |
SFZTitleFlatFrame | Flat frame with a title. |
SFZTitleBevelFrame | Bevel frame with a title. |
SFYImageWidget | Widget to display an image. |
SFYSingleTextWidget | Widget to display a single uneditable text. |
SFYSingleEditWidget | Widget to display a single editable text. |
SFYMultipleTextWidget | Widget to display a multiple uneditable text. |
SFYMultipleEditWidget | Widget to display a multiple editable text. |
SFYWebBrowserWidget | Widget to browse web pages. |
List of the standard responders provided with SophiaFramework UNIVERSE | |
---|---|
In addition to classes above, the abstract base classes with the SFY prefix are included in SophiaFramework UNIVERSE. One of these abstract base classes will be inherited from when the user-defined responder class is defined. For the complete list of standard responders provided with SophiaFramework UNIVERSE, see Class reference classified by category: SFY responder. |
SFYResponder and SFYApplication | |
---|---|
All responders such as a window, a menu, a dialog, a control, a root, a frame inherit from the SFYResponder class. Though SFYApplication does not inherit from SFYResponder, it contains the root(SFZRoot inheriting from SFYResponder) by default, which is located at the top position in the owner relationship of responders. Any responder-related operation of the SFYApplication class will be delegated to this root. |
In the applet development using the responder system, define an application class inheriting from SFYApplication first.
In the project generated by AppWizard of SophiaFramework UNIVERSE, an application class inheriting from SFYApplication will be automatically generated immediately after selecting the "Use(SFY version)" option on the screen for GUI framework selection.
Application class name, including capital alphabets[only for BREW 4.0 or above] | |
---|---|
In general, the application class name will be made the same with the applet name. The capital alphabets cannot be used for the applet name since BREW 4.0. To use the capital alphabets for the application class name like "HelloWorld" or "USRApplication", it is necessary to convert the capital alphabet in the application class name into the corresponding small alphabet and then make it the applet name like "helloworld" or "usrapplication". |
The code to make a window in an application class(root) is as follows:
Example 9.1. Making a window in an application class(root)
SFCError USRApplication::MakeWindow(Void) { SFZWindowSmp window; SFCError error(SFERR_NO_ERROR); ... // create the instance of SFZWindow ("window" in the below) if ((window = SFZWindow::NewInstance(&error)) != null) { // set the window's parent responder to the application class(i.e., the root) error = window->SetParent(GetThis()); if (error == SFERR_NO_ERROR) { // set the window's real region to the region obtained by deflating the device screen by (10, 10) window->SetRealBound(GetLocalBound().Deflate(10, 10)); // set the window's state to "visible" + "active" + "enable" + "focus" together window->SetState(true, true, true, true); // move the window foremost window->ToFront(); } } ... }
Procedure to make a window | |
---|---|
|
Reference: SFZWindow | SFYResponder::GetThis | SFYResponder::GetLocalBound | SFXRectangle::Deflate
The code to make a text button control in a window is as follows:
Example 9.2. Make a text button control in a window
SFCError USRApplication::MakeTextButtonControl(Void) { SFZWindowSmp window; SFZTextButtonControlSmp button; SFCError error(SFERR_NO_ERROR); ... // create the instance of SFZTextButtonControl ("text button control" in the below) if ((button = SFZTextButtonControl::NewInstance(&error)) != null) { // set the text button control's parent responder to the window error = button->SetParent(window); if (error == SFERR_NO_ERROR) { // set the text button control's label to "hello world" error = button->SetText("hello world"); if (error == SFERR_NO_ERROR) { // get the suitable size for displaying the text button control within the window's local region, and set the origin to (10, 10) button->SetRealBound(button->GetSuitableBound().SetOrigin(10, 10)); // set the text button control's state to "visible" + "active" + "enable" + "focus" together button->SetState(true, true, true, true); } } } ... }
Procedure to make a text button control | |
---|---|
|
SFYResponder::ToFront function | |
---|---|
The control will not be moved foremost unless its parent responder such as a window, a dialog, or a container is moved foremost. It will be automatically moved foremost after calling the SFYResponder::ToFront function of its parent responder. |
Reference: SFZWindow | SFZTextButtonControl | SFYResponder::GetSuitableBound | SFXRectangle::SetOrigin
The code to display a string on BREW Output Window when the text button control is pushed is as follows:
Example 9.3. Registering and implementing the result handler
SFZTextButtonControlSmp button; SFCError error(SFERR_NO_ERROR); ... // register the "OnResult" result handler into the text button control error = button->RegisterHandler( SFXEventRange(SFEVT_RESPONDER_RESULT, SFEVT_RESPONDER_RESULT, SFP16_BEGIN, SFP16_END), XANDLER_INTERNAL(OnResult) ); ... // implement the "OnResult" result handler XANDLER_IMPLEMENT_VOIDRESULT(USRApplication, OnResult, invoker, reason, result) { // display "Text button control has been pushed." on BREW Output window TRACE("Text button control has been pushed."); return; }
NOTE | |
---|---|
The handler for result event (i.e., result handler) is registered into the text button control with the SFYResponder::RegisterHandler function. The result handler (i.e result handler) is implemented with the XANDLER_IMPLEMENT_VOIDRESULT macro. * The result event will occur when the text button control is pushed. |
As stated above, the GUI applet can be rapidly developed with ease only by placing a control such as a text button control on a window, defining, implementing, and registering its handler booted up when the control is operated.
An application class inheriting from SFYApplication is placed at the top position in the hierarchy which manages responders such as a window, a menu, a dialog, a control, or a frame.
In the responder system, there is a layered structure that an application class contains the root(SFZRoot) by default, the root manages windows, menus, or dialogs, and a window or a dialog manages controls.
A dialog or a menu is positioned in the same layer as a window.
Container is the exceptional responder designed to manage controls or containers(only container), and be managed by a control or another container(container/window/dialog).
Frame | |
---|---|
A frame(i.e frame responder) with a border and/or a title can be attached to a responder such as a window, a dialog, or a menu. |
Application class and root | |
---|---|
Though the application class is not the responder, it contains one responder called "root"(SFZRoot) by default. Therefore, there are several cases that the application class may be treated as "root" in the following. |
All responders such as a window, a menu, a dialog, or a control inherit from SFYResponder.
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |