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

Developer

Forums

Forums:

Am using Brew Mp SDK 7.11.I have created one form. how can i create the progress bar widget into the form.

//Common variables
IDisplayCanvas *pDisplayCanvas;
AEERect rect;
int ret = 0;
WidgetExtent pWExtent;
WidgetPos ppos;

/*************************************************************/
// Create Root Container //
// //
/*************************************************************/
//Create display canvas and assign the display
ret = ISHELL_CreateInstance(pMe->piShell, AEECLSID_DisplayCanvas, (void**)&pDisplayCanvas);
if(ret != SUCCESS)
{
DBGPRINTF("DisplayCanvas failed[%d]", ret);
return;
}
IDisplayCanvas_SetDisplay(pDisplayCanvas, pMe->piDisplay);

//Create root container and assign the display canvas
ret = ISHELL_CreateInstance(pMe->piShell, AEECLSID_RootContainer, (void**)&pMe->picRootText);
if(ret != SUCCESS)
{
DBGPRINTF("rootcontainer failed[%d]", ret);
return;
}
ret = IRootContainer_QueryInterface(pMe->picRootText, AEEIID_IWidget, (void**)&pMe->piwRootText);
if(ret != SUCCESS)
{
DBGPRINTF("piwRootText failed[%d]", ret);
return;
}

SETAEERECT(&rect, 0, 0, pMe->deviceInfo.cxScreen, pMe->deviceInfo.cyScreen);
IRootContainer_SetCanvas(pMe->picRootText, (ICanvas*)pDisplayCanvas, &rect);

// Set BG color
IWidget_SetBGColor(pMe->piwRootText, MAKE_RGBA(224, 224, 224, 255));
// Enable touch
IWidget_EnableTouch(pMe->piwRootText);

/*************************************************************/
// Create Progress widget //
// //
/*************************************************************/

ret = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ProgressWidget, (void**)&pMe->piwProgress);
if(ret != SUCCESS)
{
DBGPRINTF("piwProgress failed[%d]", ret);
return;
}
IWIDGET_SetFGColor(pMe->piwProgress, MAKE_RGBA(0,255,255,0));
IWidget_SetBGColor(pMe->piwProgress, MAKE_RGB(160,160,160));
IWidget_SetAnimateFlags(pMe->piwProgress, IDF_RECT_FILL);

//ret = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ValueModel, (void**)&pMe->pimProgress);
IWidget_GetModel(pMe->piwProgress, AEEIID_VALUEMODEL, &pMe->pimProgress);
pMe->uPrgs = 30;
IValueModel_SetValue(pMe->pimProgress, pMe->uPrgs, 0, NULL);

pWExtent.height = 20; pWExtent.width = 100;
IWidget_SetExtent(pMe->piwProgress, &pWExtent);

ppos.bVisible = TRUE;
ppos.x = (pMe->deviceInfo.cxScreen - pWExtent.width)/2;
ppos.y = 120;
IRootContainer_Insert(pMe->picRootText, pMe->piwProgress, WIDGET_ZNORMAL, &ppos);

// Clean up. Release local references.
RELEASEIF(pDisplayCanvas);

//Common variables
IDisplayCanvas *pDisplayCanvas;
AEERect rect;
int ret = 0;
WidgetExtent pWExtent;
WidgetPos ppos;

/*************************************************************/
// Create Root Container //
// //
/*************************************************************/
//Create display canvas and assign the display
ret = ISHELL_CreateInstance(pMe->piShell, AEECLSID_DisplayCanvas, (void**)&pDisplayCanvas);
if(ret != SUCCESS)
{
DBGPRINTF("DisplayCanvas failed[%d]", ret);
return;
}
IDisplayCanvas_SetDisplay(pDisplayCanvas, pMe->piDisplay);

//Create root container and assign the display canvas
ret = ISHELL_CreateInstance(pMe->piShell, AEECLSID_RootContainer, (void**)&pMe->picRootText);
if(ret != SUCCESS)
{
DBGPRINTF("rootcontainer failed[%d]", ret);
return;
}
ret = IRootContainer_QueryInterface(pMe->picRootText, AEEIID_IWidget, (void**)&pMe->piwRootText);
if(ret != SUCCESS)
{
DBGPRINTF("piwRootText failed[%d]", ret);
return;
}

SETAEERECT(&rect, 0, 0, pMe->deviceInfo.cxScreen, pMe->deviceInfo.cyScreen);
IRootContainer_SetCanvas(pMe->picRootText, (ICanvas*)pDisplayCanvas, &rect);

// Set BG color
IWidget_SetBGColor(pMe->piwRootText, MAKE_RGBA(224, 224, 224, 255));
// Enable touch
IWidget_EnableTouch(pMe->piwRootText);

/*************************************************************/
// Create Progress widget //
// //
/*************************************************************/

ret = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ProgressWidget, (void**)&pMe->piwProgress);
if(ret != SUCCESS)
{
DBGPRINTF("piwProgress failed[%d]", ret);
return;
}
IWIDGET_SetFGColor(pMe->piwProgress, MAKE_RGBA(0,255,255,0));
IWidget_SetBGColor(pMe->piwProgress, MAKE_RGB(160,160,160));
IWidget_SetAnimateFlags(pMe->piwProgress, IDF_RECT_FILL);

//ret = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ValueModel, (void**)&pMe->pimProgress);
IWidget_GetModel(pMe->piwProgress, AEEIID_VALUEMODEL, &pMe->pimProgress);
pMe->uPrgs = 30;
IValueModel_SetValue(pMe->pimProgress, pMe->uPrgs, 0, NULL);

pWExtent.height = 20; pWExtent.width = 100;
IWidget_SetExtent(pMe->piwProgress, &pWExtent);

ppos.bVisible = TRUE;
ppos.x = (pMe->deviceInfo.cxScreen - pWExtent.width)/2;
ppos.y = 120;
IRootContainer_Insert(pMe->picRootText, pMe->piwProgress, WIDGET_ZNORMAL, &ppos);

// Clean up. Release local references.
RELEASEIF(pDisplayCanvas);