How to Display Different Widget in Tabs using same container??? | developer.brewmp.com How to Display Different Widget in Tabs using same container??? | developer.brewmp.com

Developer

How to Display Different Widget in Tabs using same container???

Forums:

Hi,

 

 

I'm creating tab widget application, in that tabs are displaying properly but for the respective tabs i have to display different widgets like List,static,date and time, For First tab time widget is displaying properly but for other tabs widgets taking full screen and tabs dissappearing.. please help me...

 

Note: I'm currently handling for only second tab.

 

here is the snippet

 

In structure i declared this IWidget    **Temp_container;

nErr = ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_RootContainer, (void**)&pMe->m_pRootCont); nErr = IRootContainer_QueryInterface(pMe->m_pRootCont, AEEIID_IWidget,(void**)&pMe->m_pRootContWgt);

 ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_TabWidget, (void**)&pMe->m_pTabWidget);     nErr = ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_JulianTimeWidget, (void**)&pMe->piTimeWidget);

AEEResult tabwidget_DrawTabs(tabwidget* pMe){        ImageStaticInfo *var;    int i=0;    boolean bIsJulianType;    AEEDateTime type;    WidgetExtent we;    WidgetPos wpos;    WidgetExtent extent;    int res;

    IWidget_SetPadding(pMe->m_pRootContWgt, 0);       IWidget_SetActiveBorderWidth(pMe->m_pRootContWgt, 2);       IWidget_SetInactiveBorderWidth(pMe->m_pTabWidget, 2);       IWidget_SetInactiveBorderColor(pMe->m_pRootContWgt, MAKE_RGBA(0x7B,0x7D,0xA5,255));       IWidget_SetActiveBorderColor(pMe->m_pRootContWgt, MAKE_RGBA(0x7B,0x7D,0xA5,255));       IWidget_SetInactiveBGColor(pMe->m_pRootContWgt, MAKE_RGBA(0xFF,0xff,0xFF,255));       IWidget_SetActiveBGColor(pMe->m_pRootContWgt, MAKE_RGBA(0xFF,0xff,0xFF,255));    IWidget_GetPreferredExtent(pMe->m_pRootContWgt, &we);        we.height = MAX(we.height, pMe->m_deviceInfo.cyScreen);        we.width = MAX(we.width, pMe->m_deviceInfo.cxScreen);        IWidget_SetExtent(pMe->m_pRootContWgt, &we);        TimedFillGrid(pMe);IDecorator_SetWidget((IDecorator*)(void*)pMe->m_pTabWidget,pMe->piTimeWidget);    {        IModel *pViewModel;        IWidget_GetViewModel(pMe->m_pTabWidget,&pViewModel);        IModel_AddListenerEx(pViewModel, &pMe->hdTabListen, (PFNLISTENER)c_SystemTaskApp_TabHandler,(void *)pMe);        RELEASEIF(pViewModel);    }    {        pMe->m_tStaticTabInfo[0]->pwText = (AECHAR *)L"Tab1";        pMe->m_tStaticTabInfo[1]->pwText = (AECHAR *)L"Tab2";        pMe->m_tStaticTabInfo[2]->pwText = (AECHAR *)L"Tab3";        pMe->m_tStaticTabInfo[3]->pwText = (AECHAR *)L"Tab4";        pMe->m_tStaticTabInfo[4]->pwText = (AECHAR *)L"Tab5";        pMe->m_tStaticTabInfo[0]->piImage = NULL;        pMe->m_tStaticTabInfo[1]->piImage = NULL;        pMe->m_tStaticTabInfo[2]->piImage = NULL;        pMe->m_tStaticTabInfo[3]->piImage = NULL;        pMe->m_tStaticTabInfo[4]->piImage = NULL;        //get the tab widgets vector model        IWidget_GetModel(pMe->m_pTabWidget, AEEIID_IVectorModel,             (IModel **)&pMe->m_pVectorModel);        //add in our tabs        IVectorModel_Add(pMe->m_pVectorModel, pMe->m_tStaticTabInfo[0]);        IVectorModel_Add(pMe->m_pVectorModel, pMe->m_tStaticTabInfo[1]);        IVectorModel_Add(pMe->m_pVectorModel, pMe->m_tStaticTabInfo[2]);        IVectorModel_Add(pMe->m_pVectorModel, pMe->m_tStaticTabInfo[3]);        IVectorModel_Add(pMe->m_pVectorModel, pMe->m_tStaticTabInfo[4]);        //set colors widths etc        IWidget_SetFlags(pMe->m_pTabWidget, 0 | TABWF_WRAP |             TABWF_SHOWBORDER | TABWF_SHOWTEXTALWAYS);           IWidget_SetPadding(pMe->m_pTabWidget, 0);           IWidget_SetActiveBorderWidth(pMe->m_pTabWidget, 2);           IWidget_SetInactiveBorderWidth(pMe->m_pTabWidget, 2);           IWidget_SetInactiveBorderColor(pMe->m_pTabWidget, MAKE_RGBA(0x7B,0x7D,0xA5,255));           IWidget_SetActiveBorderColor(pMe->m_pTabWidget, MAKE_RGBA(0x7B,0x7D,0xA5,255));           IWidget_SetInactiveBGColor(pMe->m_pTabWidget, MAKE_RGBA(0xEF,0xEF,0xFF,255));           IWidget_SetActiveBGColor(pMe->m_pTabWidget, MAKE_RGBA(0xFF,0xff,0xFF,255));        {            uint32 iTabHeight = 0;            IWidget_GetProperty(pMe->m_pTabWidget, PROP_TABHEIGHT, &iTabHeight);            iTabHeight *= 2;            IWidget_SetProperty(pMe->m_pTabWidget, PROP_TABHEIGHT, iTabHeight);            IWidget_SetProperty(pMe->m_pTabWidget, PROP_INACTIVE_TABWIDTH, pMe->m_deviceInfo.cxScreen/6);            IWidget_SetProperty(pMe->m_pTabWidget, PROP_ACTIVE_TABWIDTH, pMe->m_deviceInfo.cxScreen/4);        }            //add the tabs to our root container        we.height = pMe->m_deviceInfo.cyScreen;        we.width  = pMe->m_deviceInfo.cxScreen;        IWidget_SetExtent(pMe->m_pTabWidget, &we);        wpos.x = 0;        wpos.y = 0;        wpos.bVisible = TRUE;        IRootContainer_Insert(pMe->m_pRootCont, pMe->m_pTabWidget, WIDGET_ZNORMAL, &wpos);        IWidget_MoveFocus(pMe->m_pRootContWgt, pMe->m_pTabWidget);    }    RELEASEIF(pMe->m_pVectorModel);

}

 

void c_SystemTaskApp_TabHandler(tabwidget *pMe, ModelEvent *pEvent){    if (EVT_MDL_TAB_CHANGE  == pEvent->evCode)    {        //do the intial grid fill        pMe->m_pSelectedWidget = NULL;        //get rid of the hourglass widget        TimedFillGrid(pMe);        }    return;}

 

 

void TimedFillGrid(tabwidget* pMe){    WidgetExtent tWE;    AEEResult nErr = AEE_SUCCESS;    uint32 iIndex;        pMe->m_bInVersionInfo = FALSE; //reset if changing tabs        IWidget_GetProperty(pMe->m_pTabWidget, PROP_FOCUSINDEX, &iIndex);        switch(iIndex)    {        case 1:             {                IWidget *piDateWidget;                IWidget *piTimeWidget;                IWidget *piwProp;                WidgetExtent we;                WidgetPos WidProp;                AEERect rc;                IWidget_SetVisible(pMe->piTimeWidget,FALSE);                ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_JulianDateWidget, (void**)&piDateWidget);                ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_JulianTimeWidget, (void**)&piTimeWidget);                // Set arrow padding for date/time widget                IWidget_SetArrowPad(piDateWidget, 4);                IWidget_SetArrowPad(piTimeWidget, 4);                we.height = 40;                we.width = pMe->m_deviceInfo.cxScreen-40;                IWidget_SetExtent(piDateWidget, &we);                IWidget_SetExtent(piTimeWidget, &we);                IWidget_SetTopPadding(pMe->m_pRootContWgt/*piwProp*/, 20);                //IWidget_SetBGColor(pMe->m_pRootContWgt, MAKE_RGB(102,225,255));                IWidget_SetFlags(piDateWidget, DTWF_USEUPDOWNKEYS |DTWF_SHOWUPDOWNARROWS);                IWidget_SetFlags(piTimeWidget, DTWF_USEUPDOWNKEYS |DTWF_SHOWUPDOWNARROWS);                WidProp.bVisible = TRUE;                WidProp.x= 40;                WidProp.y=150;                pMe->Temp_container[1] = piDateWidget;                IRootContainer_Insert(pMe->m_pRootCont,pMe->Temp_container[1], WIDGET_ZNORMAL,&WidProp);                WidProp.bVisible = TRUE;                WidProp.x= 10;                WidProp.y=80;                pMe->Temp_container[2] = piTimeWidget;                IRootContainer_Insert(pMe->m_pRootCont,pMe->Temp_container[2], WIDGET_ZNORMAL,&WidProp);                IWidget_GetPreferredExtent(pMe->m_pRootContWgt, &we);                we.height = MAX(we.height, pMe->m_deviceInfo.cyScreen);                we.width = MAX(we.width, pMe->m_deviceInfo.cxScreen);                IWidget_SetExtent(pMe->m_pRootContWgt, &we);                /*IWidget_MoveFocus(pMe->m_pRootContWgt, piDateWidget);                IWidget_MoveFocus(pMe->m_pRootContWgt, piTimeWidget);*/                IWidget_Release(piDateWidget);                IWidget_Release(piTimeWidget);            }            break;        case 0:             {                int res;                AEEDateTime type;                WidgetPos wpos;                WidgetExtent extent;                res = IWidget_GetAEEDateTime(pMe->piTimeWidget, &type);                res = IWidget_SetFlags(pMe->piTimeWidget, DTWF_USEUPDOWNKEYS |DTWF_SHOWUPDOWNARROWS);                IWidget_SetFGColor(pMe->piTimeWidget,MAKE_RGB(122,150,160));                IWidget_SetArrowPad(pMe->piTimeWidget,5);                extent.height = 50;                extent.width  = 80;                IWidget_SetExtent(pMe->piTimeWidget, &extent);             }            break;        case 2:         {            break;        }            case 3:         break;        case 4:        break;    }      return;}     

 

 

Thanks in advance, please reply ASP,          

 

Hi,
Since the code snippet is not formatted, it's difficult to easily read.  Perhaps re-formatting it would help.  However, after searching for a CardContainer, I was unable to find one.  The tab widget is typically associated with a card container, so that each tab correlates with a 'card' in the card container.  The card can be any container or widget you like.  The order in which you insert into the container determins the tab it is associated with.
Regards,
Jason

Hi,
Since the code snippet is not formatted, it's difficult to easily read.  Perhaps re-formatting it would help.  However, after searching for a CardContainer, I was unable to find one.  The tab widget is typically associated with a card container, so that each tab correlates with a 'card' in the card container.  The card can be any container or widget you like.  The order in which you insert into the container determins the tab it is associated with.
Regards,
Jason

Thanks for ur reply jason, i got the solution,{its not possible using same container, so i'm using two container to display in tabs}
 
Regards,
hanmanth

Thanks for ur reply jason, i got the solution,{its not possible using same container, so i'm using two container to display in tabs}
 
Regards,
hanmanth