I. Basic classes of the UI program:
1) application class: As the program entry, you can start an application by instantiating the application and starting the document class. It also sets the UID of the application (the unique identifier of each application ).
2) application document class: This class processes non-Gui data in applications-application data. It also instantiates the UI class of the application.
3) Application View class: Gui root control, which implements the main window and acts as a container for other application controls.
4) Application User Interface (UI) Class: This class instantiates the application View class and processes commands from the application;
2. In multi-view switching, a view corresponds to a container.
1) Each view must have its own container, namely, container.
2) The Appui must be derived from caknviewappui. Caknviewappui provides methods for registering, activating, and unactivating views.
3) All views must be registered on the view server for use.
4) The doactivel and dodeactive functions must be rewritten to process subordinate containers.
5) at any time, only one view is active.
6) each view can have its own menu.
3. In Appui, we must pay attention to two functions: handlecommandl () function and handlekeyeventl () function (effect andOfferkeyeventl () is similar).
Handlecommandl () is used to process menu commands. The code of the user's response menu command is stored in this function.
Handlekeyeventl () handles the program's key events.
4. Custom menu and menu response
(1) define your own menu response constant in Appui. cpp;
(2) define the enumerated values of menu constants in the hrh file;
(3) define menu commands in the RSS resource file;
(4) define the name of the menu display in the LOC file (that is, the RLS file.
5. Adding character_set utf8 to the RLS function can prevent Chinese characters from displaying garbled characters.
Sat. Cone 8: when the program exits, this error indicates that you have not released the resource. Be careful when coding addtostackl () and removefromstackl () pairs.
Addtostackl (iappcontainer); // push the container to the top of the Control Stack. For example, you can receive key events. This can solve the problem of displaying the cursor but not inputting text.
7. Replace tbuf with TDES:
First, define the following in the resource file:
Resource tbuf r_title_string {Buf = "set date ";}
Then use the copy function in the CPP file:
TBuf<32> bufFirst; bufFirst.Copy(*(StringLoader::LoadLC(R_TITLE_STRING))); CleanupStack::PopAndDestroy();
8. The sequence of system resource definitions in the RSS file cannot be changed at will; otherwise, the error message "User 23" may appear. For details about user 23, refer to the http://blog.csdn.net/Atoric/article/details/5539026,
You can know that the system file definition 'localisable_app_info 'should be treated with caution.
9. After customizing the CBA control, you can set its corresponding dynamic menu:
CEikMenuBar* pMenuBar=iEikonEnv->AppUiFactory()->MenuBar();pMenuBar>SetMenuTitleResourceId(R_MAINVIEW_MENUBAR);pMenuBar->TryDisplayMenuBarL();
10. Define date and time controls in resources
// DATE SETTING PAGERESOURCE AVKON_SETTING_PAGE r_date_setting_page { type = EEikCtDateEditor; editor_resource_id = r_date_edwin; } RESOURCE DATE_EDITOR r_date_edwin { minDate=DATE{year=1989;}; maxDate=DATE{year=2108;}; } // TIME SETTING PAGERESOURCE AVKON_SETTING_PAGE r_time_setting_page { type = EEikCtTimeEditor; editor_resource_id = r_time_edwin; } RESOURCE TIME_EDITOR r_time_edwin { minTime = TIME { hour = 0; minute = 0; second = 0; }; maxTime = TIME { hour = 23; minute = 59; second = 59; }; }
11. The reason why "syntax error" is prompted in the RSS resource file is generally a keyword error, such as a resource error.