----- Original Message ----- 
From: "Chris Hall" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Monday, April 05, 2004 8:46 AM
Subject: PilRC resouce assignment duplication


> I am creating a form using PilRC. My form is called MainForm and it has
two
> buttons, MainOrderEntryButton and MainCommunicationsButton.
>
> I have a MenuBar named MainFormMenuBar attached to the MainForm.  The Menu
> Bar has two Pulldown menus. The first is titled Configuration with two
> Menuitems, IDs=ConfigurationUser and ConfigurationSystem.  The second has
> one Menuitem, ID=OptionsAboutMerchandising.
>
> The autogenerated PilRC header file is creating these resources as
follows:
> #define MainForm 1001
> #define MainOrderEntryButton 1002
> #define MainCommunicationsButton 1003
> #define ConfigurationUser 1001
> #define ConfigurationSystem 1002
> #define OptionsAboutMerchandising 1003
>
> In my MainFormDoCommand routine, I check for
> case OptionsAboutMerchandising, case MainOrderEntryButton and case
> MainCommunicationsButton.
> When I compile this, I get:
>         Error   : case constant defined more than once  Main.c Line 56
> case MainCommunicationsButton.
>
> I would guess that I am getting this error because
MainCommunicationsButton
> and OptionsAbout Merchandising are defined with value 1003.  This is
> autogenerated.... why are they getting assigned the same value?  I
shouldn't
> be manually editing this file, should I?  What am I doing wrong?


I think it is because those items are of different contexts : one in a form,
and one in a menu. AFAIK, all objects inside a form/menu ... will have
different ids, not between forms/menu ... .

I guess you have the MainFormDoCommand to process all button and menu
events.

How about separating it into two different functions : one to process menu
commands , one to process button ones ?

Like:

    case menuEvent:
        return MainFormDoMenuCommand( (pEvent->data.menu.itemID);
    case ctlSelect :
        return MainFormDoButtonCommand(pEvent->data.ctlSelect.controlID);

Vu



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to