Not able to display previous screen | developer.brewmp.com Not able to display previous screen | developer.brewmp.com

Developer

Not able to display previous screen

Hi
I have created 2 forms.Form one form's soft key i push another form'd pointer to rootform using IRootForm_Push api.The second one is displaying properly.But i can not goback to the previous screen using Pop api or Remove api.When ever i Call IRootForm_PopForm it again and again call the handle event function.

I feel very helpless as i spend 2 days on it.Please someone help me.I can not figure out what's the reason.
Please Help me

:(

Hi,
try with this
in your main application hanler just check for root form handler
if(IROOTFORM_HandleEvent(pMe->pIRootForm, eCode, wParam, dwParam))
{
DBGPRINTF("In application handler..................");
return TRUE;

and in your second form handler use IROOTFORM_Pop().
and at last return HANDLERDESC_Call(....);

Hi,
try with this
in your main application hanler just check for root form handler
if(IROOTFORM_HandleEvent(pMe->pIRootForm, eCode, wParam, dwParam))
{
DBGPRINTF("In application handler..................");
return TRUE;

and in your second form handler use IROOTFORM_Pop().
and at last return HANDLERDESC_Call(....);

Thanks for ur reply.I am still facing problem.
Here i want to share my code ....can i please tell me what's wrong i have done
// Create form 1
CreateForm1(Application4* pMe)
{
if(SUCCESS != ISHELL_CreateInstance(pMe->pIShell,AEECLSID_Form,(void**)&pMe->pForm1))
{
DBGPRINTF("Form1 not created..");
return AEE_EFAILED;
}
if(CreateSoftkeysForForm1(pMe) != AEE_SUCCESS)
{
return AEE_EFAILED;
}
if(CreateTitleBarForForm1(pMe) != AEE_SUCCESS )
{
return AEE_EFAILED;
}
if(CreateFormContents(pMe) != AEE_SUCCESS)
{
return AEE_EFAILED;
}
if(CreateListMenuForm1(pMe) != AEE_SUCCESS)
{
return AEE_EFAILED;
}
IRootForm_PushForm(pMe->pRootForm,pMe->pForm1);
//Set the handle event for form1
pMe->HanDescripter.pCxt = pMe;
pMe->HanDescripter.pfn = From1_EventHandler;
pMe->HanDescripter.pfnFree = NULL;
IForm_SetHandler(pMe->pForm1, &pMe->HanDescripter);
return AEE_SUCCESS;

// Form1 event handler
boolean From1_EventHandler(void *pCxt, AEEEvent evt, uint16 wParam, uint32 dwParam)
{
Application4* pMe = (Application4*)pCxt;
if( pMe->pActionMenu == NULL && TRUE == MessageListHandler(pMe,evt,wParam,dwParam))
{
return TRUE;
}
if(pMe->pActionMenu && IWidget_IsVisible(pMe->pActionMenu))
{
//return IWidget_HandleEvent(pMe->pActionMenu,evt,wParam,dwParam);
return ActionmenuHandler(pMe,evt,wParam,dwParam);
}
switch(evt)
{
case EVT_KEY:
{
switch(wParam)
{
case AVK_SOFT1:
if(pMe->pActionMenu)
{
IWIDGET_SetVisible(pMe->pActionMenu,FALSE);
}
if(pMe->pForm1 && pMe->pRootForm)
{
if(AEE_SUCCESS == CreatePopUpForExit(pMe))
{
IRootForm_InsertForm(pMe->pRootForm,pMe->pPopUpForm,FORM_LAST);
}
}
return TRUE;
case AVK_SOFT2:
if( pMe->pActionMenu == NULL)
CreateMainMenu(pMe);
else
ReleseMainMenu(pMe);
// return CreateFormToCreateNewMessege(pMe);
return TRUE;
}
}
break;
}
return HANDLERDESC_CALL(&pMe->HanDescripter,evt,wParam,dwParam);

//I opend a menu and on clik i create another form
boolean CreateFormToCreateNewMessege(Application4* pMe)
{
HandlerDesc NewMessegeFormHandDes;
if(pMe->pNewMessegeForm == NULL)
{
if(ISHELL_CreateInstance(pMe->pIShell,AEECLSID_Form,(void**)&pMe->pNewMessegeForm))
{
DBGPRINTF("Form Not created");
return AEE_EFAILED;
}
.........................
Create all insta and set prop
.......................
// Set the form handler
if(IRootForm_GetTopForm(pMe->pRootForm) == pMe->pForm1)
{
IForm_PopSelf(pMe->pForm1);
IRootForm_PushForm(pMe->pRootForm,pMe->pNewMessegeForm);
HANDLERDESC_INIT(&pMe->handleMenuForm,NewMessegeForm_EventHandler, pMe, NULL );
IForm_SetHandler( pMe->pNewMessegeForm, &pMe->handleMenuForm );
}
// handle event fundtion for form2
boolean NewMessegeForm_EventHandler(void *pCxt, AEEEvent evt, uint16 wParam, uint32 dwParam)
{
int iResult = FALSE;
Application4* pMe = (Application4*)pCxt;
DBGPRINTF("messege......");
switch(evt)
{
case EVT_KEY:
{
switch(wParam)
{
case AVK_SOFT2:
{
DBGPRINTF("Handle event is call");
if(pMe->pNewMessegeForm == IRootForm_GetTopForm(pMe->pRootForm))
{
IForm_PopSelf(pMe->pNewMessegeForm);
DBGPRINTF("Return ");
CreateForm1(pMe);
}
}
return AEE_SUCCESS;
case AVK_SOFT1:
{
ISHELL_CloseApplet(pMe->pIShell,FALSE);
}
return AEE_SUCCESS;
default:
return HANDLERDESC_CALL(&pMe->handleMenuForm,evt,wParam,dwParam);
break;
}
break;
default:
return HANDLERDESC_CALL(&pMe->handleMenuForm,evt,wParam,dwParam);
break;
}
}
return AEE_SUCCESS;
}
}
return AEE_SUCCESS;

/// Problem is that if i clik soft key 2 than only title and softkey area is display with out any context.I i press any key that DBGPRINTF of form1's event handler is call.Screen is not updated accrodingly..
Can u please figure out whats the problem
Please help me....
Thank again

Thanks for ur reply.I am still facing problem.
Here i want to share my code ....can i please tell me what's wrong i have done
// Create form 1
CreateForm1(Application4* pMe)
{
if(SUCCESS != ISHELL_CreateInstance(pMe->pIShell,AEECLSID_Form,(void**)&pMe->pForm1))
{
DBGPRINTF("Form1 not created..");
return AEE_EFAILED;
}
if(CreateSoftkeysForForm1(pMe) != AEE_SUCCESS)
{
return AEE_EFAILED;
}
if(CreateTitleBarForForm1(pMe) != AEE_SUCCESS )
{
return AEE_EFAILED;
}
if(CreateFormContents(pMe) != AEE_SUCCESS)
{
return AEE_EFAILED;
}
if(CreateListMenuForm1(pMe) != AEE_SUCCESS)
{
return AEE_EFAILED;
}
IRootForm_PushForm(pMe->pRootForm,pMe->pForm1);
//Set the handle event for form1
pMe->HanDescripter.pCxt = pMe;
pMe->HanDescripter.pfn = From1_EventHandler;
pMe->HanDescripter.pfnFree = NULL;
IForm_SetHandler(pMe->pForm1, &pMe->HanDescripter);
return AEE_SUCCESS;

// Form1 event handler
boolean From1_EventHandler(void *pCxt, AEEEvent evt, uint16 wParam, uint32 dwParam)
{
Application4* pMe = (Application4*)pCxt;
if( pMe->pActionMenu == NULL && TRUE == MessageListHandler(pMe,evt,wParam,dwParam))
{
return TRUE;
}
if(pMe->pActionMenu && IWidget_IsVisible(pMe->pActionMenu))
{
//return IWidget_HandleEvent(pMe->pActionMenu,evt,wParam,dwParam);
return ActionmenuHandler(pMe,evt,wParam,dwParam);
}
switch(evt)
{
case EVT_KEY:
{
switch(wParam)
{
case AVK_SOFT1:
if(pMe->pActionMenu)
{
IWIDGET_SetVisible(pMe->pActionMenu,FALSE);
}
if(pMe->pForm1 && pMe->pRootForm)
{
if(AEE_SUCCESS == CreatePopUpForExit(pMe))
{
IRootForm_InsertForm(pMe->pRootForm,pMe->pPopUpForm,FORM_LAST);
}
}
return TRUE;
case AVK_SOFT2:
if( pMe->pActionMenu == NULL)
CreateMainMenu(pMe);
else
ReleseMainMenu(pMe);
// return CreateFormToCreateNewMessege(pMe);
return TRUE;
}
}
break;
}
return HANDLERDESC_CALL(&pMe->HanDescripter,evt,wParam,dwParam);

//I opend a menu and on clik i create another form
boolean CreateFormToCreateNewMessege(Application4* pMe)
{
HandlerDesc NewMessegeFormHandDes;
if(pMe->pNewMessegeForm == NULL)
{
if(ISHELL_CreateInstance(pMe->pIShell,AEECLSID_Form,(void**)&pMe->pNewMessegeForm))
{
DBGPRINTF("Form Not created");
return AEE_EFAILED;
}
.........................
Create all insta and set prop
.......................
// Set the form handler
if(IRootForm_GetTopForm(pMe->pRootForm) == pMe->pForm1)
{
IForm_PopSelf(pMe->pForm1);
IRootForm_PushForm(pMe->pRootForm,pMe->pNewMessegeForm);
HANDLERDESC_INIT(&pMe->handleMenuForm,NewMessegeForm_EventHandler, pMe, NULL );
IForm_SetHandler( pMe->pNewMessegeForm, &pMe->handleMenuForm );
}
// handle event fundtion for form2
boolean NewMessegeForm_EventHandler(void *pCxt, AEEEvent evt, uint16 wParam, uint32 dwParam)
{
int iResult = FALSE;
Application4* pMe = (Application4*)pCxt;
DBGPRINTF("messege......");
switch(evt)
{
case EVT_KEY:
{
switch(wParam)
{
case AVK_SOFT2:
{
DBGPRINTF("Handle event is call");
if(pMe->pNewMessegeForm == IRootForm_GetTopForm(pMe->pRootForm))
{
IForm_PopSelf(pMe->pNewMessegeForm);
DBGPRINTF("Return ");
CreateForm1(pMe);
}
}
return AEE_SUCCESS;
case AVK_SOFT1:
{
ISHELL_CloseApplet(pMe->pIShell,FALSE);
}
return AEE_SUCCESS;
default:
return HANDLERDESC_CALL(&pMe->handleMenuForm,evt,wParam,dwParam);
break;
}
break;
default:
return HANDLERDESC_CALL(&pMe->handleMenuForm,evt,wParam,dwParam);
break;
}
}
return AEE_SUCCESS;
}
}
return AEE_SUCCESS;

/// Problem is that if i clik soft key 2 than only title and softkey area is display with out any context.I i press any key that DBGPRINTF of form1's event handler is call.Screen is not updated accrodingly..
Can u please figure out whats the problem
Please help me....
Thank again

Why are you popping form1 when you create the new form? Why not just leave it on the form stack? That way you don't have to recreate it every time.
-Erik

Why are you popping form1 when you create the new form? Why not just leave it on the form stack? That way you don't have to recreate it every time.
-Erik

Thanks for the reply..
I have commented the createform1() function in form2's handle event and not poping the form1 when form2 is inserted.Still i got the same problem.I have attached the screen shots.Hopefully it will help.Please help me...
One think i have noticed that DBGPRINTF statments of form's handle eventt fuction are called properly....Only form1 is not dislaying in correct way.

Thanks for the reply..
I have commented the createform1() function in form2's handle event and not poping the form1 when form2 is inserted.Still i got the same problem.I have attached the screen shots.Hopefully it will help.Please help me...
One think i have noticed that DBGPRINTF statments of form's handle eventt fuction are called properly....Only form1 is not dislaying in correct way.