Clomosy Resmi Forum Sitesidir. Amacımız kullanıcılarımıza, iş ortaklarımıza, danışmanlara, yazılımcılara programlarımız hakkında destek ve bilgi vermektir. |
Data set kullanımı |
Yanıt Yaz |
Yazar | |
halilselvitopu
Yeni Üye Kayıt Tarihi: 24 Temmuz 2023 Konum: Konya Durum: Aktif Değil Puanlar: 10 |
Mesaj Seçenekleri
Yanıt Yaz
Alıntı halilselvitopu
Bu mesaj kurallara aykırıysa buradan yöneticileri bilgilendirebilirsiniz.
Gönderim Zamanı: 10 Ağustos 2023 Saat 09:19 |
Var
MyForm:TclForm; btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btn10,btn11,btn12,btn13,btn14,btn15,btn16,btn17,btn18,btn19,btn20 testBtn: TClProButton; myDeviceManager:TclDeviceManager; valueName:string; tahminsayifloat:Float; tahminsayi,girsayi,i,sira:Integer; ButtonZar:TclButton; testImg:TclImage; //Tanımlamalar procedure tmz; //Buton tıklanma için var i:Integer; But:TClProButton; begin for i:=1 to 18 do //18 tane buton begin But:=TClProButton(MyForm.clFindComponent('btn'+ IntToStr(i))); clComponent.SetupComponent(But,'{"BackgroundColor":"#ffffff"}'); But.enabled:=True; end; end; procedure c1 begin tmz; clComponent.SetupComponent(btn1,'{"BackgroundColor":"#BBEAFC"}'); btn1.enabled:=False; end; procedure c2 begin tmz; clComponent.SetupComponent(btn2,'{"BackgroundColor":"#BBEAFC"}'); btn2.enabled:=False;end;procedure c3 begin tmz; clComponent.SetupComponent(btn3,'{"BackgroundColor":"#BBEAFC"}'); btn3.enabled:=False; end; procedure c4 begin tmz; clComponent.SetupComponent(btn4,'{"BackgroundColor":"#BBEAFC"}'); btn4.enabled:=False; end; procedure c5 begin tmz; clComponent.SetupComponent(btn5,'{"BackgroundColor":"#BBEAFC"}'); btn5.enabled:=False; end; procedure c6 begin tmz; clComponent.SetupComponent(btn6,'{"BackgroundColor":"#BBEAFC"}'); btn6.enabled:=False; end; procedure c7 begin tmz; clComponent.SetupComponent(btn7,'{"BackgroundColor":"#BBEAFC"}'); btn7.enabled:=False; end; procedure c8 begin tmz; clComponent.SetupComponent(btn8,'{"BackgroundColor":"#BBEAFC"}'); btn8.enabled:=False; end; procedure c9 begin tmz; clComponent.SetupComponent(btn9,'{"BackgroundColor":"#BBEAFC"}'); btn9.enabled:=False;end; procedure c11 begin tmz; clComponent.SetupComponent(btn11,'{"BackgroundColor":"#BBEAFC"}'); btn11.enabled:=False; end; procedure c12 begin tmz; clComponent.SetupComponent(btn12,'{"BackgroundColor":"#BBEAFC"}'); btn12.enabled:=False; end; procedure c14 begin tmz; clComponent.SetupComponent(btn14,'{"BackgroundColor":"#BBEAFC"}'); btn14.enabled:=False; end; procedure c16 begin tmz; clComponent.SetupComponent(btn16,'{"BackgroundColor":"#BBEAFC"}'); btn16.enabled:=False; end; procedure c18 begin tmz; clComponent.SetupComponent(btn18,'{"BackgroundColor":"#BBEAFC"}'); btn18.enabled:=False; end; procedure clicked;//SQL e bağlanmak için begin Clomosy.RunUnit('monopoly'); end; procedure kodes;//kodes butonuna text koyak için tıklanma özelliği begin tmz; clComponent.SetupComponent(btn15,'{"BackgroundColor":"#BBEAFC"}'); ShowMessage('2 tur bekle'); btn15.enabled:=False; end; procedure gum;//gümrüe tıklanma ve text begin tmz; clComponent.SetupComponent(btn13,'{"BackgroundColor":"#BBEAFC"}'); ShowMessage('Gümrüğe takıldın 5000 TL ver'); btn13.enabled:=False;end; procedure sans; var q:int; WordMean:String; begin tmz; clComponent.SetupComponent(btn17,'{"BackgroundColor":"#BBEAFC"}'); btn17.enabled:=False; q:= clMath.GenerateRandom(0,10) ; case q of 0:WordMean:='Vergi borcunu ödemedin, haciz geldi 1000 TL öde'; 1:WordMean:='Başlangıç noktasına git'; 2:WordMean:='Kodese gir'; 3:WordMean:='Kodesten ücretsiz çık'; 4:WordMean:='3 hamle ileri git'; 5:WordMean:='5 hamle ileri git'; 6:WordMean:='2 hamle geri git'; 7:WordMean:='4 hamle geri git'; 8:WordMean:='Piyangodan 2000 TL kazandın'; 9:WordMean:='Şehrinde deprem oldu evlerinden biri yıkıldı'; 10:WordMean:='Doğum günün, bütün oyunculardan 500 TL al'; end; ShowMessage(WordMean); end; procedure py1; begin clComponent.SetupComponent(btn19,'{"BackgroundColor":"#BBEAFC"}'); clComponent.SetupComponent(btn20,'{"BackgroundColor":"#ffffff"}'); tmz; ShowMessage('Player 1 oynuyor'); btn19.enabled:=False; btn20.enabled:=True; end; procedure py2; begin clComponent.SetupComponent(btn19,'{"BackgroundColor":"#ffffff"}'); clComponent.SetupComponent(btn20,'{"BackgroundColor":"#BBEAFC"}'); tmz; ShowMessage('Player 2 oynuyor'); btn19.enabled:=True; btn20.enabled:=False; end; procedure viz;//vize butonu için tıklanma ve text begin tmz; clComponent.SetupComponent(btn10,'{"BackgroundColor":"#BBEAFC"}'); ShowMessage('Çıkmak için vize almalısın 2000 TL ver'); btn10.enabled:=False;end; Procedure ZarGorsel(a:Integer) begin if a=1 then //sırayla 1 se 2 ise şu görsel gelsin begin MyForm.SetImage(testImg,'https://i.hizliresim.com/fro63f6.png'); end; else if a = 2 then begin MyForm.SetImage(testImg,'https://i.hizliresim.com/egerynm.png'); end; else if a = 3 then begin MyForm.SetImage(testImg,'https://i.hizliresim.com/h73lzkk.png'); end; else if a = 4 then begin MyForm.SetImage(testImg,'https://i.hizliresim.com/lg7nxgm.png'); end; else if a = 5 then begin MyForm.SetImage(testImg,'https://i.hizliresim.com/fzz3x41.png'); end; else if a = 6 then begin MyForm.SetImage(testImg,'https://i.hizliresim.com/odqhg4l.png'); end; end; Procedure ButtonZarFonk;//butona random sayı gelmesi için begin tahminsayi:=clMath.generateRandom(1,6); ZarGorsel(tahminsayi); end; begin MyForm:=TclForm.Create(Self);//probutonların özellikleri ayarlandı myDeviceManager:=TclDeviceManager.Create; MyForm.SetFormBGImage('https://i.hizliresim.com/1suq52z.png');//arka plan fotosu btn1:=MyForm.AddNewProButton(MyForm,'btn1',''); clComponent.SetupComponent(btn1,'{"caption":"İNGİLTERE","MarginLeft":290,"MarginTop":500,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn2:=MyForm.AddNewProButton(MyForm,'btn2',''); clComponent.SetupComponent(btn2,'{"caption":"İTALYA","MarginLeft":600,"MarginTop":330,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn3:=MyForm.AddNewProButton(MyForm,'btn3',''); clComponent.SetupComponent(btn3,'{"caption":"TÜRKİYE","MarginLeft":-25,"MarginTop":500,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn4:=MyForm.AddNewProButton(MyForm,'btn4',''); clComponent.SetupComponent(btn4,'{"caption":"ALMANYA","MarginLeft":-655,"MarginTop":500,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn5:=MyForm.AddNewProButton(MyForm,'btn5',''); clComponent.SetupComponent(btn5,'{"caption":"KORE","MarginLeft":-340,"MarginTop":500,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn6:=MyForm.AddNewProButton(MyForm,'btn6',''); clComponent.SetupComponent(btn6,'{"caption":"FRANSA","MarginLeft":290,"MarginTop":-580,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn7:=MyForm.AddNewProButton(MyForm,'btn7',''); clComponent.SetupComponent(btn7,'{"caption":"BAŞLA","MarginLeft":600,"MarginTop":-405,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn8:=MyForm.AddNewProButton(MyForm,'btn8',''); clComponent.SetupComponent(btn8,'{"caption":"NORVEÇ","MarginLeft":-25,"MarginTop":-580,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn9:=MyForm.AddNewProButton(MyForm,'btn9',''); clComponent.SetupComponent(btn9,'{"caption":"ABD","MarginLeft":-655,"MarginTop":-580,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn10:=MyForm.AddNewProButton(MyForm,'btn10',''); clComponent.SetupComponent(btn10,'{"caption":"VİZE AL","MarginLeft":-340,"MarginTop":-580,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); MyForm.AddNewEvent(btn10,tbeOnClick,'viz'); btn11:=MyForm.AddNewProButton(MyForm,'btn11',''); clComponent.SetupComponent(btn11,'{"caption":"RUSYA","MarginLeft":-970,"MarginTop":-220,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn12:=MyForm.AddNewProButton(MyForm,'btn12',''); clComponent.SetupComponent(btn12,'{"caption":"MISIR","MarginLeft":-970,"MarginTop":-405,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn13:=MyForm.AddNewProButton(MyForm,'btn13',''); clComponent.SetupComponent(btn13,'{"caption":"GÜMRÜK KAPISI","MarginLeft":-970,"MarginTop":-37,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); MyForm.AddNewEvent(btn13,tbeOnClick,'gum'); btn14:=MyForm.AddNewProButton(MyForm,'btn14',''); clComponent.SetupComponent(btn14,'{"caption":"UKRAYNA","MarginLeft":-970,"MarginTop":145,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn15:=MyForm.AddNewProButton(MyForm,'btn15',''); clComponent.SetupComponent(btn15,'{"caption":"KODES","MarginLeft":-970,"MarginTop":330,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); MyForm.AddNewEvent(btn15,tbeOnClick,'kodes'); btn16:=MyForm.AddNewProButton(MyForm,'btn16',''); clComponent.SetupComponent(btn16,'{"caption":"ÇİN","MarginLeft":600,"MarginTop":-220,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn17:=MyForm.AddNewProButton(MyForm,'btn17',''); clComponent.SetupComponent(btn17,'{"caption":"ŞANS","MarginLeft":600,"MarginTop":145,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn18:=MyForm.AddNewProButton(MyForm,'btn18',''); clComponent.SetupComponent(btn18,'{"caption":"KANADA","MarginLeft":600,"MarginTop":-37,"Width":148,"Height":85,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn19:=MyForm.AddNewProButton(MyForm,'btn19',''); clComponent.SetupComponent(btn19,'{"caption":"Player 1","MarginLeft":1000,"MarginBottom":500,"Width":130,"Height":70,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); btn20:=MyForm.AddNewProButton(MyForm,'btn20',''); clComponent.SetupComponent(btn20,'{"caption":"Player 2","MarginLeft":1300,"MarginBottom":500,"Width":130,"Height":70,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); testImg:=MyForm.AddNewImage(MyForm,'testImg'); testImg.Margins.Left:=1150; testImg.Margins.Top:=190; testImg.Width:=80; testImg.Height:=80; MyForm.SetImage(testImg,'https://i.hizliresim.com/fro63f6.png');//zarda duruş görseli ButtonZar:=MyForm.AddNewButton(MyForm,'ButtonZar','Zar At');//zar at butonu ButtonZar.Margins.Left:=1150; ButtonZar.Margins.Top:=350; ButtonZar.Width:=80;ButtonZar.Height:=40;MyForm.AddNewEvent(ButtonZar,tbeOnClick,'ButtonZarFonk'); testBtn := MyForm.AddNewProButton(MyForm,'testBtn',''); clComponent.SetupComponent(testBtn,'{"caption":"Ülkeler","MarginLeft":1150,"MarginBottom":110,"Width" :200, "Height":70,"RoundHeight":2,"RoundWidth":2,"BorderColor":"#000000","BorderWidth":2}'); MyForm.AddNewEvent(testBtn,tbeOnClick,'clicked'); MyForm.AddNewEvent(btn1,tbeOnClick,'c1'); MyForm.AddNewEvent(btn2,tbeOnClick,'c2'); MyForm.AddNewEvent(btn3,tbeOnClick,'c3'); MyForm.AddNewEvent(btn4,tbeOnClick,'c4'); MyForm.AddNewEvent(btn5,tbeOnClick,'c5'); MyForm.AddNewEvent(btn6,tbeOnClick,'c6'); MyForm.AddNewEvent(btn7,tbeOnClick,'c7'); MyForm.AddNewEvent(btn8,tbeOnClick,'c8'); MyForm.AddNewEvent(btn9,tbeOnClick,'c9'); MyForm.AddNewEvent(btn11,tbeOnClick,'c11'); MyForm.AddNewEvent(btn12,tbeOnClick,'c12'); MyForm.AddNewEvent(btn14,tbeOnClick,'c14'); MyForm.AddNewEvent(btn16,tbeOnClick,'c16'); MyForm.AddNewEvent(btn17,tbeOnClick,'sans'); MyForm.AddNewEvent(btn18,tbeOnClick,'c18'); MyForm.AddNewEvent(btn19,tbeOnClick,'py1'); MyForm.AddNewEvent(btn20,tbeOnClick,'py2'); MyForm.Run; end;
UNIT2 KISMI SQL Var MyForm:TclForm; testListview : TClProListView; testDesignerPanel : TClProListViewDesignerPanel; isim,deger,kira : TClProLabel; procedure SetupSqlConnection; begin Clomosy.DBSQLServerConnect('SQL Server','192.168.22.44','sa','zeren93353','monopoly',50000); end; procedure AddDataToListview; Var foodListQuery : TClSqlQuery; begin foodListQuery := TClSqlQuery.Create(nil); try foodListQuery.Connection := Clomosy.DBSQLServerConnection; foodListQuery.SQL.Text := 'SELECT TOP (1000) [id] ,[isim] ,[deger] ,[kira] FROM [monopoly].[dbo].[arsa] '; foodListQuery.Open; if foodListQuery.Found then begin testListview.clLoadProListViewDataFromDataset(foodListQuery); end; finally foodListQuery.Close; foodListQuery.Free; end; end; procedure onItemClicked; begin ShowMessage('--'); end; procedure CreateDesignerPanel; begin testDesignerPanel := MyForm.AddNewProListViewDesignerPanel(testListview,'testDesignerPanel'); clComponent.SetupComponent(testDesignerPanel,'{"Height":100,"Width" : 150,"BackgroundColor":"#F6EDDB","BorderColor":"#F5BCC9","BorderWidth":2,"RoundHeight":20,"RoundWidth":20}'); testListview.SetDesignerPanel(testDesignerPanel); end; procedure CreateListView; begin testListview := MyForm.AddNewProListView(MyForm,'testListview'); testListview.Properties.ItemSpace := 10; clComponent.SetupComponent(testListview,'{"Height" : 150,"Align":"Client","MarginBottom":20,"MarginTop":20,"MarginRight":20,"MarginLeft":20, "ListType":"Cart","ItemColumnCount" : 2,"ItemHeight" : 150,"ItemWidth":150, "BorderColor":"#F5BCC9", "BorderWidth":2,"RoundWidth":5, "RoundHeight":5}'); testListview.ListType := 'horizontal'; MyForm.AddNewEvent(testListview,tbeOnItemClick,'onItemClicked'); end; procedure CreateProductNameAndPrice; begin isim := MyForm.AddNewProLabel(testDesignerPanel,'isim','test'); clComponent.SetupComponent(isim,'{"MarginTop":10,"MarginLeft":10,"MarginRight":10,"MarginBottom":10 ,"Height":20,"Align" : "MostTop"}'); testDesignerPanel.AddPanelObject(isim,clCaption); isim.Properties.AutoSize := True; deger := MyForm.AddNewProLabel(testDesignerPanel,'deger','test'); clComponent.SetupComponent(deger,'{"MarginTop":10,"MarginLeft":10,"MarginRight":10,"MarginBottom":10 ,"Height":20,"Align" : "MostRight","Width":40}'); testDesignerPanel.AddPanelObject(deger,clText); deger.Properties.AutoSize := True; kira := MyForm.AddNewProLabel(testDesignerPanel,'kira','test'); clComponent.SetupComponent(kira,'{"MarginTop":10,"MarginLeft":10,"MarginRight":10,"MarginBottom":10 ,"Height":20,"Align" : "Left","Width":40}'); testDesignerPanel.AddPanelObject(kira,clText1); kira.Properties.AutoSize := True; end; begin MyForm := TclForm.Create(Self); CreateListView; CreateDesignerPanel; SetupSqlConnection; CreateProductNameAndPrice; AddDataToListview; MyForm.Run; end; Bu monopoly örneğinde bakiyeleri tutmak için data set kullanmamız gerekiyor sanırım. Docdaki örneği kullandım fakat monopoly'e uyarlayamadım. Bunu sağlayabilmem için yardımcı olur musunuz? |
|
Alforce
Yeni Üye Kayıt Tarihi: 26 Temmuz 2023 Durum: Aktif Değil Puanlar: 150 |
Mesaj Seçenekleri
Teşekkürler(0)
|
Projenin nasıl çalıştığını bilmediğim için projene entegre edemedim.
Ama bunu yapmanın en kolay yöntemi birkaç tane senkronize liste kullanmaktır. Bunlar veri tabanının stünları gibidirler. Burda senin için basit bir örnek oluşturdum,. Bu temel mantık, genişletilmesi ise çok basitdir.
|
|
Yanıt Yaz | |
Tweet |
Forum Atla | Forum İzinleri Kapalı Foruma Yeni Konu Gönderme Kapalı Forumdaki Konulara Cevap Yazma Kapalı Forumda Cevapları Silme Kapalı Forumdaki Cevapları Düzenleme Kapalı Forumda Anket Açma Kapalı Forumda Anketlerde Oy Kullanma |