Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi All,
I tried to create menu using IMenuCtl. Here are the steps I tried to create menu item.

1.Declared IMenuCtl in Struct;
IMenuCtl * pIMenu;

2.I declared Function and called it from EVT_APP_START.
GUITEST_BuildMainMenu(Controls* pMe)

Code in above function:

CtlAddItem ai;

ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MENUCTL, (void**)(&pMe->pIMenu));

//set up the menu
IMENUCTL_SetTitle(pMe->pIMenu,CONTROLS_RES_FILE,IDS_TITLE, NULL);
IMENUCTL_SetRect(pMe->pIMenu, NULL); //full-screen

// Add Items in the Menu
ai.pText = NULL;
ai.pImage = NULL;
ai.pszResImage = ai.pszResText = CONTROLS_RES_FILE;
ai.wFont = AEE_FONT_NORMAL;
ai.dwData = 0;

// Static
ai.wText = IDC_STATIC;
ai.wItemID = IDC_STATIC;

IMENUCTL_AddItemEx(pMe->pIMenu, &ai);

IMENUCTL_SetActive(pMe->pIMenu,TRUE);

As I added one item with name "static" but I see only plain grey screen.Whats the problem can I know.As I new to BREW i started from follwoing link for controls draw.

http://www.cpp-applied.info/Wordware-Wireless.Game.Development.in.C.CPP.with.BREW/5787final/LiB0076.html

Please help me here.

You are adding item from the resource file. do you have .bar file at proper place (along with dll for simulator)?

You are adding item from the resource file. do you have .bar file at proper place (along with dll for simulator)?

I think resource file in correct place,Because I tried to draw string from resource file which I did succesfully.
Can u tell me where exactly I need to place .bar file so I can draw item in menu.

I think resource file in correct place,Because I tried to draw string from resource file which I did succesfully.
Can u tell me where exactly I need to place .bar file so I can draw item in menu.

Your code looks ok...only problem cold be adding item. .bar should be with .dll file.
something like this is working for me:
IMENUCTL_SetTitle(pMe->pIMenu, MYAPP_RES_FILE, IDS_MAIN_MENU, NULL);
IMENUCTL_SetRect(pMe->pIMenu, NULL);
IMENUCTL_AddItem(pMe->pIMenu, MYAPP_RES_FILE, IDS_FLASH_TEXT,
IDS_FLASH_TEXT, NULL,
IMENUCTL_SetActive(pMe->pIMenu, TRUE);

Your code looks ok...only problem cold be adding item. .bar should be with .dll file.
something like this is working for me:
IMENUCTL_SetTitle(pMe->pIMenu, MYAPP_RES_FILE, IDS_MAIN_MENU, NULL);
IMENUCTL_SetRect(pMe->pIMenu, NULL);
IMENUCTL_AddItem(pMe->pIMenu, MYAPP_RES_FILE, IDS_FLASH_TEXT,
IDS_FLASH_TEXT, NULL,
IMENUCTL_SetActive(pMe->pIMenu, TRUE);

Hi adhudase,
I really thankfull to you,For u r quick response.So how can I keep bar file in correct path or where can I check is my .bar in correct path with .dll file.Is there any other way to add ITEM to menu other then .bar file.Please let me know.

Hi adhudase,
I really thankfull to you,For u r quick response.So how can I keep bar file in correct path or where can I check is my .bar in correct path with .dll file.Is there any other way to add ITEM to menu other then .bar file.Please let me know.

root\app\app.dll, app.bar
root\app.mif
running simulator thru root.
See example above...you can use AddItem instead of AddItemEx.

root\app\app.dll, app.bar
root\app.mif
running simulator thru root.
See example above...you can use AddItem instead of AddItemEx.

Hi,
Ya my .dll and .bar in same folder and .mif file is outside my project folder.As u said additem problem is due to .bar file only.Because again I tried to display string from resource file so I cant drae string.So how to over come this type of error..because after setting .bar and .dll file in correct path I cant see ITEM added to my menu.

Hi,
Ya my .dll and .bar in same folder and .mif file is outside my project folder.As u said additem problem is due to .bar file only.Because again I tried to display string from resource file so I cant drae string.So how to over come this type of error..because after setting .bar and .dll file in correct path I cant see ITEM added to my menu.

Is it possible for you to share code, brx files?

Is it possible for you to share code, brx files?

Iam facing that problem when I created new sample application and tried to draw string from resource file.I unable to draw string.Why so?

Iam facing that problem when I created new sample application and tried to draw string from resource file.I unable to draw string.Why so?