How can I insert XYContainer and PropContainer in same Form | developer.brewmp.com How can I insert XYContainer and PropContainer in same Form | developer.brewmp.com

Developer

How can I insert XYContainer and PropContainer in same Form

Forums:

If I would like to eidt screen like phone Idle, in my idea is create a XYContainer for status bar for RSSI and battery and PropContainer for desktop information(PLMN, CB, or etc...)

How can I insert two container in same container, ConstraintContainer or RootContainer

Containers can contain more than one child. Just call _Insert() twice.

Containers can contain more than one child. Just call _Insert() twice.

I would like to add XYContainer and IPropContainer into IRootContainer and code like below
-----------------------------------------------------------------------------------------------------
int MainScrDisplay(MultiApp *pMe)
{
IRootContainer* pRootContainer;
IPropContainer* pPropContainer;
IXYContainer* pXYContainer;
IImage *pImageRSSI;
IImage *pImageBAT;
IWidget *pContainerWidget = NULL;
IWidget *pRSSI = NULL;
IWidget *pBAT = NULL;
IWidget *pContain = NULL;
IWidget *pTitle = NULL;
WidgetPos dwpos = {0};
WidgetProp wp = {0};
int result = 0;
result = ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_RootContainer, (void**) &pRootContainer);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_PropContainer, (void**) &pPropContainer);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_XYContainer, (void**) &pXYContainer);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_TextWidget, (void**) &pTitle);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_TextWidget, (void**) &pContain);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_ImageWidget, (void**) &pRSSI);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_ImageWidget, (void**) &pBAT);
if (result != SUCCESS)
return result;
pImageRSSI = ISHELL_LoadResImage(pMe->a.m_pIShell, MULTIAPP_RES_FILE, RSSI_0);
pImageBAT = ISHELL_LoadResImage(pMe->a.m_pIShell, MULTIAPP_RES_FILE, BATTERY_0);
IWidget_SetImage(pRSSI, pImageRSSI);
IWidget_SetImage(pBAT, pImageBAT);
dwpos.x = 0;
dwpos.y = 0;
dwpos.bVisible = TRUE;
IXYContainer_Insert(pXYContainer, pRSSI, WIDGET_ZNORMAL,&dwpos);
dwpos.x = pMe->DeviceInfo.cxScreen - 20;
dwpos.y = 0;
dwpos.bVisible = TRUE;
IXYContainer_Insert(pXYContainer, pBAT, WIDGET_ZNORMAL,&dwpos);
wp.prop = 12;
wp.bVisible = TRUE;
IWIDGET_SetTextWidgetText(pTitle,L"Taital bar");
result =+ IPropContainer_Insert(pPropContainer, pTitle, WIDGET_ZNORMAL, &wp);
wp.prop = 16;
wp.bVisible = TRUE;
IWIDGET_SetTextWidgetText(pContain,L"Contain bar");
wp.prop = 50;
wp.bVisible = TRUE;
result =+ IPropContainer_Insert(pPropContainer, pContain, WIDGET_ZNORMAL, &wp);
if (result != SUCCESS)
return result;
IQI_RELEASEIF(pRSSI);
IQI_RELEASEIF(pBAT);
IQI_RELEASEIF(pContain);
dwpos.x = 0;
dwpos.y = 0;
dwpos.bVisible = TRUE;
result =+ IRootContainer_Insert(pRootContainer, (IWidget *)pXYContainer, WIDGET_ZNORMAL, &dwpos);
dwpos.x = 0;
dwpos.y = 40;
dwpos.bVisible = TRUE;
result =+ IRootContainer_Insert(pRootContainer, (IWidget *)pPropContainer, WIDGET_ZNORMAL, &dwpos);
result =+ IRootContainer_QueryInterface(pRootContainer, AEEIID_WIDGET, (void**)&pContainerWidget);
if(result ==0)
{
IForm_SetWidget(pMe->pForm, WID_FORM, pContainerWidget);
IQI_RELEASEIF(pXYContainer);
IQI_RELEASEIF(pPropContainer);
}
return result;

-----------------------------------------------------------------------------------------------------
Why conpile error when
result =+ IRootContainer_Insert(pRootContainer, (IWidget *)pXYContainer, WIDGET_ZNORMAL, &dwpos);
Please help and let me know how to display more then one container on same screen, thanks a lot.

