Creating resource header files

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:

These enumerated values need to be defined in a resource file, which by convention has the extension hrh, The syntax is as follows:

enum TCommandIds
    {
    ECmdAppTest1 = 1,
    ECmdView1Cmd1,
    ECmdView1Cmd2,
    ECmdView1Cmd3,
    ECmdView2Cmd1,
    ECmdView2Cmd2,
    ECmdView2Cmd3,
    ECmdView2Cmd4
    };

where

Each enumerator is followed by a ,, except for the last value. It is recommended to have a final ; 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 ECmdView1Cmd1 above is 2.

For more information about the use of the enum statement, see ENUM statement in the Symbian OS Library.