![]() |
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. |
listedeki elemanlara tıklama |
Yanıt Yaz ![]() |
Yazar | |
goksuselvi ![]() Yeni Üye ![]() ![]() Kayıt Tarihi: 07 Temmuz 2025 Konum: konya Durum: Aktif Değil Puanlar: 8 |
![]() Yanıt Yaz
Alıntı goksuselvi
Bu mesaj kurallara aykırıysa buradan yöneticileri bilgilendirebilirsiniz.
![]() ![]() ![]() ![]() Gönderim Zamanı: 4 Saat 45 Dakika Önce Saat 22:37 |
var analizForm: TclForm; MainPnl: TCLProPanel; ListView1: TClProListView; DesignerPanel1: TClProListViewDesignerPanel; habitLabel: TClProLabel; addBtn: TClProButton; Edit1: TClProEdit; Qry: TClSQLiteQuery; habitId, habitName:TClProLabel; void SqLiteInsertData; { try Clomosy.DBSQLiteQuery.Sql.Text = ' INSERT INTO Habits (habitId, habitName) VALUES (1, ''İngilizce Çalışmak''); INSERT INTO Habits (habitId, habitName) VALUES (2, ''Spor Yapmak''); INSERT INTO Habits (habitId, habitName) VALUES (3, ''Meditasyon''); INSERT INTO Habits (habitId, habitName) VALUES (4, ''Kitap Okumak'');'; Clomosy.DBSQLiteQuery.OpenOrExecute; ShowMessage('Adding data to the table was successful!'); except ShowMessage('Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage); } } void SqLiteConnectionCreateTable; var TableExists: Boolean; { try Clomosy.DBSQLiteConnect(Clomosy.AppFilesPath + 'DBHabits.db3', ''); // Check if the table exists Clomosy.DBSQLiteQuery.Sql.Text = 'SELECT name FROM sqlite_master WHERE type="table" AND name="Habits";'; Clomosy.DBSQLiteQuery.OpenOrExecute; // Check the results TableExists = not Clomosy.DBSQLiteQuery.Eof; // Create the table if it does not exist if not (TableExists) { Clomosy.DBSQLiteQuery.Sql.Text = 'CREATE TABLE Habits(habitId INTEGER NOT NULL, habitName TEXT NOT NULL, PRIMARY KEY (habitId))'; Clomosy.DBSQLiteQuery.OpenOrExecute; ShowMessage('Table successfully added to the database!'); SqLiteInsertData; } else { ShowMessage('The habits table already exists.'); } except ShowMessage('Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage); } } void GetData; var Qry : TClSQLiteQuery; { try Qry = Clomosy.DBSQLiteQueryWith('SELECT habitId as clRecord_GUID, habitName from Habits'); Qry.OpenOrExecute; if (Qry.Found) { ListView1.clLoadProListViewDataFromDataset(Qry); } except ShowMessage('Exception class: '+LastExceptionClassName+' Exception Message: ' +LastExceptionMessage); } } // -------------------------------------------------------------------- // HABIT EKLE void AddHabit { try Clomosy.DBSQLiteConnect(Clomosy.AppFilesPath + 'DBHabits.db3', ''); Clomosy.DBSQLiteQuery.Sql.Text = 'INSERT INTO Habits (habitName) VALUES (' + QuotedStr(Edit1.Text) + ')'; Clomosy.DBSQLiteQuery.OpenOrExecute; ShowMessage('Alışkanlık eklendi: ' + Edit1.Text); //LoadHabitsToListView; except ShowMessage('Ekleme hatası: ' + LastExceptionMessage); } } // -------------------------------------------------------------------- // LİSTEVIEW TASARIM PANELİ void CreateDesignerPanel { DesignerPanel1 = analizForm.AddNewProListViewDesignerPanel(ListView1, 'DesignerPanel1'); DesignerPanel1.Height = 100; DesignerPanel1.Width = 200; DesignerPanel1.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#B3FCE5'); DesignerPanel1.clProSettings.BorderColor = clAlphaColor.clHexToColor('#16FF8C'); DesignerPanel1.clProSettings.BorderWidth = 2; DesignerPanel1.clProSettings.RoundHeight = 20; DesignerPanel1.clProSettings.RoundWidth = 20; DesignerPanel1.SetclProSettings(DesignerPanel1.clProSettings); ListView1.SetDesignerPanel(DesignerPanel1); habitName = analizForm.AddNewProLabel(DesignerPanel1, 'habitName', '-'); habitName.Align = alClient; habitName.clProSettings.FontSize = 20; habitName.Margins.Top = 10; habitName.Margins.Left = 10; habitname.SetclProSettings(habitname.clProSettings); DesignerPanel1.AddPanelObject(habitname, clText); } // -------------------------------------------------------------------- // LİSTEVIEW OLUŞTUR void CreateListView { ListView1 = analizForm.AddNewProListView(MainPnl, 'ListView1'); ListView1.Align = alClient; ListView1.Margins.Bottom = 20; ListView1.Margins.Top = 20; ListView1.Margins.Right = 20; ListView1.Margins.Left = 20; ListView1.clProSettings.ViewType = lvIcon; ListView1.clProSettings.ColCount = 1; ListView1.clProSettings.ItemHeight = 100; ListView1.clProSettings.ItemSpace = 10; ListView1.clProSettings.RoundHeight = 5; ListView1.clProSettings.RoundWidth = 5; ListView1.SetclProSettings(ListView1.clProSettings); } // -------------------------------------------------------------------- // BUTON CLICK EVENTİ void OnAddBtnClick { AddHabit; } { analizForm = TclForm.Create(Self); MainPnl = analizForm.AddNewProPanel(analizForm, 'MainPnl'); MainPnl.Align = alClient; Edit1 = analizForm.AddNewProEdit(MainPnl, 'Edit1', 'Write something...'); Edit1.Align = alTop; Edit1.Height = 50; Edit1.Margins.Top = 20; Edit1.Margins.Left = 20; Edit1.Margins.Right = 20; Edit1.clProSettings.BackGroundColor = clAlphaColor.clHexToColor('#CDB4DB'); Edit1.clProSettings.IsTransparent = True; Edit1.clProSettings.IsFill = False; Edit1.clProSettings.IsRound = True; Edit1.clProSettings.RoundHeight = 20; Edit1.clProSettings.RoundWidth = 20; Edit1.clProSettings.FontSize = 16; Edit1.clProSettings.FontColor = clAlphaColor.clHexToColor('#ffffff'); Edit1.clProSettings.BorderColor = clAlphaColor.clHexToColor('#ffffff'); Edit1.SetclProSettings(Edit1.clProSettings); addBtn = analizForm.AddNewProButton(MainPnl, 'addBtn', 'Ekle'); addBtn.Align = alBottom; addBtn.Height = 50; addBtn.clProSettings.IsRound = True; addBtn.SetclProSettings(addBtn.clProSettings); analizForm.AddNewEvent(addBtn, tbeOnClick, 'OnAddBtnClick'); CreateListView; CreateDesignerPanel; SqLiteConnectionCreateTable; GetData; analizForm.Run; } //////analizform.AddNewEvent(ListView1, tbeOnItemClick, 'onItemClicked'); void onItemClicked { habitname.Text = clGetStringAfter(PListView.clSelectedItemData(clText), ': '); } //// bu yapıyı kullanmaya çalıştım her bir alışkanlığa bastığımda yeni bir unit için ama kendi kodumda yapamadım yardımcı olursanız sevinirim |
|
göksu
|
|
![]() |
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 |