Sayfayı Yazdır | Pencereyi Kapat

TclProListView

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Genel Programlama
Forum Adı: Genel İşlemler
Forum Tanımlaması: TRObject dili ile programlama yaparken karşılaşılan genel işlemler
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=871
Tarih: 08 Ocak 2025 Saat 00:18
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: TclProListView
Mesajı Yazan: Furblood
Konu: TclProListView
Mesaj Tarihi: 13 Ağustos 2024 Saat 17:43
Veriler ProListViewde gözükmüyor

Var   
  MyForm :TclForm;
  ListView1 : TClProListView;
  DesignerPanel1 : TClListViewDesignerPanel;
  name1,surname1,age1,city1,gender1,phone1 : TclProLabel;
  maleImg,femaleImg : TclProImage;
  Qry : TClSQLiteQuery;
  
void TaskClick;
{
  ShowMessage(' Item: ' + ListView1.clSelectedItemData(clText));
}

void CreateListView
{
  ListView1 = MyForm.AddNewProListView(MyForm,'ListView1');
  ListView1.Align = alContents;
  ListView1.clProSettings.ViewType = lvIcon; //(lvList, lvIcon, lvWaterFall)
  ListView1.clProSettings.ColCount = 1;
  ListView1.clProSettings.ItemHeight = 100;
  ListView1.clProSettings.ItemSpace = 10;
  ListView1.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#FFFCFF');
  ListView1.clProSettings.BorderColor = clAlphaColor.clHexToColor('#66FF7F');
  ListView1.clProSettings.BorderWidth = 2;
  ListView1.clProSettings.RoundHeight = 5;
  ListView1.clProSettings.RoundWidth = 5;
  ListView1.SetclProSettings(ListView1.clProSettings);
}

void CreateDesignerPanel
{
  DesignerPanel1 = MyForm.AddNewProListViewDesignerPanel(ListView1, 'DesignerPanel1');
  DesignerPanel1.Height = 100;
  DesignerPanel1.Width = 150;
  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);
}

void CreateData;
{
  name1 = MyForm.AddNewProLabel(DesignerPanel1, 'name1', 'test');
  name1.Align = alCenter;
  name1.Height = 30;
  name1.Width = 50;
  name1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  name1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(name1, clText);
  
  surname1 = MyForm.AddNewProLabel(DesignerPanel1, 'surname1', 'test2');
  surname1.Align = alCenter;
  surname1.Height = 30;
  surname1.Width = 50;
  surname1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  surname1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(surname1, clText1);
  
  age1 = MyForm.AddNewProLabel(DesignerPanel1, 'age1', 'test3');
  age1.Align = alCenter;
  age1.Height = 30;
  age1.Width = 50;
  age1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  age1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(age1, clText2);
  
  city1 = MyForm.AddNewProLabel(DesignerPanel1, 'city1', 'test4');
  city1.Align = alCenter;
  city1.Height = 30;
  city1.Width = 50;
  city1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  city1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(city1, clText3);
    
  gender1 = MyForm.AddNewProLabel(DesignerPanel1, 'gender1', 'test5');
  gender1.Align = alCenter;
  gender1.Height = 30;
  gender1.Width = 50;
  gender1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  gender1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(gender1, clText4);
  
  phone1 = MyForm.AddNewProLabel(DesignerPanel1, 'phone1', 'test6');
  phone1.Align = alCenter;
  phone1.Height = 30;
  phone1.Width = 50;
  phone1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  phone1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(phone1, clText5);
  
  MyForm.AddNewEvent(ListView1,tbeOnItemClick,'TaskClick');
}


void GetData;
  {
    try
      Qry = Clomosy.DBSQLiteQueryWith('SELECT userID as clRecord_GUID, NAME, SURNAME, AGE, CITY, GENDER, PHONE FROM Users');
      Qry.OpenOrExecute;
      if (Qry.Found)
      {
        name1 = Qry.FieldByName('NAME').AsString;
        surname1 = Qry.FieldByName('SURNAME').AsString;
        age1 = Qry.FieldByName('AGE').AsString;
        city1 = Qry.FieldByName('CITY').AsString;
        gender1 = Qry.FieldByName('GENDER').AsString;
        phone1 = Qry.FieldByName('PHONE').AsString;
        
        ListView1.clLoadProListViewDataFromDataset(Qry);
      }
      
    except
      ShowMessage('Exception class: '+LastExceptionClassName+' Exception Message: ' +LastExceptionMessage);
    } 
  }
  
  
  
{
  MyForm = TclForm.Create(Self);
  CreateListView;
  CreateDesignerPanel;
  CreateData;
  GetData;
  
  Clomosy.DBSQLiteConnect(Clomosy.AppFilesPath + 'GYM1.db3', '');
  
  MyForm.Run;
}



-------------
furkanfidan



