Loading Image | developer.brewmp.com Loading Image | developer.brewmp.com

Developer

Loading Image

Forums:

Dear All,

I am a fresh bee to the BREW flower,please provide some information regarding following.

In my project I had a requirement to load the images ,when I tried to load the Image I am not able to do that so.Please can any one suggest me how to load the Images.

Please provide some information regarding the following:

1)How to display the calender

2)how to display the data in table formats

3)how to use Dialogue box from resource file

Regards,
Sri anu.

Hi Anu
You can use the ISHELL_LoadResImage function to load the image from a resource file and then use the IIMage_draw function to show where exactly you want to show the image on the screen.
There is no direct API in 3.x SDK to show the data in table.
For dialogs you will have to use the following events - see the IDialog interface for its usage and handle the following events
case EVT_DIALOG_START:
case EVT_DIALOG_INIT:
case EVT_DIALOG_END:
Also for loading the dialog - use ISHELL_createDialog function.
For date or calender see the IDateCtl function and the JulianDate control from the API reference.
Hope this helps
Akshay

Hi Anu
You can use the ISHELL_LoadResImage function to load the image from a resource file and then use the IIMage_draw function to show where exactly you want to show the image on the screen.
There is no direct API in 3.x SDK to show the data in table.
For dialogs you will have to use the following events - see the IDialog interface for its usage and handle the following events
case EVT_DIALOG_START:
case EVT_DIALOG_INIT:
case EVT_DIALOG_END:
Also for loading the dialog - use ISHELL_createDialog function.
For date or calender see the IDateCtl function and the JulianDate control from the API reference.
Hope this helps
Akshay

Hi Aksay ,
Thank you for your info,even we have used same API,but it is returning null.Please find the code below
AECHAR szText[ICON_STRING_FIELD_SIZE]; //icon string
IImage * IconImgPtr; //icon image
CtlAddItem pai;
boolean result;
AEERect qrc;
AEEDeviceInfo di; // Device Info
ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&di);
qrc.x = 5;
qrc.y = 5;
qrc.dx = di.cxScreen-5;
qrc.dy = di.cyScreen-5;
IMENUCTL_SetRect(pMe->m_pIMenu,&qrc);
// Create the icon view menu
if(ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_ICONVIEWCTL,
(void **)&pMe->m_pIconMenu) != SUCCESS)
{
IMenuCtl_Cleanup(pMe);
return;
}
pai.wText = NULL;
pai.wImage = NULL;
// Both text and image are contained in our app's
// resource file
pai.pszResImage = szResFile; // Resource for Image
pai.pszResText = szResFile; // Resource for Text
// Use the default font for all item text
pai.wFont = 0; // 0 - Default
// We don't specify any double-word data for our items
pai.dwData = 0;
// Now specify the item-specific fields in the CtlAddItem structure
// Specify values for first item and add them to the icon-view menu
ISHELL_LoadResString(pMe->a.m_pIShell,szResFile,IDS_STRING_PAYABLES_1003,szText,ICON_STRING_FIELD_SIZE);
pai.pText = szText ;
IDISPLAY_DrawText(pMe->a.m_pIDisplay, // Display instance
AEE_FONT_BOLD, // Use BOLD font
szText, // Text - Normally comes from resource
-1, // -1 = Use full string length
0, // Ignored - IDF_ALIGN_CENTER
0, // Ignored - IDF_ALIGN_MIDDLE
NULL, // No clipping
IDF_ALIGN_CENTER | IDF_ALIGN_MIDDLE);
IDISPLAY_Update (pMe->a.m_pIDisplay);
IconImgPtr = (IImage *) ISHELL_LoadResObject(pMe->a.m_pIShell,szResFile,IDI_OBJECT_PAYABLES, HTYPE_VIEWER);
//IconImgPtr = ISHELL_LoadResImage(pMe->a.m_pIShell,szResFile,IDI_OBJECT_PAYABLES);
pai.pImage = IconImgPtr;
pai.wItemID = IDS_STRING_PAYABLES_1003;
result = IMENUCTL_AddItemEx(pMe->m_pIconMenu, &pai);
DBGPRINTF("\n 1 . %d",result);
// Specify values for first item and add them to the icon-view menu
ISHELL_LoadResString(pMe->a.m_pIShell,szResFile,IDS_STRING_RECEIVABLES_1004,szText,ICON_STRING_FIELD_SIZE);
pai.pText = szText ;
IconImgPtr = (IImage *)ISHELL_LoadResObject(pMe->a.m_pIShell,szResFile,IDI_OBJECT_RECEIVABLES, HTYPE_VIEWER);
//IconImgPtr = ISHELL_LoadResImage(pMe->a.m_pIShell,szResFile,IDI_OBJECT_RECEIVABLES);
pai.pImage = IconImgPtr;
pai.wItemID = IDS_STRING_RECEIVABLES_1004;
result = IMENUCTL_AddItemEx(pMe->m_pIconMenu, &pai);
DBGPRINTF("\n 2 . %d",result);
IMENUCTL_SetRect(pMe->m_pIconMenu,&qrc);
// Set the property that causes the text for the selected
// item to appear at the top of the screen instead of
// the bottom
IMENUCTL_SetProperties(pMe->m_pIconMenu, 0);
// Activate the icon view menu we just created
IMENUCTL_SetActive(pMe->m_pIconMenu,TRUE);
IDISPLAY_UpdateEx(pMe->a.m_pIDisplay,TRUE);
Regards,
Sri Anu.

