Adding
Image to every record :
1. For that one first we
have add one container field (logo) to table and it is extended from Bitmap
2. add one button in to
action pane and write the code in clicked method as
void clicked()
{
Image image1
= new Image();
IPMFinancialCompanies _ImageTable; //Table name
FilenameOpen
filename;
dialogField
dialogFilename;
DialogGroup
dialoggroup;
DialogField
SID;
//EmployeeIDTxt
Dialog
dialog;
container
con;
str
photoname;
;
super();
dialog
= new Dialog(“Image Upload”);
DialogGroup=dialog.addGroup(“Details”);
SID
= dialog.addFieldValue(extendedTypeStr(IPMCompanyID),IPMFinancialCompanies_IPMCompanyID1.valueStr(),
“IPMCompany ID”);
// change our edt ,our form design level unique field ,and the label
dialogFilename = dialog.addField(extendedTypeStr(FilenameOpen),”File Name”);
dialog.filenameLookupFilter([".jpeg"]);
dialog.filenameLookupTitle(“Upload Image”);
dialog.caption(“PHOTO Upload”);
dialogFilename.value(photoname);
if(!dialog.run())
return;
photoname
= dialogFilename.value();
if (Image::canLoad(photoname))
{
image1.loadImage(photoname);
con=image1.getData();//,Emp_Id.text()];
_ImageTable.IPMCompanyID = SID.value(); //change our unique field
_ImageTable.logo=con;
ttsBegin;
select forupdate _ImageTable where _ImageTable.IPMCompanyID ==
IPMFinancialCompanies.IPMCompanyID;
if(_ImageTable)
{
IPMFinancialCompanies.logo = con;
IPMFinancialCompanies.update();
}
else
{
IPMFinancialCompanies.logo = con;
IPMFinancialCompanies.insert();
}
ttsCommit;
// _ImageTable.insert();
info(“Your Photo Uploaded”);
}
}
3. add one image type
controller in to our form and assign the datasource and data field(logo)
When we click that button
it shown following screen shot
After that we select the
path
3. add one
image type controller in to our form and assign the datasource and data
field(logo)
Then it will
displayed form as
No comments:
Post a Comment