var
MyForm: TclForm;
GetImageBaseBtn, ImageAddBtn, Controlbtn: TClProButton;
NoteLabel: TClProLabel;
noteMemo: TCLMemo;
CameraImg , SourceImg: TClImage;
LMemStream: TCLMemoryStream;
Qry: TClSQLiteQuery;
database , password : String;
void InsertToDatabase;
{
try
Clomosy.DBSQLiteQuery.SQL.Text = 'INSERT INTO Categories (GetImageBase64, Description) VALUES (' + QuotedStr(noteMemo.Text) + ', ' + QuotedStr(noteMemo.Text) + ')';
Clomosy.DBSQLiteQuery.OpenOrExecute;
GetData;
except
ShowMessage('Exception class');
}
}
void GetData;
{
try
Qry = Clomosy.DBSQLiteQueryWith('SELECT CategoryName as MAIN_TEXT, Description as SUB_TEXT FROM Categories');
Qry.OpenOrExecute;
noteMemo.clLoadnoteMemoFromDataset(Qry);
except
ShowMessage('Exception class:1');
}
}
void addImageClick;
{
Clomosy.ImageChooser(MyForm, CameraImg);
}
void getImageBase64;
{
CameraImg.Bitmap.SaveToStream(LMemStream);
noteMemo.Lines.Text = LMemStream.AsBase64;
}
void memoBase64ToStreamClick;
var
LMemStream:TCLMemoryStream;
{
noteMemo.Lines.Text = Clomosy.FileToBase64(clPathCombine('ClomosyDatabase.db3',Clomosy.AppFilesPath));
LMemStream = Clomosy.Base64ToStream(GetData);
SourceImg.Bitmap.LoadFromStream(LMemStream);
}
////
{
MyForm = TclForm.Create(nil);
LMemStream = TCLMemoryStream.Create;
CameraImg = MyForm.AddNewImage(MyForm, 'CameraImg');
CameraImg.Align = alTop;
CameraImg.Height = 80;
CameraImg.Width = 220;
CameraImg.Margins.Top = 12;
CameraImg.Margins.Right = 12;
CameraImg.Margins.Bottom = 12;
CameraImg.Margins.Left = 12;
ImageAddBtn = MyForm.AddNewProButton(MyForm, 'ImageAddBtn', 'Görsel Ekle');
clComponent.SetupComponent(ImageAddBtn, '{"Align" : "Bottom", "TextSize":16, "TextBold":"yes", "BackgroundColor":"#00b282", "RoundWidth":8, "RoundHeight":8, "TextColor":"#ffffff", "Height":42, "MarginBottom":16}');
MyForm.AddNewEvent(ImageAddBtn, tbeOnClick, 'addImageClick');
GetImageBaseBtn = MyForm.AddNewProButton(MyForm, 'GetImageBaseBtn', 'InsertToDatabase');
clComponent.SetupComponent(GetImageBaseBtn, '{"Align" : "Bottom", "TextSize":16, "TextBold":"yes", "BackgroundColor":"#2465ff", "RoundWidth":8, "RoundHeight":8, "TextColor":"#ffffff", "Height":42, "MarginBottom":16, "MarginTop":16}');
MyForm.AddNewEvent(GetImageBaseBtn, tbeOnClick, 'getImageBase64');
Controlbtn = MyForm.AddNewProButton(MyForm,'Controlbtn','Controlbtn');
clComponent.SetupComponent(Controlbtn,'{"Align" : "Bottom", "TextSize":16, "TextBold":"yes", "BackgroundColor":"#00fac8", "RoundWidth":8, "RoundHeight":8, "TextColor":"#ffffff", "Height":42, "MarginBottom":16}');
MyForm.AddNewEvent(Controlbtn,tbeOnClick, 'memoBase64ToStreamClick');
noteMemo = MyForm.AddNewMemo(MyForm, 'noteMemo', 'Bir Not Giriniz');
noteMemo.StyledSettings = ssFamily;
noteMemo.TextSettings.WordWrap = True;
noteMemo.Height = 80;
noteMemo.Align = alBottom;
MyForm.AddNewEvent(noteMemo, tbeOnClick, 'InsertToDatabase');
Clomosy.DBSQLiteConnect(Clomosy.AppFilesPath + 'ClomosyDatabase.db3', '');
database = Clomosy.AppFilesPath + 'ClomosyDatabase.db3'
password = '';
try
Clomosy.DBSQLiteConnect(database , password);
Clomosy.DBSQLiteQuery.Sql.Text = 'CREATE TABLE Categories(UrunAdi Text, Aciklamasi Text,UrunStok Text,BarkodOkut Text,UrunFiyat Text)';
Clomosy.DBSQLiteQuery.OpenOrExecute;
ShowMessage('Veri tabanına tablo ekleme işlemi başarılı!');
except
ShowMessage('Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);
}
GetData;
MyForm.Run;
}