Hi friends ,
Today we are going to add a image to form below the grid to diplay the related image,
In form take a new group and add a window control to display the image.Add a button group and take a menu item button from it. The properties of menu item are as follows,
Property Value
Name CompanyImage
MenuItemType Display
MenuItemName CompanyImage
Text Item image
DataSource InventTable
In class declaration of your form declare a container and add a method on form of to load the images,
the code for form is as follows,
void loadImage()
{
Image img;
CompanyImage companyImage;
;
companyImage = CompanyImage::find(
InventTable.dataAreaId,
InventTable .TableId,
InventTable .RecId);
if (companyImage.Image)
{
img = new Image();
img.setData(companyImage.Image);
ItemImage.image(img);
}
else
{
ItemImage.image(null);
}
}
Take a button under menuitem buton and name it as "save as"
to save the image which u have created take a new method on form and write the following code
void saveImage()
{
Image img;
Filename name;
str type;
#File
;
if (!imageContainer)
{
return;
}
img = new Image();
img.setData(imageContainer);
type = '.'+strlwr(enum2value(img.saveType()));
name = WinAPI::getSaveFileName(
element.hWnd(),
[WinAPI::fileType(type),#AllFilesName+type],
'',
'');
if (name)
{
img.saveImage(name);
}
}
And write a active method in datasource properties
element.loadImage();
And in save button override the clicked method and write the code as following
element.saveImage();
By this a image is displayed by using this functionality
By vivek chirumamilla
Today we are going to add a image to form below the grid to diplay the related image,
In form take a new group and add a window control to display the image.Add a button group and take a menu item button from it. The properties of menu item are as follows,
Property Value
Name CompanyImage
MenuItemType Display
MenuItemName CompanyImage
Text Item image
DataSource InventTable
In class declaration of your form declare a container and add a method on form of to load the images,
the code for form is as follows,
void loadImage()
{
Image img;
CompanyImage companyImage;
;
companyImage = CompanyImage::find(
InventTable.dataAreaId,
InventTable .TableId,
InventTable .RecId);
if (companyImage.Image)
{
img = new Image();
img.setData(companyImage.Image);
ItemImage.image(img);
}
else
{
ItemImage.image(null);
}
}
Take a button under menuitem buton and name it as "save as"
to save the image which u have created take a new method on form and write the following code
void saveImage()
{
Image img;
Filename name;
str type;
#File
;
if (!imageContainer)
{
return;
}
img = new Image();
img.setData(imageContainer);
type = '.'+strlwr(enum2value(img.saveType()));
name = WinAPI::getSaveFileName(
element.hWnd(),
[WinAPI::fileType(type),#AllFilesName+type],
'',
'');
if (name)
{
img.saveImage(name);
}
}
And write a active method in datasource properties
element.loadImage();
And in save button override the clicked method and write the code as following
element.saveImage();
By this a image is displayed by using this functionality
By vivek chirumamilla
No comments:
Post a Comment