7 Nokia Corporation - initial contribution. |
7 Nokia Corporation - initial contribution. |
8 Contributors: |
8 Contributors: |
9 --> |
9 --> |
10 <!DOCTYPE reference |
10 <!DOCTYPE reference |
11 PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd"> |
11 PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd"> |
12 <reference id="GUID-F64B88E0-49DA-5563-896E-29BAB8A244C9" xml:lang="en"><title>HelloWorld: |
12 <reference id="GUID-F64B88E0-49DA-5563-896E-29BAB8A244C9" xml:lang="en"><title>HelloWorld: A simple GUI application with a single view</title><shortdesc>This example demonstrates a simple application using a |
13 A simple GUI application with a single view</title><shortdesc>This example demonstrates a simple application using a GUI with |
13 GUI with a single view. </shortdesc><prolog><metadata><keywords/></metadata></prolog><refbody> |
14 a single view. </shortdesc><prolog><metadata><keywords/></metadata></prolog><refbody> |
14 <section id="GUID-8B4671BB-1A8E-4782-BDF5-19F98EDBD1E3"><title>Download</title> <p>Click on the following link to |
15 <section><title>Download</title> <p>Click on the following link to download |
15 download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-a2004cb9-da88-4ec7-a85e-dd648022f4f9.zip" scope="external">HelloWorldGUI.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-a2004cb9-da88-4ec7-a85e-dd648022f4f9.html" scope="peer">browse</xref> to view the example code. </p> </section> |
16 the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-a2004cb9-da88-4ec7-a85e-dd648022f4f9.zip" scope="external">HelloWorldGUI.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-a2004cb9-da88-4ec7-a85e-dd648022f4f9.html" scope="peer">browse</xref> to view the example code. </p> </section> |
16 <section id="GUID-B52E7C31-DDA5-4570-9D95-A18CFFD0E1F8"><title>Class Summary</title><p><xref href="GUID-E36E2F07-09E7-32BC-BB83-14DF9232E7D9.dita"><apiname>CEikApplication</apiname></xref></p><p><xref href="GUID-B33A8A56-D1BE-3E3D-B5AC-F644A5C764DB.dita"><apiname>CEikDocument</apiname></xref></p><p><xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita"><apiname>CEikAppUi</apiname></xref></p><p><xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita"><apiname>CCoeControl</apiname></xref></p></section> |
17 <section><title>Class Summary</title><p><xref href="GUID-E36E2F07-09E7-32BC-BB83-14DF9232E7D9.dita"><apiname>CEikApplication</apiname></xref></p><p><xref href="GUID-B33A8A56-D1BE-3E3D-B5AC-F644A5C764DB.dita"><apiname>CEikDocument</apiname></xref></p><p><xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita"><apiname>CEikAppUi</apiname></xref></p><p><xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita"><apiname>CCoeControl</apiname></xref></p></section> |
17 <section id="GUID-EAF6161A-0C6A-4397-A24F-19365ABFEC34"><title>Design and implementation</title> <p>This application |
18 <section><title>Design and implementation</title> <p>This application consists |
18 consists of 4 classes: </p> <ul> |
19 of 4 classes: </p> <ul> |
19 <li id="GUID-28A83A4A-D743-556B-88EB-D65AAFD29D19"><p>Application |
20 <li id="GUID-28A83A4A-D743-556B-88EB-D65AAFD29D19"><p>Application class derived |
20 class derived from <xref href="GUID-E36E2F07-09E7-32BC-BB83-14DF9232E7D9.dita"><apiname>CEikApplication</apiname></xref>. </p> </li> |
21 from <xref href="GUID-E36E2F07-09E7-32BC-BB83-14DF9232E7D9.dita"><apiname>CEikApplication</apiname></xref>. </p> </li> |
21 <li id="GUID-EF3F2195-1D04-56A4-B439-C2B50F543F74"><p>Document class |
22 <li id="GUID-EF3F2195-1D04-56A4-B439-C2B50F543F74"><p>Document class derived |
22 derived from <xref href="GUID-B33A8A56-D1BE-3E3D-B5AC-F644A5C764DB.dita"><apiname>CEikDocument</apiname></xref>. </p> </li> |
23 from <xref href="GUID-B33A8A56-D1BE-3E3D-B5AC-F644A5C764DB.dita"><apiname>CEikDocument</apiname></xref>. </p> </li> |
23 <li id="GUID-65ABFCB1-BC5A-5BCA-9F45-D5FF82AB1AE4"><p>AppUi class |
24 <li id="GUID-65ABFCB1-BC5A-5BCA-9F45-D5FF82AB1AE4"><p>AppUi class derived |
24 derived from <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita"><apiname>CEikAppUi</apiname></xref>. </p> </li> |
25 from <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita"><apiname>CEikAppUi</apiname></xref>. </p> </li> |
25 <li id="GUID-12BE51BC-0F68-5C5E-A279-4AE00E96FC7D"><p>AppView class |
26 <li id="GUID-12BE51BC-0F68-5C5E-A279-4AE00E96FC7D"><p>AppView class derived |
26 derived from <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita"><apiname>CCoeControl</apiname></xref>. </p> </li> |
27 from <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita"><apiname>CCoeControl</apiname></xref>. </p> </li> |
27 </ul> <p> <codeph>E32Main()</codeph> marks the entry point to the |
28 </ul> <p> <codeph>E32Main()</codeph> marks the entry point to the example. |
28 example. It calls <codeph>EikStart::RunApplication()</codeph> to create |
29 It calls <codeph>EikStart::RunApplication()</codeph> to create a new application |
29 a new application instance. The UI framework then calls <codeph>CExampleApplication::AppDllUid()</codeph> to obtain the application's UID. The UID returned must match the |
30 instance. The UI framework then calls <codeph>CExampleApplication::AppDllUid()</codeph> to |
30 second value defined in the project definition file. </p> <p>Once |
31 obtain the application's UID. The UID returned must match the second value |
31 the application is created, the UI framework calls <codeph>CExampleApplication::CreateDocumentL()</codeph> to create an instance of the document class. <codeph>CreateDocumentL()</codeph> internally calls the constructor of the document class and passes |
32 defined in the project definition file. </p> <p>Once the application is created, |
32 the supplied reference to the constructor initialisation list. The |
33 the UI framework calls <codeph>CExampleApplication::CreateDocumentL()</codeph> to |
33 document has no real work to do in this simple GUI application. </p> <p>As soon as the document has been created the UI framework creates |
34 create an instance of the document class. <codeph>CreateDocumentL()</codeph> internally |
34 an instance of the application UI (appUI). The appUI class is an instance |
35 calls the constructor of the document class and passes the supplied reference |
35 of a <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita"><apiname>CEikAppUi</apiname></xref> -derived class and this class takes |
36 to the constructor initialisation list. The document has no real work to do |
36 care of user interaction. </p> <p>AppUI creation uses two phase construction |
37 in this simple GUI application. </p> <p>As soon as the document has been created |
37 where first <codeph>CExampleDocument::CreateAppUiL()</codeph> is called |
38 the UI framework creates an instance of the application UI (appUI). The appUI |
38 and then the framework calls the second phase constructor of the appUI |
39 class is an instance of a <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita"><apiname>CEikAppUi</apiname></xref> -derived class and |
39 class. <codeph>CExampleAppUi::ConstructL()</codeph> creates and owns |
40 this class takes care of user interaction. </p> <p>AppUI creation uses two |
40 the view. User commands are handled by the <codeph>CExampleAppUi::HandleCommandL()</codeph> method. </p> <p>The app view class is used to draw the view. The |
41 phase construction where first <codeph>CExampleDocument::CreateAppUiL()</codeph> is |
41 view in this example consists of a simple outline rectangle with text |
42 called and then the framework calls the second phase constructor of the appUI |
42 drawn in the middle. </p> <p>The example contains a resource file <filepath>HelloWorld.rss</filepath> which defines resource information. This |
43 class. <codeph>CExampleAppUi::ConstructL()</codeph> creates and owns the view. |
43 includes a menubar with four menu items, an icon and caption. </p> <p> <filepath>HelloWorld.hrh</filepath> defines the menu command |
44 User commands are handled by the <codeph>CExampleAppUi::HandleCommandL()</codeph> method. </p> <p>The |
44 IDs and <filepath>HelloWorld.pkg</filepath> file is the source file |
45 app view class is used to draw the view. The view in this example consists |
|
46 of a simple outline rectangle with text drawn in the middle. </p> <p>The example |
|
47 contains a resource file <filepath>HelloWorld.rss</filepath> which defines |
|
48 resource information. This includes a menubar with four menu items, an icon |
|
49 and caption. </p> <p> <filepath>HelloWorld.hrh</filepath> defines the menu |
|
50 command IDs and <filepath>HelloWorld.pkg</filepath> file is the source file |
|
51 used for installation file (SIS file) generation. </p> </section> |
45 used for installation file (SIS file) generation. </p> </section> |
52 <section><title>Building and configuring</title> <p>Steps to build the example: </p> <ul> |
46 <section id="GUID-8EBC5AE8-45DD-4AD1-BA3B-3F013F351646"><title>Building and configuring</title> <p>Steps to build |
53 <li id="GUID-81019373-E4C4-545E-85B9-1C4810203D5D"><p>You can build the example |
47 the example: </p> <ul> |
54 from your IDE or the command line. </p> <p>If you use an IDE, import the <filepath>bld.inf</filepath> file |
48 <li id="GUID-81019373-E4C4-545E-85B9-1C4810203D5D"><p>You can build |
55 of the example into your IDE, and use the build command of the IDE. </p> <p>If |
49 the example from your IDE or the command line. </p> <p>If you use |
56 you use the command line, open a command prompt, and set the current directory |
50 an IDE, import the <filepath>bld.inf</filepath> file of the example |
57 to the source code directory of the example. You can then build the example |
51 into your IDE, and use the build command of the IDE. </p> <p>If you |
58 with the SBSv1 build tools with the following commands: </p> <p><userinput>bldmake |
52 use the command line, open a command prompt, and set the current directory |
59 bldfiles</userinput> </p> <p><userinput>abld build</userinput> </p> <p><xref href="GUID-793A5EF9-CC16-5EEB-9011-6431EA76EB15.dita">How to use bldmake</xref> and <xref href="GUID-B6B54E07-3B34-5D5C-8815-93383FA8FB4B.dita">How to use abld</xref> describe |
53 to the source code directory of the example. You can then build the |
60 how to use the SBSv1 build tools. </p> </li> |
54 example with the SBSv1 build tools with the following commands: </p> <p><userinput>bldmake bldfiles</userinput> </p> <p><userinput>abld |
61 <li id="GUID-83E08D73-33DB-520B-8606-6547796EDE28"><p>For the emulator, the |
55 build</userinput> </p> </li> |
62 example builds an executable called <filepath>helloworld.exe</filepath> in |
56 <li id="GUID-83E08D73-33DB-520B-8606-6547796EDE28"><p>For the emulator, |
63 the <filepath>epoc32\release\winscw\<udeb or urel>\</filepath> folder. </p> </li> |
57 the example builds an executable called <filepath>helloworld.exe</filepath> in the <filepath>epoc32\release\winscw\<udeb or urel>\</filepath> folder. </p> </li> |
64 </ul> </section> |
58 </ul> </section> |
65 </refbody></reference> |
59 </refbody></reference> |