Cevaplar:
Mesajı Yazan: Developer
Mesaj Tarihi: 14 Ağustos 2024 Saat 13:25
Merhaba Furkan,
Hataların;
*GetData prosedürünü sqlite bağlantıdan sonra açman gerekiyor. Oluşturduğun select 
SELECT userID as clRecord_GUID, NAME as name1, SURNAME as surname1, AGE as age1, CITY as  city1 , GENDER as gender1, PHONE as phone1 FROM Users 
şeklinde olmalı.
Kodlar:
Var   
  MyForm :TclForm;
  ListView1 : TClProListView;
  DesignerPanel1 : TClListViewDesignerPanel;
  name1,surname1,age1,city1,gender1,phone1 : TclProLabel;
  maleImg,femaleImg : TclProImage;
  Qry : TClSQLiteQuery;
  
void TaskClick;
{
  ShowMessage(' Item: ' + ListView1.clSelectedItemData(clText));
}

void CreateListView
{
  ListView1 = MyForm.AddNewProListView(MyForm,'ListView1');
  ListView1.Align = alContents;
  ListView1.clProSettings.ViewType = lvIcon; //(lvList, lvIcon, lvWaterFall)
  ListView1.clProSettings.ColCount = 1;
  ListView1.clProSettings.ItemHeight = 100;
  ListView1.clProSettings.ItemSpace = 10;
  ListView1.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#FFFCFF');
  ListView1.clProSettings.BorderColor = clAlphaColor.clHexToColor('#66FF7F');
  ListView1.clProSettings.BorderWidth = 2;
  ListView1.clProSettings.RoundHeight = 5;
  ListView1.clProSettings.RoundWidth = 5;
  ListView1.SetclProSettings(ListView1.clProSettings);
}

void CreateDesignerPanel
{
  DesignerPanel1 = MyForm.AddNewProListViewDesignerPanel(ListView1, 'DesignerPanel1');
  DesignerPanel1.Height = 100;
  DesignerPanel1.Width = 150;
  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);
}

void CreateData;
{
  name1 = MyForm.AddNewProLabel(DesignerPanel1, 'name1', 'test');
  name1.Align = alCenter;
  name1.Height = 30;
  name1.Width = 50;
  name1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  name1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(name1, clText);
  
  surname1 = MyForm.AddNewProLabel(DesignerPanel1, 'surname1', 'test2');
  surname1.Align = alCenter;
  surname1.Height = 30;
  surname1.Width = 50;
  surname1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  surname1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(surname1, clText1);
  
  age1 = MyForm.AddNewProLabel(DesignerPanel1, 'age1', 'test3');
  age1.Align = alCenter;
  age1.Height = 30;
  age1.Width = 50;
  age1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  age1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(age1, clText2);
  
  city1 = MyForm.AddNewProLabel(DesignerPanel1, 'city1', 'test4');
  city1.Align = alCenter;
  city1.Height = 30;
  city1.Width = 50;
  city1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  city1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(city1, clText3);
    
  gender1 = MyForm.AddNewProLabel(DesignerPanel1, 'gender1', 'test5');
  gender1.Align = alCenter;
  gender1.Height = 30;
  gender1.Width = 50;
  gender1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  gender1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(gender1, clText4);
  
  phone1 = MyForm.AddNewProLabel(DesignerPanel1, 'phone1', 'test6');
  phone1.Align = alCenter;
  phone1.Height = 30;
  phone1.Width = 50;
  phone1.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  phone1.clProSettings.FontSize = 15;
  DesignerPanel1.AddPanelObject(phone1, clText5);
  
  MyForm.AddNewEvent(ListView1,tbeOnItemClick,'TaskClick');
}


void GetData;
  {
    try
      Qry = Clomosy.DBSQLiteQueryWith('SELECT userID as clRecord_GUID, NAME, SURNAME, AGE, CITY, GENDER, PHONE FROM Users');
      Qry.OpenOrExecute;
      if (Qry.Found)
      {
        name1 = Qry.FieldByName('NAME').AsString;
        surname1 = Qry.FieldByName('SURNAME').AsString;
        age1 = Qry.FieldByName('AGE').AsString;
        city1 = Qry.FieldByName('CITY').AsString;
        gender1 = Qry.FieldByName('GENDER').AsString;
        phone1 = Qry.FieldByName('PHONE').AsString;
        
        ListView1.clLoadProListViewDataFromDataset(Qry);
      }
      
    except
      ShowMessage('Exception class: '+LastExceptionClassName+' Exception Message: ' +LastExceptionMessage);
    } 
  }
  
  
  
{
  MyForm = TclForm.Create(Self);
  CreateListView;
  CreateDesignerPanel;
  CreateData;
  GetData;
  
  Clomosy.DBSQLiteConnect(Clomosy.AppFilesPath + 'GYM1.db3', '');
  
  MyForm.Run;
}



Sayfayı Yazdır | Pencereyi Kapat

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net