Var
MyForm:TclForm;
Label1,adLbl,mekanLbl,zamanLbl,kmLbl,konumLbl,idLbl: TClProLabel;
ProBtn1,ProBtn2,ProBtn3 : TClProButton;
ProEdit1,ProEdit2,ProEdit3,ProEdit4,ProEdit5,ProEdit6:TclProEdit;
ProListView : TClProListView;
DesignerPanel : TClProListViewDesignerPanel;
ID,Kisi,Yer,Tarih,KmDegeri,Konum:TClProLabel;
selectQuery: TclSqlQuery;
void AddDataToListView; // bu fonksiyon devreye girince hata veriyor
{
try
selectQuery.SQL.text = 'SELECT ID AS Kisi ID , Kisi AS Kisi İsmi, Yer AS Alindigi Yer,
Tarih AS Alinma Zamani, KmDegeri AS Km Degeri, Konum AS Konumu FROM KisiBilgileri';
selectQuery.Open;
if(selectQuery.Found)
{
ProListView.ClLoadProListViewDataFromDataset(selectQuery);
}
else
{
ShowMessage('Kayıt Bulunamadı!');
}
finally
selectQuery.Free;
selectQuery.Close;
}
void InsertToDatabase; //bu fonksiyonum başarılı veritabanına ekleme yapıyor
{
try
Clomosy.DBSQLServerQuery.SQL.text= 'INSERT INTO KisiBilgileri (ID,Kisi,Yer,Tarih,KmDegeri,Konum) VALUES (
'+ProEdit6.Text+','+QuotedStr(ProEdit1.Text)+', '+QuotedStr(ProEdit2.Text)+','+QuotedStr(ProEdit3.Text)+',
'+ProEdit4.Text+', '+QuotedStr(ProEdit5.Text)+')';
Clomosy.DBSQLServerQuery.ExecSql;
ShowMessage('Veri Ekleme Başarılı.');
except
ShowMessage('Exception class: '+LastExceptionClassName+' Exception Message: ' +LastExceptionMessage);
}
}
{
MyForm = TclForm.Create(Self);
MyForm.SetFormColor('#f5f0f0', '#c3d3da', clGVertical);
DesignerPanel=MyForm.AddNewProListViewDesignerPanel(ProListView,'DesignerPanel');
clComponent.SetupComponent(DesignerPanel,
'{"Height":100,"Width" : 150,
"BackgroundColor":"#677b98",
"BorderColor":"#2c5696",
"BorderWidth":2,
"RoundHeight":2,
"RoundWidth":2}');
ProListView.SetDesignerPanel(DesignerPanel);
ID = MyForm.AddNewProLabel(DesignerPanel,'ID','');
clComponent.SetupComponent(ID,
'{"Height":10,
"Width" : 100,
"BackgroundColor":"#a4a5a8",
"BorderColor":"#7a4848",
"BorderWidth":2,
"RoundHeight":2,
"RoundWidth":2}');
DesignerPanel.AddPanelObject(ID,Cltext);
Kisi = MyForm.AddNewProLabel(DesignerPanel,'Kisi','');
clComponent.SetupComponent(Kisi,
'{"Height":10,
"Width" : 100,
"BackgroundColor":"#a4a5a8",
"BorderColor":"#7a4848",
"BorderWidth":2,
"RoundHeight":2,
"RoundWidth":2}');
DesignerPanel.AddPanelObject(Kisi,Cltext);
Yer = MyForm.AddNewProLabel(DesignerPanel,'Yer','');
clComponent.SetupComponent(Yer,
'{"Height":10,
"Width" : 100,
"BackgroundColor":"#a4a5a8",
"BorderColor":"#7a4848",
"BorderWidth":2,
"RoundHeight":2,
"RoundWidth":2}');
DesignerPanel.AddPanelObject(Yer,Cltext);
Tarih = MyForm.AddNewProLabel(DesignerPanel,'Tarih','');
clComponent.SetupComponent(Tarih,
'{"Height":10,
"Width" : 100,
"BackgroundColor":"#a4a5a8",
"BorderColor":"#7a4848",
"BorderWidth":2,
"RoundHeight":2,
"RoundWidth":2}');
DesignerPanel.AddPanelObject(Tarih,Cltext);
KmDegeri = MyForm.AddNewProLabel(DesignerPanel,'KmDegeri','');
clComponent.SetupComponent(KmDegeri,
'{"Height":10,
"Width" : 100,
"BackgroundColor":"#a4a5a8",
"BorderColor":"#7a4848",
"BorderWidth":2,
"RoundHeight":2,
"RoundWidth":2}');
DesignerPanel.AddPanelObject(KmDegeri,Cltext);
Konum= MyForm.AddNewProLabel(DesignerPanel,'Konum','');
clComponent.SetupComponent(Konum,
'{"Height":10,
"Width" : 100,
"BackgroundColor":"#a4a5a8",
"BorderColor":"#7a4848",
"BorderWidth":2,
"RoundHeight":2,
"RoundWidth":2}');
DesignerPanel.AddPanelObject(Konum,Cltext);
ProListView=MyForm.AddNewProListView(MyForm, 'ProListView');
clComponent.SetupComponent(ProListView,'{"Height" : 120 ,"Width": 150, "Align":"Client","MarginBottom":50,"MarginTop":380,
"MarginRight":20,"MarginLeft":20, "BackgroundColor":"#92a1aa", "ListType":"fluid","ItemHeight" : 50, "BorderColor":"#4c5c67",
"BorderWidth":2 , "ItemWidth":50}');
ProListView.SetDesignerPanel(DesignerPanel);
idLbl = MyForm.AddNewProLabel(MyForm,'idLbl','Kişi ID:');
clComponent.SetupComponent(idLbl,'{"MarginBottom":550,"MarginRight":130, "Width" :
500, "Height":400,"TextColor":"#000000","TextSize":14,"TextVerticalAlign":"center",
"TextHorizontalAlign":"center"}');
adLbl = MyForm.AddNewProLabel(MyForm,'adLbl','Kişi İsmi:');
clComponent.SetupComponent(adLbl,'{"MarginBottom":450,"MarginRight":130, "Width" :
500, "Height":400,"TextColor":"#000000","TextSize":14,"TextVerticalAlign":"center",
"TextHorizontalAlign":"center"}');
mekanLbl = MyForm.AddNewProLabel(MyForm,'mekanLbl','Alındığı Yer:');
clComponent.SetupComponent(mekanLbl,'{"MarginBottom":350,"MarginRight":145, "Width" :
500, "Height":400,"TextColor":"#000000","TextSize":14,"TextVerticalAlign":"center",
"TextHorizontalAlign":"center"}');
zamanLbl = MyForm.AddNewProLabel(MyForm,'zamanLbl','Alınma Zamanı:');
clComponent.SetupComponent(zamanLbl,'{"MarginBottom":250,"MarginRight":170, "Width" :
500, "Height":400,"TextColor":"#000000","TextSize":14,"TextVerticalAlign":"center",
"TextHorizontalAlign":"center"}');
kmLbl = MyForm.AddNewProLabel(MyForm,'kmLbl','Km Değeri:');
clComponent.SetupComponent(kmLbl,'{"MarginBottom":150,"MarginRight":140, "Width" :
500, "Height":400,"TextColor":"#000000","TextSize":14,"TextVerticalAlign":"center",
"TextHorizontalAlign":"center"}');
konumLbl = MyForm.AddNewProLabel(MyForm,'konumLbl','Konumu:');
clComponent.SetupComponent(konumLbl,'{"MarginBottom":50,"MarginRight":135, "Width" :
500, "Height":400,"TextColor":"#000000","TextSize":14,"TextVerticalAlign":"center",
"TextHorizontalAlign":"center"}');
ProBtn1=MyForm.AddNewProButton(MyForm, 'ProBtn1', 'Ekle');
clComponent.SetupComponent(ProBtn1,'{"caption":"Ekle","MarginTop":70,
"Width" :50, "Height":35,"RoundHeight":2, "RoundWidth":2,"BorderColor":"#7A3E65","BorderWidth":2}');
ProBtn2=MyForm.AddNewProButton(MyForm, 'ProBtn2', 'Güncelle');
clComponent.SetupComponent(ProBtn2,'{"caption":"Güncelle","MarginTop":70, "MarginLeft":110,
"Width" :50, "Height":35,"RoundHeight":2, "RoundWidth":2,"BorderColor":"#7A3E65","BorderWidth":2}');
ProBtn3=MyForm.AddNewProButton(MyForm, 'ProBtn3', 'Sil');
clComponent.SetupComponent(ProBtn3,'{"caption":"Sil","MarginTop":70,"MarginRight":110,
"Width" :50, "Height":35,"RoundHeight":2, "RoundWidth":2,"BorderColor":"#7A3E65","BorderWidth":2}');
Label1 = MyForm.AddNewProLabel(MyForm,'Label1','ARAÇ TAKİP UYGULAMASI');
clComponent.SetupComponent(Label1,'{"Align" : "Center","MarginBottom":630,"Width" :
500, "Height":400,"TextColor":"#000000","TextSize":20,"TextVerticalAlign":"center",
"TextHorizontalAlign":"center"}');
ProEdit1=MyForm.AddNewProEdit(MyForm, 'ProEdit1', '');
clComponent.SetupComponent(ProEdit1,'{"Align" : "Center","MarginBottom":450,"Width" :100
,"Height":30,"MarginLeft":27}')
ProEdit2=MyForm.AddNewProEdit(MyForm, 'ProEdit2', '');
clComponent.SetupComponent(ProEdit2,'{"Align" : "Center","MarginBottom":350,"Width" :100
,"Height":30,"MarginLeft":27}');
ProEdit3=MyForm.AddNewProEdit(MyForm, 'ProEdit3', 'Yıl-Ay-Gün');
clComponent.SetupComponent(ProEdit3,'{"Align" : "Center","MarginBottom":250,"Width" :100
,"Height":30,"MarginLeft":27}');
ProEdit4=MyForm.AddNewProEdit(MyForm, 'ProEdit4', '');
clComponent.SetupComponent(ProEdit4,'{"Align" : "Center","MarginBottom":150,"Width" :100
,"Height":30,"MarginLeft":27}');
// ProEdit4.clTypeOfField=taFloat;
ProEdit5=MyForm.AddNewProEdit(MyForm, 'ProEdit5', '');
clComponent.SetupComponent(ProEdit5,'{"Align" : "Center","MarginBottom":50,"Width" :100
,"Height":30,"MarginLeft":27}');
ProEdit6=MyForm.AddNewProEdit(MyForm, 'ProEdit6', '');
clComponent.SetupComponent(ProEdit6,'{"Align" : "Center","MarginBottom":550,"Width" :100
,"Height":30,"MarginLeft":27}');
MyForm.AddNewEvent(ProBtn1,tbeOnClick,'InsertToDatabase');
selectQuery = TclSqlQuery.Create(nil);
Clomosy.DBSQLServerConnect('SQL Server', 'DESKTOP-T9RHDI8\SQLEXPRESS', 'sa', '1', 'AracTakip', 1433);
selectQuery.Connection = Clomosy.DBSQLServerConnection;
AddDataToListView;
MyForm.Run;
}
Designer panel kısmını ve üstteki fonksiyonu yorum satırına aldığımda her şey düzgünce çalışıyor.