Symbian3/PDK/Source/GUID-D52E98C3-F5EE-4CE1-A4F5-2EF41A066B8A.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Fri, 22 Jan 2010 18:26:19 +0000
changeset 1 25a17d01db0c
child 5 f345bda72bc4
permissions -rw-r--r--
Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
	Nokia Corporation - initial contribution.
Contributors: 
-->  <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"><concept id="GUID-D52E98C3-F5EE-4CE1-A4F5-2EF41A066B8A" xml:lang="en"><title>Creating
resource header files</title><prolog><metadata><keywords></keywords></metadata></prolog><conbody>
<p>Typically when you create an application, there are cases where you
need to create an enumerated set of command IDs (which are symbols with integer
values). These defined symbols can then be used in both your code and resource
files. Common examples of these cases, include:</p>
<ul>
<li><p>Custom command IDs used for mapping mobile device user input
based upon <parmname>Options</parmname> menu selections to command handling.
These custom command IDs are mapped to the text displayed for the command
in the <parmname>Options</parmname> menu in resource files, and then are passed
back to the application by the application framework.</p></li>
<li><p>Control IDs in dialogs to allow references to the dialog
controls from C++ code.</p>
<itemgroup>
<p>For more information on control IDs for dialogs, see Using Dialogs API.</p>
</itemgroup>
</li>
<li><p>Application view IDs. Note that these could also be enumerated
in the header files for the views.</p></li>
<li><p>IDs for other resource structures, such as for <parmname>TABS</parmname> in
the status pane.</p></li>
</ul>
<p>These enumerated values need to be defined in a resource file, which
by convention has the extension <parmname>hrh</parmname>, The syntax is as
follows:</p>
<codeblock xml:space="preserve" id="GUID-2CDD719A-48CA-47EF-A737-7CCB62DF6FC6">enum TCommandIds
    {
    ECmdAppTest1 = 1,
    ECmdView1Cmd1,
    ECmdView1Cmd2,
    ECmdView1Cmd3,
    ECmdView2Cmd1,
    ECmdView2Cmd2,
    ECmdView2Cmd3,
    ECmdView2Cmd4
    };</codeblock>
<p>where</p>
<ul>
<li><p><parmname>enum</parmname> is the keyword declaration the
set of integer values. Note that you would use this keyword for each set of
enumerated values you defined.</p></li>
<li><p><parmname>TCommandIds</parmname> is a label for the list
of enumerated values. This label is not used in the code or resource files.</p>
</li>
<li><p><parmname>ECmdAppTest1</parmname> is a symbol that can be
used in your code or resource files</p></li>
<li><p><parmname>=</parmname> is the operator used for setting the
value to the symbol</p></li>
<li><p><parmname>1</parmname> is the specific value assigned to
the enumerator symbol</p></li>
</ul>
<p>Each enumerator is followed by a <parmname>,</parmname>, except for
the last value. It is recommended to have a final <parmname>;</parmname> after
the enumerated list. If a specific value is not assigned to a symbol in the
enumerated list, then the value is that of the previous enumerator plus one.
Thus, the value for <parmname>ECmdView1Cmd1</parmname> above is 2.</p>
<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>
</conbody></concept>