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