?? index.html
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Hello World Basic Example</title><link href="style.css" rel="stylesheet" type="text/css"></head><table border="0" width="100%" height="8" bgcolor="#eeeeee"><tr> <td width="100%" height="1"><b><font size="2" color="#000000" face="Arial, Helvetica, sans-serif"><strong><a name=Top></a>S60 3rd Edition SDK FP2 for Symbian OS </strong></font></b><br><i>Example Applications Guide</i></td></tr> </table><!-- Generated by Doxygen 1.4.5 --><div class="tabs"> <ul> <li id="current"><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul></div><h1>Hello World Basic Example</h1><p><a class="el" href="index.html#Intro_sec">1. About this Example</a> <br><a class="el" href="index.html#Arch_sec">2. Architecture</a> <br><a class="el" href="index.html#Design_sec">3. Design and Implementation</a><p><hr><h2><a class="anchor" name="Intro_sec">1. About this Example</a></h2>The Hello World Basic example demonstrates how to create a simple interactive application on Symbian OS. Although the program described here basically only displays a simple string, it can be easily adapted to make much larger applications.<p>Hello World Basic application - in addition to its evident purpose to print "Hello World!" to the screen - also demonstrates displaying text with Information Note and on to the background, loading strings with the help of StringLoader, writing to and reading from a file and use of dialog to inquire user input.<p>Furthermore, Hello World Basic application is also localized to a few different languages.<h3><a class="anchor" name="Sub11">1.1. APIs demonstrated</a></h3><ul><li>StringLoader</li><li>RFs, RFile, RFileWriteStream and RFileReadStream</li><li>CAknInformationNote</li><li>CAknTextQueryDialog</li></ul><h3><a class="anchor" name="Sub12">1.2. Prerequisites</a></h3>None.<p><hr><h2><a class="anchor" name="Arch_sec">2. Architecture</a></h2>HelloWorld follows traditional Symbian OS Control-based architecture.<p><hr><h2><a class="anchor" name="Design_sec">3. Design and Implementation</a></h2><h3><a class="anchor" name="Sub31">3.1 Capabilities</a></h3>Hello World application does not require any capabilities. The program capabilities are defined in <a class="el" href="helloworldbasic_8mmp-source.html">helloworldbasic.mmp</a> file: CAPABILITY NONE.<h3><a class="anchor" name="Sub32">3.2 ScalableUI</a></h3>The program takes screen parameters in the start of the application and works with all screen modes. The program supports changing the screen layout while the program is running. Note that this support must be coded in the application and this code resides in the <a class="el" href="class_c_hello_world_basic_app_view.html#9f9bb5a2110532e2f2909eaefb44d36a">CHelloWorldBasicAppView::SizeChanged()</a> method.<h3><a class="anchor" name="Sub33">3.3 Static structure</a></h3>All the classes are derived from CBase. CBase has a number of useful features: it initialises all member data to zero, it has a virtual destructor, and it implements support for the Symbian OS cleanup stack.<h3><a class="anchor" name="Sub34">3.4 Launch sequence and command handling</a></h3>This section explains the sequence of interactions that occur on the objects described in the last section when the application is run and the user selects the Hello menu option. The following sections describe the steps in more detail.<p><ol type=1><li>The application is launched, the framework loads the application EXE and the E32Main() method implemented in <a class="el" href="helloworldbasic_8cpp-source.html">helloworldbasic.cpp</a> is called. Read more from <a class="el" href="index.html#Sub341">3.4.1 Creating the Application object</a>. <br><br></li><li>E32Main() method calls the function NewApplication(). This creates an instance of the HelloWorldApplication class, and returns a pointer to it. The framework subsequently uses this pointer to complete construction of the application. <br><br></li><li>The framework calls virtual function AppDllUid() (implementation <a class="el" href="class_c_hello_world_basic_application.html#266a6db7f5728454ee8b7a9c5f517dca">CHelloWorldBasicApplication::AppDllUid</a>) to get the UID of this particular application. The UID is used to, for example, check if an instance of the application is already running, so than the existing instance can be switched to, rather than a new instance created. Read more from <a class="el" href="index.html#Sub342">3.4.2 Getting the application's UID</a>. <br><br></li><li>The framework calls virtual function CreateDocumentL on the CHelloWorldApplication object: <a class="el" href="class_c_hello_world_basic_application.html#0a048c97a8c1868d0e1e5daf2838bcab">CHelloWorldBasicApplication::CreateDocumentL</a>. This creates an instance of the application Document and returns a pointer to it. This allows the framework to call certain Document methods directly. The Document object is constructed using the Symbian OS construction sequence, using the Document object's static method NewL. Read more from <a class="el" href="index.html#Sub343">3.4.3 Creating the Document object</a>. <br><br></li><li>The framework calls AppDllUid again, to see if it is necessary to load a file from the filing system. The HelloWorld example does not need to persist any information, and so does not have a file associated with it. <br><br></li><li>The framework calls the Document object's CreateAppUiL method: <a class="el" href="class_c_hello_world_basic_document.html#0eb34f98d849338274127e28e8c78b4e">CHelloWorldBasicDocument::CreateAppUiL</a>. This creates the AppUI object and returns a pointer to it. <br><br></li><li>The framework completes the construction of the AppUI object by calling its ConstructL method (<a class="el" href="class_c_hello_world_basic_app_ui.html#9ce34ba0b947863222da3c63d0481044">CHelloWorldBasicAppUi::ConstructL</a>). The fact the framework calls the AppUi object's constructor and ConstructL separately allows the framework to complete any necessary initialisation before construction of the AppUI object is completed. Read more from <a class="el" href="index.html#Sub344">3.4.4 Creating the AppUI and View objects</a>. <br><br></li><li>The <a class="el" href="class_c_hello_world_basic_app_ui.html#9ce34ba0b947863222da3c63d0481044">CHelloWorldBasicAppUi::ConstructL</a> method first calls the base class's BaseConstructL. This performs such tasks as reading the resource file associated with an application. <br><br></li><li>The AppUi calls <a class="el" href="class_c_hello_world_basic_app_view.html#5891ab00f23b517058efe213c1febfd2">CHelloWorldBasicAppView::NewL</a> to create the AppView object, using Symbian two phase construction. <br><br></li><li>The framework calls the Draw (<a class="el" href="class_c_hello_world_basic_app_view.html#67f946ca7848ec78de4961c5bcefdb72">CHelloWorldBasicAppView::Draw</a>) method to draw the view. In this case it will cause a blank screen to be displayed. Read more from <a class="el" href="index.html#Sub345">3.4.5 Redrawing the screen</a>. <div align="center"><img src="application_started.png" alt="application_started.png"></div></li><li>Whenever the user selects a menu option, <a class="el" href="class_c_hello_world_basic_app_ui.html#a682d228622cea7790645ce10f591242">CHelloWorldBasicAppUi::HandleCommandL</a> is called by the framework and is passed an argument, aCommand, that indicates the command the user selected. The AppUI can then perform whatever actions are required for that particular menu option: <div align="center"><img src="application_menu.png" alt="application_menu.png"></div><ol type=a><li>In case of "Hello", it creates an Information note with the text specified in resource file in it, and displays it.</li><li>In case of "Hello from file", it reads text from Hello.txt -file and displays it in Information note.</li><li>In case of "Hello from edit", it asks text from the user with a dialog and displays it on the screen.</li></ol></li></ol><h4><a class="anchor" name="Sub341">
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -