7 Nokia Corporation - initial contribution. |
7 Nokia Corporation - initial contribution. |
8 Contributors: |
8 Contributors: |
9 --> |
9 --> |
10 <!DOCTYPE concept |
10 <!DOCTYPE concept |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
12 <concept id="GUID-D52E98C3-F5EE-4CE1-A4F5-2EF41A066B8A" xml:lang="en"><title>Creating |
12 <concept id="GUID-D52E98C3-F5EE-4CE1-A4F5-2EF41A066B8A" xml:lang="en"><title>Creating resource header files</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
13 resource header files</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
13 <p>Typically when you create an application, there are cases where |
14 <p>Typically when you create an application, there are cases where you |
14 you need to create an enumerated set of command IDs (which are symbols |
15 need to create an enumerated set of command IDs (which are symbols with integer |
15 with integer values). These defined symbols can then be used in both |
16 values). These defined symbols can then be used in both your code and resource |
16 your code and resource files. Common examples of these cases, include:</p> |
17 files. Common examples of these cases, include:</p> |
|
18 <ul> |
17 <ul> |
19 <li><p>Custom command IDs used for mapping mobile device user input |
18 <li><p>Custom command IDs used for mapping mobile device |
20 based upon <parmname>Options</parmname> menu selections to command handling. |
19 user input based upon <parmname>Options</parmname> menu selections |
21 These custom command IDs are mapped to the text displayed for the command |
20 to command handling. These custom command IDs are mapped to the text |
22 in the <parmname>Options</parmname> menu in resource files, and then are passed |
21 displayed for the command in the <parmname>Options</parmname> menu |
23 back to the application by the application framework.</p></li> |
22 in resource files, and then are passed back to the application by |
24 <li><p>Control IDs in dialogs to allow references to the dialog |
23 the application framework.</p></li> |
25 controls from C++ code.</p> |
24 <li><p>Control IDs in dialogs to allow references to the |
|
25 dialog controls from C++ code.</p> |
26 <itemgroup> |
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#Dialogs_API_Specification.topic3" scope="external">Using |
27 <p>For more information on control IDs for dialogs, see <xref format="html" href="specs/guides/Dialogs_API_Specification/Dialogs_API_Specification.html#Dialogs_API_Specification.topic3" scope="external">Using Dialogs API</xref>.</p> |
28 Dialogs API</xref>.</p> |
|
29 </itemgroup> |
28 </itemgroup> |
30 </li> |
29 </li> |
31 <li><p>Application view IDs. Note that these could also be enumerated |
30 <li><p>Application view IDs. Note that these could also |
32 in the header files for the views.</p></li> |
31 be enumerated in the header files for the views.</p></li> |
33 <li><p>IDs for other resource structures, such as for <parmname>TABS</parmname> in |
32 <li><p>IDs for other resource structures, such as for <parmname>TABS</parmname> in the status pane.</p></li> |
34 the status pane.</p></li> |
|
35 </ul> |
33 </ul> |
36 <p>These enumerated values need to be defined in a resource file, which |
34 <p>These enumerated values need to be defined in a resource file, |
37 by convention has the extension <parmname>hrh</parmname>, The syntax is as |
35 which by convention has the extension <parmname>hrh</parmname>, The |
38 follows:</p> |
36 syntax is as follows:</p> |
39 <codeblock id="GUID-2CDD719A-48CA-47EF-A737-7CCB62DF6FC6" xml:space="preserve">enum TCommandIds |
37 <codeblock id="GUID-2CDD719A-48CA-47EF-A737-7CCB62DF6FC6" xml:space="preserve">enum TCommandIds |
40 { |
38 { |
41 ECmdAppTest1 = 1, |
39 ECmdAppTest1 = 1, |
42 ECmdView1Cmd1, |
40 ECmdView1Cmd1, |
43 ECmdView1Cmd2, |
41 ECmdView1Cmd2, |
47 ECmdView2Cmd3, |
45 ECmdView2Cmd3, |
48 ECmdView2Cmd4 |
46 ECmdView2Cmd4 |
49 };</codeblock> |
47 };</codeblock> |
50 <p>where</p> |
48 <p>where</p> |
51 <ul> |
49 <ul> |
52 <li><p><parmname>enum</parmname> is the keyword declaration the |
50 <li><p><parmname>enum</parmname> is the keyword declaration |
53 set of integer values. </p> |
51 the set of integer values. </p> |
54 <note> |
52 <note> |
55 <p>Use this keyword for each set of enumerated values you defined.</p> |
53 <p>Use this keyword for each set of enumerated values you defined.</p> |
56 </note> |
54 </note> |
57 </li> |
55 </li> |
58 <li><p><parmname>TCommandIds</parmname> is a label for the list |
56 <li><p><parmname>TCommandIds</parmname> is a label for the |
59 of enumerated values. This label is not used in the code or resource files.</p> |
57 list of enumerated values. This label is not used in the code or resource |
60 </li> |
58 files.</p></li> |
61 <li><p><parmname>ECmdAppTest1</parmname> is a symbol that can be |
59 <li><p><parmname>ECmdAppTest1</parmname> is a symbol that |
62 used in your code or resource files.</p></li> |
60 can be used in your code or resource files.</p></li> |
63 <li><p><parmname>=</parmname> is the operator used for setting the |
61 <li><p><parmname>=</parmname> is the operator used for setting |
64 value to the symbol.</p></li> |
62 the value to the symbol.</p></li> |
65 <li><p><parmname>1</parmname> is the specific value assigned to |
63 <li><p><parmname>1</parmname> is the specific value assigned |
66 the enumerator symbol.</p></li> |
64 to the enumerator symbol.</p></li> |
67 </ul> |
65 </ul> |
68 <p>Each enumerator is followed by a comma (<codeph>,</codeph>) except for |
66 <p>Each enumerator is followed by a comma (<codeph>,</codeph>) |
69 the last value. It is recommended to have a final semi colon (<codeph>;</codeph>) |
67 except for the last value. It is recommended to have a final semi |
70 after the enumerated list. If a specific value is not assigned to a symbol |
68 colon (<codeph>;</codeph>) after the enumerated list. If a specific |
71 in the enumerated list, then the value is that of the previous enumerator |
69 value is not assigned to a symbol in the enumerated list, then the |
72 plus one. Thus, the value for <parmname>ECmdView1Cmd1</parmname> above is |
70 value is that of the previous enumerator plus one. Thus, the value |
73 2.</p> |
71 for <parmname>ECmdView1Cmd1</parmname> above is 2.</p> |
74 <p>For more information about the use of the <parmname>enum</parmname> statement, |
72 <p>For more information about the use of the <parmname>enum</parmname> statement, 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> |
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> |
73 </conbody></concept> |