|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-D52E98C3-F5EE-4CE1-A4F5-2EF41A066B8A" xml:lang="en"><title>Creating |
|
13 resource header files</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>Typically when you create an application, there are cases where you |
|
15 need to create an enumerated set of command IDs (which are symbols with integer |
|
16 values). These defined symbols can then be used in both your code and resource |
|
17 files. Common examples of these cases, include:</p> |
|
18 <ul> |
|
19 <li><p>Custom command IDs used for mapping mobile device user input |
|
20 based upon <parmname>Options</parmname> menu selections to command handling. |
|
21 These custom command IDs are mapped to the text displayed for the command |
|
22 in the <parmname>Options</parmname> menu in resource files, and then are passed |
|
23 back to the application by the application framework.</p></li> |
|
24 <li><p>Control IDs in dialogs to allow references to the dialog |
|
25 controls from C++ code.</p> |
|
26 <itemgroup> |
|
27 <p>For more information on control IDs for dialogs, see <xref format="html" href="specs/guides/Dialogs_API_Specification/Dialogs_API_Specification.html.dita#specs/guides/Dialogs_API_Specification/Dialogs_API_Specification.html/Dialogs_API_Specification.topic3">Using |
|
28 Dialogs API</xref>.</p> |
|
29 </itemgroup> |
|
30 </li> |
|
31 <li><p>Application view IDs. Note that these could also be enumerated |
|
32 in the header files for the views.</p></li> |
|
33 <li><p>IDs for other resource structures, such as for <parmname>TABS</parmname> in |
|
34 the status pane.</p></li> |
|
35 </ul> |
|
36 <p>These enumerated values need to be defined in a resource file, which |
|
37 by convention has the extension <parmname>hrh</parmname>, The syntax is as |
|
38 follows:</p> |
|
39 <codeblock id="GUID-2CDD719A-48CA-47EF-A737-7CCB62DF6FC6" xml:space="preserve">enum TCommandIds |
|
40 { |
|
41 ECmdAppTest1 = 1, |
|
42 ECmdView1Cmd1, |
|
43 ECmdView1Cmd2, |
|
44 ECmdView1Cmd3, |
|
45 ECmdView2Cmd1, |
|
46 ECmdView2Cmd2, |
|
47 ECmdView2Cmd3, |
|
48 ECmdView2Cmd4 |
|
49 };</codeblock> |
|
50 <p>where</p> |
|
51 <ul> |
|
52 <li><p><parmname>enum</parmname> is the keyword declaration the |
|
53 set of integer values. </p> |
|
54 <note> |
|
55 <p>Use this keyword for each set of enumerated values you defined.</p> |
|
56 </note> |
|
57 </li> |
|
58 <li><p><parmname>TCommandIds</parmname> is a label for the list |
|
59 of enumerated values. This label is not used in the code or resource files.</p> |
|
60 </li> |
|
61 <li><p><parmname>ECmdAppTest1</parmname> is a symbol that can be |
|
62 used in your code or resource files.</p></li> |
|
63 <li><p><parmname>=</parmname> is the operator used for setting the |
|
64 value to the symbol.</p></li> |
|
65 <li><p><parmname>1</parmname> is the specific value assigned to |
|
66 the enumerator symbol.</p></li> |
|
67 </ul> |
|
68 <p>Each enumerator is followed by a comma (<codeph>,</codeph>) except for |
|
69 the last value. It is recommended to have a final semi colon (<codeph>;</codeph>) |
|
70 after the enumerated list. If a specific value is not assigned to a symbol |
|
71 in the enumerated list, then the value is that of the previous enumerator |
|
72 plus one. Thus, the value for <parmname>ECmdView1Cmd1</parmname> above is |
|
73 2.</p> |
|
74 <p>For more information about the use of the <parmname>enum</parmname> statement, |
|
75 see <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/ToolsAndUtilities94/DevTools-ref/ResourceFileFormat/Tool_Ref_RSS-file-format-ENUM.html#DevTools%2dref%2erss%2denum" format="application/java-archive">ENUM statement</xref>.</p> |
|
76 </conbody></concept> |