Hi Aksay ,
Thank you for your info,even we have used same API,but it is returning null.Please find the code below
AECHAR szText[ICON_STRING_FIELD_SIZE]; //icon string
IImage * IconImgPtr; //icon image
CtlAddItem pai;
boolean result;
AEERect qrc;
AEEDeviceInfo di; // Device Info
ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&di);
qrc.x = 5;
qrc.y = 5;
qrc.dx = di.cxScreen-5;
qrc.dy = di.cyScreen-5;
IMENUCTL_SetRect(pMe->m_pIMenu,&qrc);
// Create the icon view menu
if(ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_ICONVIEWCTL,
(void **)&pMe->m_pIconMenu) != SUCCESS)
{
IMenuCtl_Cleanup(pMe);
return;
}
pai.wText = NULL;
pai.wImage = NULL;
// Both text and image are contained in our app's
// resource file
pai.pszResImage = szResFile; // Resource for Image
pai.pszResText = szResFile; // Resource for Text
// Use the default font for all item text
pai.wFont = 0; // 0 - Default
// We don't specify any double-word data for our items
pai.dwData = 0;
// Now specify the item-specific fields in the CtlAddItem structure
// Specify values for first item and add them to the icon-view menu
ISHELL_LoadResString(pMe->a.m_pIShell,szResFile,IDS_STRING_PAYABLES_1003,szText,ICON_STRING_FIELD_SIZE);
pai.pText = szText ;
IDISPLAY_DrawText(pMe->a.m_pIDisplay, // Display instance
AEE_FONT_BOLD, // Use BOLD font
szText, // Text - Normally comes from resource
-1, // -1 = Use full string length
0, // Ignored - IDF_ALIGN_CENTER
0, // Ignored - IDF_ALIGN_MIDDLE
NULL, // No clipping
IDF_ALIGN_CENTER | IDF_ALIGN_MIDDLE);
IDISPLAY_Update (pMe->a.m_pIDisplay);
IconImgPtr = (IImage *) ISHELL_LoadResObject(pMe->a.m_pIShell,szResFile,IDI_OBJECT_PAYABLES, HTYPE_VIEWER);
//IconImgPtr = ISHELL_LoadResImage(pMe->a.m_pIShell,szResFile,IDI_OBJECT_PAYABLES);
pai.pImage = IconImgPtr;
pai.wItemID = IDS_STRING_PAYABLES_1003;
result = IMENUCTL_AddItemEx(pMe->m_pIconMenu, &pai);
DBGPRINTF("\n 1 . %d",result);
// Specify values for first item and add them to the icon-view menu
ISHELL_LoadResString(pMe->a.m_pIShell,szResFile,IDS_STRING_RECEIVABLES_1004,szText,ICON_STRING_FIELD_SIZE);
pai.pText = szText ;
IconImgPtr = (IImage *)ISHELL_LoadResObject(pMe->a.m_pIShell,szResFile,IDI_OBJECT_RECEIVABLES, HTYPE_VIEWER);
//IconImgPtr = ISHELL_LoadResImage(pMe->a.m_pIShell,szResFile,IDI_OBJECT_RECEIVABLES);
pai.pImage = IconImgPtr;
pai.wItemID = IDS_STRING_RECEIVABLES_1004;
result = IMENUCTL_AddItemEx(pMe->m_pIconMenu, &pai);
DBGPRINTF("\n 2 . %d",result);
IMENUCTL_SetRect(pMe->m_pIconMenu,&qrc);
// Set the property that causes the text for the selected
// item to appear at the top of the screen instead of
// the bottom
IMENUCTL_SetProperties(pMe->m_pIconMenu, 0);
// Activate the icon view menu we just created
IMENUCTL_SetActive(pMe->m_pIconMenu,TRUE);
IDISPLAY_UpdateEx(pMe->a.m_pIDisplay,TRUE);
Regards,
Sri Anu.