I would like to add XYContainer and IPropContainer into IRootContainer and code like below
-----------------------------------------------------------------------------------------------------
int MainScrDisplay(MultiApp *pMe)
{
IRootContainer* pRootContainer;
IPropContainer* pPropContainer;
IXYContainer* pXYContainer;
IImage *pImageRSSI;
IImage *pImageBAT;
IWidget *pContainerWidget = NULL;
IWidget *pRSSI = NULL;
IWidget *pBAT = NULL;
IWidget *pContain = NULL;
IWidget *pTitle = NULL;
WidgetPos dwpos = {0};
WidgetProp wp = {0};
int result = 0;
result = ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_RootContainer, (void**) &pRootContainer);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_PropContainer, (void**) &pPropContainer);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_XYContainer, (void**) &pXYContainer);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_TextWidget, (void**) &pTitle);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_TextWidget, (void**) &pContain);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_ImageWidget, (void**) &pRSSI);
result =+ ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_ImageWidget, (void**) &pBAT);
if (result != SUCCESS)
return result;
pImageRSSI = ISHELL_LoadResImage(pMe->a.m_pIShell, MULTIAPP_RES_FILE, RSSI_0);
pImageBAT = ISHELL_LoadResImage(pMe->a.m_pIShell, MULTIAPP_RES_FILE, BATTERY_0);
IWidget_SetImage(pRSSI, pImageRSSI);
IWidget_SetImage(pBAT, pImageBAT);
dwpos.x = 0;
dwpos.y = 0;
dwpos.bVisible = TRUE;
IXYContainer_Insert(pXYContainer, pRSSI, WIDGET_ZNORMAL,&dwpos);
dwpos.x = pMe->DeviceInfo.cxScreen - 20;
dwpos.y = 0;
dwpos.bVisible = TRUE;
IXYContainer_Insert(pXYContainer, pBAT, WIDGET_ZNORMAL,&dwpos);
wp.prop = 12;
wp.bVisible = TRUE;
IWIDGET_SetTextWidgetText(pTitle,L"Taital bar");
result =+ IPropContainer_Insert(pPropContainer, pTitle, WIDGET_ZNORMAL, &wp);
wp.prop = 16;
wp.bVisible = TRUE;
IWIDGET_SetTextWidgetText(pContain,L"Contain bar");
wp.prop = 50;
wp.bVisible = TRUE;
result =+ IPropContainer_Insert(pPropContainer, pContain, WIDGET_ZNORMAL, &wp);
if (result != SUCCESS)
return result;
IQI_RELEASEIF(pRSSI);
IQI_RELEASEIF(pBAT);
IQI_RELEASEIF(pContain);
dwpos.x = 0;
dwpos.y = 0;
dwpos.bVisible = TRUE;
result =+ IRootContainer_Insert(pRootContainer, (IWidget *)pXYContainer, WIDGET_ZNORMAL, &dwpos);
dwpos.x = 0;
dwpos.y = 40;
dwpos.bVisible = TRUE;
result =+ IRootContainer_Insert(pRootContainer, (IWidget *)pPropContainer, WIDGET_ZNORMAL, &dwpos);
result =+ IRootContainer_QueryInterface(pRootContainer, AEEIID_WIDGET, (void**)&pContainerWidget);
if(result ==0)
{
IForm_SetWidget(pMe->pForm, WID_FORM, pContainerWidget);
IQI_RELEASEIF(pXYContainer);
IQI_RELEASEIF(pPropContainer);
}
return result;

-----------------------------------------------------------------------------------------------------
Why conpile error when
result =+ IRootContainer_Insert(pRootContainer, (IWidget *)pXYContainer, WIDGET_ZNORMAL, &dwpos);
Please help and let me know how to display more then one container on same screen, thanks a lot.

You cannot cast containers to widgets. You must query the container for the widget interface:
IWidget *pXYContWidget;
IXYCONTAINER_QueryInterface(pXYContainer, AEEIID_IWidget, (void**) &pXYContWidget);
result =+ IRootContainer_Insert(pRootContainer, pXYContWidget, WIDGET_ZNORMAL, &dwpos);

You cannot cast containers to widgets. You must query the container for the widget interface:
IWidget *pXYContWidget;
IXYCONTAINER_QueryInterface(pXYContainer, AEEIID_IWidget, (void**) &pXYContWidget);
result =+ IRootContainer_Insert(pRootContainer, pXYContWidget, WIDGET_ZNORMAL, &dwpos);

Thanks for your reply

Thanks for your reply