Beginner Help! creating menu | developer.brewmp.com Beginner Help! creating menu | developer.brewmp.com

Developer

Beginner Help! creating menu

Forums:

Can someone help me get basic menu up and running.

Im currently looking of the example code "expensetracker". I try to comment stuff out only to get more errors. I wrote questions along the way with the function.

static void ET_DisplayMainMenu( CExpenseTrackerApp* pApp )
{
CtlAddItem ai;

// ET_Reset(pApp, TRUE); prefer not to use this, make it as simple as possilbe
// it basicly initializes stuff.

// Set Title
// this gives me trouble, what is " EXPENSETRACKER_RES_FILE"
IMENUCTL_SetTitle( pApp->m_pMenu, EXPENSETRACKER_RES_FILE, IDS_MAIN_MENU, NULL);

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

// Add New
// i have trouble here, what is an IDC (im guessing a String), IDB (object?), IDC
//(string?)
ai.wText = IDC_ADD_NEW;
ai.wImage = IDB_ADD_NEW;
ai.wItemID = IDC_ADD_NEW;

// what else do i need so i can call the function
ET_DisplayMainMenu( CExpenseTrackerApp* pApp )

EXPENSETRACKER_RES_FILE is a resource file.
The BREW Resource Editor allows you to create dialogs, strings, binaries, and objects used in BREW applications.
Resources are useful if you need to create applications that will run on a variety of wireless devices, in different languages.
See the BREW SDK Tools User Docs, included in the documents installed with the BREW SDK Tools.

EXPENSETRACKER_RES_FILE is a resource file.
The BREW Resource Editor allows you to create dialogs, strings, binaries, and objects used in BREW applications.
Resources are useful if you need to create applications that will run on a variety of wireless devices, in different languages.
See the BREW SDK Tools User Docs, included in the documents installed with the BREW SDK Tools.

EXPENSETRACKER_RES_FILE is indicating the app's resource file (use BREW Resource Editor in SDK Tools)...it is the one with extension *.brx, *.brh, *.bar...
it is usually called with YOURAPPNAME_RES_FILE...
IDC_ADD_NEW or IDB_ADD_NEW is the name of the resources contained in the resource file...IDC or IDB is not important, because you can name them anything you want, but in the example they're named so to make it easier...

EXPENSETRACKER_RES_FILE is indicating the app's resource file (use BREW Resource Editor in SDK Tools)...it is the one with extension *.brx, *.brh, *.bar...
it is usually called with YOURAPPNAME_RES_FILE...
IDC_ADD_NEW or IDB_ADD_NEW is the name of the resources contained in the resource file...IDC or IDB is not important, because you can name them anything you want, but in the example they're named so to make it easier...

This is driving me bananas @#%!@#$%^&%$
Im familiar with the Resource Editor, when i try to run this function, at every IMENUCTL mention the debugger pops up.
error message:
Unhandled exception at 0x032d1e46 (myfirstapp.dll) in BREW_Simulator.exe: 0xC0000005: Access violation reading location 0x00000000.
note: this error happens even if i close visual and start it from the simulator. Program runs fine when i dont include following function.
static void ET_DisplayMainMenu( myfirstapp* pApp )
{
CtlAddItem ai;
// ET_Reset(pApp, TRUE);
// Set Title #define MYFIRSTAPP_RES_FILE "myfirstapp.bar"
//IDS_MAIN_MENU = "new menu"
IMENUCTL_SetTitle( pApp->m_pMenu, MYFIRSTAPP_RES_FILE, IDS_MAIN_MENU, NULL);
// Add Items in the Menu
ai.pText = NULL;
ai.pImage = NULL;
ai.pszResImage = ai.pszResText = NULL;
ai.wFont = AEE_FONT_NORMAL;
ai.dwData = 0;
// Add New
ai.wText = IDC_ADD_NEW;
ai.wImage = IDB_ADD_NEW;
ai.wItemID = IDC_ADD_NEW;
IMENUCTL_AddItemEx(pApp->m_pMenu, &ai);
IMENUCTL_SetRect( pApp->m_pMenu, &pApp->m_rScreenRect );
IMENUCTL_SetActive( pApp->m_pMenu, TRUE );
pApp->m_eAppState = APP_STATE_MAIN;
}
I tried include ET_Reset but I found IMENUCTL is where debugger stops at (all of them)
static void ET_Reset(myfirstapp * pApp, boolean bShowTitleBar )
{
// Reset Menu Controls
IMENUCTL_Reset(pApp->m_pMenu);
IMENUCTL_Reset( pApp->m_pList);
IMENUCTL_Reset( pApp->m_pSK);
//
//// End Any Active Dialog
//ISHELL_EndDialog( pApp->a.m_pIShell);
//// Disable Other Controls
IDATECTL_SetActive( pApp->m_pDate, FALSE );
CAMOUNTCTL_SetActive( pApp->m_pAmount, FALSE );
ITEXTCTL_SetActive( pApp->m_pText, FALSE );
IMENUCTL_SetActive( pApp->m_pMenu, FALSE );
//// Release Static Control
//ReleaseObj((void**)&pApp->m_pIStatic);
//// Clear Screen
IDISPLAY_ClearScreen(pApp->a.m_pIDisplay);
//// Draw Banner
//if( bShowTitleBar )
// IIMAGE_Draw(pApp->m_pTitleBarImg, 0, 0);

This is driving me bananas @#%!@#$%^&%$
Im familiar with the Resource Editor, when i try to run this function, at every IMENUCTL mention the debugger pops up.
error message:
Unhandled exception at 0x032d1e46 (myfirstapp.dll) in BREW_Simulator.exe: 0xC0000005: Access violation reading location 0x00000000.
note: this error happens even if i close visual and start it from the simulator. Program runs fine when i dont include following function.
static void ET_DisplayMainMenu( myfirstapp* pApp )
{
CtlAddItem ai;
// ET_Reset(pApp, TRUE);
// Set Title #define MYFIRSTAPP_RES_FILE "myfirstapp.bar"
//IDS_MAIN_MENU = "new menu"
IMENUCTL_SetTitle( pApp->m_pMenu, MYFIRSTAPP_RES_FILE, IDS_MAIN_MENU, NULL);
// Add Items in the Menu
ai.pText = NULL;
ai.pImage = NULL;
ai.pszResImage = ai.pszResText = NULL;
ai.wFont = AEE_FONT_NORMAL;
ai.dwData = 0;
// Add New
ai.wText = IDC_ADD_NEW;
ai.wImage = IDB_ADD_NEW;
ai.wItemID = IDC_ADD_NEW;
IMENUCTL_AddItemEx(pApp->m_pMenu, &ai);
IMENUCTL_SetRect( pApp->m_pMenu, &pApp->m_rScreenRect );
IMENUCTL_SetActive( pApp->m_pMenu, TRUE );
pApp->m_eAppState = APP_STATE_MAIN;
}
I tried include ET_Reset but I found IMENUCTL is where debugger stops at (all of them)
static void ET_Reset(myfirstapp * pApp, boolean bShowTitleBar )
{
// Reset Menu Controls
IMENUCTL_Reset(pApp->m_pMenu);
IMENUCTL_Reset( pApp->m_pList);
IMENUCTL_Reset( pApp->m_pSK);
//
//// End Any Active Dialog
//ISHELL_EndDialog( pApp->a.m_pIShell);
//// Disable Other Controls
IDATECTL_SetActive( pApp->m_pDate, FALSE );
CAMOUNTCTL_SetActive( pApp->m_pAmount, FALSE );
ITEXTCTL_SetActive( pApp->m_pText, FALSE );
IMENUCTL_SetActive( pApp->m_pMenu, FALSE );
//// Release Static Control
//ReleaseObj((void**)&pApp->m_pIStatic);
//// Clear Screen
IDISPLAY_ClearScreen(pApp->a.m_pIDisplay);
//// Draw Banner
//if( bShowTitleBar )
// IIMAGE_Draw(pApp->m_pTitleBarImg, 0, 0);

got a non working menu up! making a littel progress :-)
void GUITEST_BuildMainMenu(myfirstapp* pApp)
{
//create the menu
ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_MENUCTL, (void **)&pApp->pIMenu);
//set up the menu
IMENUCTL_SetTitle(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDS_MAIN_MENU, NULL);
IMENUCTL_SetRect(pApp->pIMenu, NULL); //full-screen
//Add in our menu items
IMENUCTL_AddItem(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDC_ADD_NEW, MENUID_STATIC, NULL, 0);
IMENUCTL_AddItem(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDC_ADD_NEW, MENUID_TEXT, NULL, 0);
IMENUCTL_AddItem(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDC_ADD_NEW, MENUID_DATE, NULL, 0);
IMENUCTL_AddItem(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDC_ADD_NEW, MENUID_TIME, NULL, 0);
IMENUCTL_AddItem(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDC_ADD_NEW, MENUID_DIALOG, NULL, 0);
IMENUCTL_SetActive(pApp->pIMenu,TRUE);

ITimeCtl * pClock;
ITextCtl * pText;
myfirstapp * pApp = (myfirstapp *)pi;
AEEApplet * Me = &pApp->a;
switch (eCode)
{
// App is told it is starting up
case EVT_APP_START:
// Add your code here...
//myfirstapp_DrawScreen(pMe);
ISHELL_GetDeviceInfo (Me->m_pIShell, &pApp->DeviceInfo);
IDISPLAY_ClearScreen (Me->m_pIDisplay);
pApp->pIDate = NULL;
pApp->pIMenu = NULL;
pApp->pIStatic = NULL;
pApp->pIText = NULL;
pApp->pITime = NULL;
pApp->pIDialog = FALSE;
GUITEST_BuildMainMenu(pApp);
return(TRUE);

got a non working menu up! making a littel progress :-)
void GUITEST_BuildMainMenu(myfirstapp* pApp)
{
//create the menu
ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_MENUCTL, (void **)&pApp->pIMenu);
//set up the menu
IMENUCTL_SetTitle(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDS_MAIN_MENU, NULL);
IMENUCTL_SetRect(pApp->pIMenu, NULL); //full-screen
//Add in our menu items
IMENUCTL_AddItem(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDC_ADD_NEW, MENUID_STATIC, NULL, 0);
IMENUCTL_AddItem(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDC_ADD_NEW, MENUID_TEXT, NULL, 0);
IMENUCTL_AddItem(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDC_ADD_NEW, MENUID_DATE, NULL, 0);
IMENUCTL_AddItem(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDC_ADD_NEW, MENUID_TIME, NULL, 0);
IMENUCTL_AddItem(pApp->pIMenu, MYFIRSTAPP_RES_FILE, IDC_ADD_NEW, MENUID_DIALOG, NULL, 0);
IMENUCTL_SetActive(pApp->pIMenu,TRUE);

ITimeCtl * pClock;
ITextCtl * pText;
myfirstapp * pApp = (myfirstapp *)pi;
AEEApplet * Me = &pApp->a;
switch (eCode)
{
// App is told it is starting up
case EVT_APP_START:
// Add your code here...
//myfirstapp_DrawScreen(pMe);
ISHELL_GetDeviceInfo (Me->m_pIShell, &pApp->DeviceInfo);
IDISPLAY_ClearScreen (Me->m_pIDisplay);
pApp->pIDate = NULL;
pApp->pIMenu = NULL;
pApp->pIStatic = NULL;
pApp->pIText = NULL;
pApp->pITime = NULL;
pApp->pIDialog = FALSE;
GUITEST_BuildMainMenu(pApp);
return(TRUE);