IImage *pIImage;
char szResFile[] = APP_RES_FILE;
pIImage = ISHELL_LoadResImage(pMe->a.m_pIShell, "myapp.bar", IDB_BITMAP1);
IIMAGE_Draw(pIImage,0,0);
IIMAGE_Release (pIImage);
Thanks,
Mahesh

IImage *pIImage;
char szResFile[] = APP_RES_FILE;
pIImage = ISHELL_LoadResImage(pMe->a.m_pIShell, "myapp.bar", IDB_BITMAP1);
IIMAGE_Draw(pIImage,0,0);
IIMAGE_Release (pIImage);
Thanks,
Mahesh

Hi friend,
Thank you for your info,we are doing the same thing as you did,see below.
#define TALLYCONNECT_RES_FILE "TallyConnect.bar"
char szResFile[] = TALLYCONNECT_RES_FILE;
1st way
---------
pIImage = ISHELL_LoadResImage(pMe->a.m_pIShell, "", IDB_BINARY_PAYABLE);
2nd way
----------
pIImage = ISHELL_LoadResImage(pMe->a.m_pIShell,szResFile, IDB_BINARY_PAYABLE);
we tried in both the ways . while loading it is returning NULL to IIamgePtr.
I think while loading a file ,we are committing the mistake.How to add image in resource file using resource editor.what eight her we have to use BInary or object .
Please provide some information on adding image in to the resource editor.
Regards,
Sri Anu.

Hi friend,
Thank you for your info,we are doing the same thing as you did,see below.
#define TALLYCONNECT_RES_FILE "TallyConnect.bar"
char szResFile[] = TALLYCONNECT_RES_FILE;
1st way
---------
pIImage = ISHELL_LoadResImage(pMe->a.m_pIShell, "", IDB_BINARY_PAYABLE);
2nd way
----------
pIImage = ISHELL_LoadResImage(pMe->a.m_pIShell,szResFile, IDB_BINARY_PAYABLE);
we tried in both the ways . while loading it is returning NULL to IIamgePtr.
I think while loading a file ,we are committing the mistake.How to add image in resource file using resource editor.what eight her we have to use BInary or object .
Please provide some information on adding image in to the resource editor.
Regards,
Sri Anu.

For loading a image in the Source file.
Go in the Objects options in the BRX file and add a new string or value.
Give the name of the image - say IDI_IMAGE1 and the path where the image is located.Compile the brx file and then add the following code in ur app.
pMe->pIImage = ISHELL_LoadResImage(pMe->applet.m_pIShell, RES_FILE, IDI_IMAGE1);
if(pMe->pIImage)
{
IIMAGE_Draw(pMe->pIImage,(10*pMe->DeviceInfo.cxScreen)/100,(44*pMe->DeviceInfo.cyScreen)/100);
IDISPLAY_Update(pMe->a.m_pIDisplay);
IIMAGE_Release(pMe->pIImage);
pMe->pIImage = NULL;

Check this, this should work for you if u do it correctly.
Akshay

For loading a image in the Source file.
Go in the Objects options in the BRX file and add a new string or value.
Give the name of the image - say IDI_IMAGE1 and the path where the image is located.Compile the brx file and then add the following code in ur app.
pMe->pIImage = ISHELL_LoadResImage(pMe->applet.m_pIShell, RES_FILE, IDI_IMAGE1);
if(pMe->pIImage)
{
IIMAGE_Draw(pMe->pIImage,(10*pMe->DeviceInfo.cxScreen)/100,(44*pMe->DeviceInfo.cyScreen)/100);
IDISPLAY_Update(pMe->a.m_pIDisplay);
IIMAGE_Release(pMe->pIImage);
pMe->pIImage = NULL;

Check this, this should work for you if u do it correctly.
Akshay

Hi Aksay,
Thank you for your info,I am not able to resolve this again same problem.I will try little harder again.I am very new to BREW,but your suggestions are helpful.
Regards,
Sri Anu.

Hi Aksay,
Thank you for your info,I am not able to resolve this again same problem.I will try little harder again.I am very new to BREW,but your suggestions are helpful.
Regards,
Sri Anu.

Pls change your bar file name to lower case
Use
TALLYCONNECT_RES_FILE "tallyconnect.bar"
instead of
TALLYCONNECT_RES_FILE "TallyConnect.bar"
Hope this helps.
Thanks,
Mahesh

Pls change your bar file name to lower case
Use
TALLYCONNECT_RES_FILE "tallyconnect.bar"
instead of
TALLYCONNECT_RES_FILE "TallyConnect.bar"
Hope this helps.
Thanks,
Mahesh