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

Developer

Forums

Forums:

Hi All,

Iam trying to use an image static widget. I assigned both image and text to it.
But when iam running the application only the image is getting displayed propoerly.
Instead of the text taht i gave, some symbols like 'a' etc is getting displayed.

What is wrong in the below code:
ImageStaticInfo imginfo;
ImageParm imgParm;
IWidget *imgTempWidget,*staTempWidget;
AECHAR s[] ={'B','I','A','\0'};
imginfo.piImage = ISHELL_LoadResImage(pMe->piShell,APPLICATION1_RES_FILE,5002);

imginfo.pwText = s;

nErr =ISHELL_CreateInstance(pMe->piShell,AEECLSID_ImageStaticWidget,(void **)&pMe->pImageStaticWidget);
if (AEE_SUCCESS != nErr) {
return nErr;

///////////
imgParm.parm = IPARM_SCALE;
imgParm.arg1 = 25;
imgParm.arg2 = 25;

if(ISHELL_CreateInstance(pMe->piShell, AEECLSID_FONT_STANDARD15B, (void**)&pMe->piFont) != SUCCESS)
return FALSE;

//IIMAGE_Release(imgInfo.piImage);

/* Scaling the image and setting the image in to ImageWidget */
IWidget_SetImageStaticInfo(pMe->pImageStaticWidget,&imginfo,NULL);
IWidget_GetImageStaticImageWidget(pMe->pImageStaticWidget,&imgTempWidget);
IWidget_SetImageParm(imgTempWidget,&imgParm);
IWidget_SetBorderStyle(imgTempWidget,BORDERSTYLE_ROUNDED);
IWidget_SetImageStaticImageWidget(pMe->pImageStaticWidget,imgTempWidget);
IWidget_Release(imgTempWidget);
imgTempWidget = NULL;
/* Ends */

/* Setting the Left Padding for Static widget of the ImageStaticWidget */
IWidget_GetImageStaticStaticWidget(pMe->pImageStaticWidget,&staTempWidget);
IWidget_SetLeftPadding(staTempWidget, 20);
IWidget_SetFont(staTempWidget, pMe->piFont);
IWidget_SetImageStaticStaticWidget(pMe->pImageStaticWidget,staTempWidget);
IWidget_Release(staTempWidget);
IWidget_SetFGColor(pMe->pImageStaticWidget,MAKE_RGB(255,255,255));
if(pMe->piFont != NULL)
{
IFont_Release(pMe->piFont);
pMe->piFont = NULL;
}
staTempWidget = NULL;

Hi,
Please try any of the below 2 options and let me know if you still see the problem:
1) Replace the statement
imginfo.pwText = s;
with
imginfo.pwText = (AECHAR *) L"Hello";
(OR)
2) Try with the below code
int nErr;
WExtent we;
IValueModel *piModel;
ImageStaticInfo pInfo;
nErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_ImageStaticWidget, (void**) &pMe->piwImgStatic1);
IWidget_GetModel(pMe->piwImgStatic1, AEEIID_IValueModel, (IModel **)(void *)&piModel);
pInfo.pwText = (AECHAR *) L"Contacts";
pInfo.piImage = ISHELL_LoadImage(pMe->pIShell,"contacts.png");
IValueModel_SetValue(piModel, (void *)&pInfo, sizeof(pInfo), imagestaticfreefun);
IValueModel_Release(piModel);
IWidget_SetBorderWidth(pMe->piwImgStatic1, 2);
Regards,
Sreekanth Aila

Hi,
Please try any of the below 2 options and let me know if you still see the problem:
1) Replace the statement
imginfo.pwText = s;
with
imginfo.pwText = (AECHAR *) L"Hello";
(OR)
2) Try with the below code
int nErr;
WExtent we;
IValueModel *piModel;
ImageStaticInfo pInfo;
nErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_ImageStaticWidget, (void**) &pMe->piwImgStatic1);
IWidget_GetModel(pMe->piwImgStatic1, AEEIID_IValueModel, (IModel **)(void *)&piModel);
pInfo.pwText = (AECHAR *) L"Contacts";
pInfo.piImage = ISHELL_LoadImage(pMe->pIShell,"contacts.png");
IValueModel_SetValue(piModel, (void *)&pInfo, sizeof(pInfo), imagestaticfreefun);
IValueModel_Release(piModel);
IWidget_SetBorderWidth(pMe->piwImgStatic1, 2);
Regards,
Sreekanth Aila

Thanks a lot:-D it worked

Thanks a lot:-D it worked