Sayfayı Yazdır | Pencereyi Kapat

ProGrid

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=997
Tarih: 26 Nisan 2025 Saat 17:39
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: ProGrid
Mesajı Yazan: rxSfd
Konu: ProGrid
Mesaj Tarihi: 24 Nisan 2025 Saat 09:37
USES UGirisEkrani;

var
  Form1: TCLForm;
  ProGrid1: TCLProGrid;
  mainVertSB: TCLVertScrollBox;
  Label1,urlLbl,urlAciklama,frekans,delLabel: TCLLabel;
  urlEdit, aciklamaEdit, frekansEdit,delEdit: TclProEdit;
  ekleBtn,delBtn: TClProButton;
  endpointCombo: TClComboBox;
  I,J,K,y, secilenEndpointId: Integer;
  Unit5: TCLUnit;
  delQuery: TclSQLQuery;
  query: TclSQLQuery;
  FRow,FRow2: integer;
  FSender,FSender2: TCLProGrid;
  clickedUrl,clickedUrl2,selectime: String;

void goToDurumUnit;
{
  Unit5.UnitName = 'UEndpointDurum';
  Unit5.CallerForm = Form1;
  Unit5.Run;
}
void ProGridCellDblClick;
{
  FSender = TCLProGrid(Form1.ClSender);
  FRow = Form1.ClSenderRow;
  clickedUrl=FSender.Cells[3,FRow];
  J = FSender.Cells[0,Frow];
  secilenEndpointId=FSender.Cells[1,FRow];
  selectime=FSender.Cells[6,FRow];
  ShowMessage(clickedUrl);
  goToDurumUnit;
}

void ProGridCellClick;
{
  FSender = TCLProGrid(Form1.ClSender);
  FRow = Form1.ClSenderRow;
  clickedUrl=FSender.Cells[3,FRow];
}
void ekran;
{
  urlLbl = Form1.AddNewProLabel(Form1, 'urlLbl', 'Endpoint:');
  clComponent.SetupComponent(urlLbl, '{
    "Align" : "Center",
    "Width":160,
    "Height":45,
    "TextColor":"#8c8377",
    "TextSize":25, 
    "TextBold":"yes",
    "MarginBottom":500,
    "MarginRight":300,
    "BackgroundColor":"#fffaf2"
  }');

  urlEdit = Form1.AddNewProEdit(Form1, 'urlEdit', 'ENDPOINT');
  clComponent.SetupComponent(urlEdit, '{
    "Align" : "Center",
    "Width":250,
    "Height":45,
    "BorderColor":"#fffaf2",
    "MarginBottom":500,
    "MarginLeft":200,
    "TextColor":"#162207",
    "TextSize":30,
    "TextVerticalAlign":"center",
    "TextHorizontalAlign":"center", 
    "TextBold":"yes"
  }');
  
   urlAciklama = Form1.AddNewProLabel(Form1, 'urlAciklama', 'Not:');
  clComponent.SetupComponent(urlAciklama, '{
    "Align" : "Center",
    "Width":160,
    "Height":45,
    "TextColor":"#8c8377",
    "TextSize":25, 
    "TextBold":"yes",
    "MarginBottom":400,
    "MarginRight":300,
    "BackgroundColor":"#fffaf2"
  }');
  
  aciklamaEdit = Form1.AddNewProEdit(Form1, 'aciklamaEdit', 'NOT');
  clComponent.SetupComponent(aciklamaEdit, '{
    "Align" : "Center",
    "Width":250,
    "Height":45,
    "BorderColor":"#fffaf2",
    "MarginBottom":400,
    "MarginLeft":200,
    "TextColor":"#162207",
    "TextSize":30,
    "TextVerticalAlign":"center",
    "TextHorizontalAlign":"center", 
    "TextBold":"yes"
  }');
  
   frekans = Form1.AddNewProLabel(Form1, 'frekans', 'Frekans(Dk):');
  clComponent.SetupComponent(frekans, '{
    "Align" : "Center",
    "Width":160,
    "Height":45,
    "TextColor":"#8c8377",
    "TextSize":25, 
    "TextBold":"yes",
    "MarginBottom":300,
    "MarginRight":300,
    "BackgroundColor":"#fffaf2"
  }');
  /*
  delEdit = Form1.AddNewProEdit(Form1, 'delEdit', 'URL WILL DELETE');
  clComponent.SetupComponent(delEdit, '{
    "Align" : "Center",
    "Width":250,
    "Height":45,
    "BorderColor":"#fffaf2",
    "MarginBottom":300,
    "MarginLeft":200,
    "TextColor":"#162207",
    "TextSize":30,
    "TextVerticalAlign":"center",
    "TextHorizontalAlign":"center", 
    "TextBold":"yes"
  }');
  */
  /*endpointCombo = Form1.AddNewComboBox(Form1, 'endpointCombo');
  endpointCombo.Align = alTop;
  endpointCombo.Width = 100;
  endpointCombo.Height = 50;
  endpointCombo.Margins.Top = 500;
  endpointCombo.Margins.Left = 400;
  endpointCombo.Margins.Right = 200;
  */
  
  delLabel = Form1.AddNewProLabel(Form1, 'delLabel', 'Delete URL:');
  clComponent.SetupComponent(delLabel, '{
    "Align" : "Center",
    "Width":160,
    "Height":45,
    "TextColor":"#8c8377",
    "TextSize":25, 
    "TextBold":"yes",
    "MarginBottom":0,
    "MarginRight":300,
    "BackgroundColor":"#fffaf2"
  }');
  
  frekansEdit = Form1.AddNewProEdit(Form1, 'frekansEdit', 'Check Frekans');
  clComponent.SetupComponent(frekansEdit, '{
    "Align" : "Center",
    "Width":250,
    "Height":45,
    "BorderColor":"#fffaf2",
    "MarginBottom":300,
    "MarginLeft":200,
    "TextColor":"#162207",
    "TextSize":30,
    "TextVerticalAlign":"center",
    "TextHorizontalAlign":"center", 
    "TextBold":"yes"
  }');
}
void dbtoUrl;
{
  query.Sql.Text = 'SELECT * FROM Endpoints WHERE UserID = '+ QuotedStr(k);
  query.ExecSQL;
  ProGrid1.ConnectDataSet(query);
  Form1.AddNewEvent(ProGrid1,tbeOnProGridCellDblClick,'ProGridCellDblClick');
}
void chooseRowDelete;
{
   query.Sql.Text = 'Delete from Endpoints Where URL = ' + QuotedStr(clickedUrl);
   query.ExecSQL;
}
void Buttons;
{
  ekleBtn = Form1.AddNewProButton(Form1, 'ekleBtn', '');
  ekleBtn.Align = alCenter;
  ekleBtn.Width = 120;
  ekleBtn.Height = 65;
  ekleBtn.Margins.Bottom = 400;
  ekleBtn.Margins.Left = 470;
  ekleBtn.clProSettings.FontColor = clAlphaColor.clDarkorchid;
  ekleBtn.clProSettings.FontVertAlign = palcenter;
  ekleBtn.clProSettings.FontHorzAlign = palCenter;
  ekleBtn.clProSettings.TextSettings.Font.Style = [fsBold, fsItalic];
  ekleBtn.clProSettings.IsFill = True;
  ekleBtn.clProSettings.PictureSource = 'https://r.resimlink.com/miLGyHAJ9.png';
  ekleBtn.SetclProSettings(ekleBtn.clProSettings);
  Form1.AddNewEvent(ekleBtn, tbeOnClick, 'saveMethod');
  
  delBtn = Form1.AddNewProButton(Form1, 'delBtn', '');
  delBtn.Align = alCenter;
  delBtn.Width = 120;
  delBtn.Height = 65;
  //delBtn.Margins.Bottom = 100;
  delBtn.Margins.Left = 470;
  delBtn.clProSettings.FontColor = clAlphaColor.clDarkorchid;
  delBtn.clProSettings.FontVertAlign = palcenter;
  delBtn.clProSettings.FontHorzAlign = palCenter;
  delBtn.clProSettings.TextSettings.Font.Style = [fsBold, fsItalic];
  delBtn.clProSettings.IsFill = True;
  delBtn.clProSettings.PictureSource = 'https://r.resimlink.com/tkiJ-c72X4b.png';
  delBtn.SetclProSettings(delBtn.clProSettings);
  Form1.AddNewEvent(delBtn, tbeOnClick, 'chooseRowDelete');
}
void saveMethod;
var
  todayDate: TclDateTime;
{
  todayDate = Date;
  query.SQL.Text = 'INSERT INTO Endpoints (UserId, Url, Name, Frequency, CreatedDate, IsActive) ' +
                   'VALUES (' +
                   IntToStr(K) + ', ' +
                   '''' + urlEdit.Text + ''', ' +
                   '''' + aciklamaEdit.Text + ''', ' +
                   IntToStr(StrToInt(frekansEdit.Text)) + ', ' +
                   '''' + FormatDateTime('yyyy-MM-dd HH:nn:ss', todayDate) + ''', 1)';

  query.ExecSQL;

  ShowMessage('Endpoint başarıyla eklendi.');
  dbtoUrl;
}

{
  Form1 = TCLForm.Create(Self);
  Unit5 = TclUnit.Create;
  
  ekran();
  
  ProGrid1 = Form1.AddNewProGrid(Form1, 'ProGrid1');
  ProGrid1.AutoSizeColumns(False,200);
  ProGrid1.ColumnWidths[1] = 0;
  ProGrid1.ColumnWidths[2] = 120;
  ProGrid1.ColumnWidths[3] = 120;
  ProGrid1.ColumnWidths[4] = 130;
  ProGrid1.ColumnWidths[5] = 130;
  ProGrid1.ColumnWidths[6] = 130;
  ProGrid1.ColumnWidths[7] = 130;
  ProGrid1.BeginUpdate;
  
  with ProGrid1 do
  {
    Align = alTop;
    Margins.Right=10;
    Margins.LEFT=10;
    Margins.Bottom=10;
    Width=(Form1.clWidth*70)/100;
    Height=(Form1.clHeight*50)/100;
    NormalLayoutFillColor = clAlphaColor.clhextocolor('#fffb40');
    BandLayoutFillColor  = clAlphaColor.clhextocolor('#fffb40'); 
    SelectedLayoutFontColor = clAlphaColor.clHexToColor('#0555e4'); 
    SelectedLayoutFillColor = clAlphaColor.clHexToColor('#fffb40'); 
    FocusedLayoutFontColor = clAlphaColor.clHexToColor('#808080');   
    FocusedLayoutFillColor = clAlphaColor.clHexToColor('#808080'); 
    FixedLayoutFillColor = clAlphaColor.clHexToColor('#c0c0c0'); 
    FixedLayoutFontColor = clAlphaColor.clHexToColor('#0555e4'); 
   }
   
  ProGrid1.Options.Selection.Mode = smSingleRow;
  Form1.AddNewEvent(ProGrid1,tbeOnProGridCellClick,'ProGridCellClick');
  
/*
  ProGrid1.Cells[0, 0] = 'No';
  ProGrid1.Cells[1, 0] = 'URL';
  ProGrid1.Cells[2, 0] = 'İZLEME ARALIĞI';
  ProGrid1.Cells[3, 0] = 'AKTİF';
  ProGrid1.Cells[4, 0] = 'ACİKLAMA';
  ProGrid1.Cells[5, 0] = '****';
  ProGrid1.Cells[6, 0] = '****';
  ProGrid1.Cells[7, 0] = '****';
*/
  ProGrid1.EndUpdate;
  
   
  K = GirisId;

  ShowMessage(K);

  Buttons;
  
  ClRTSetProperty(Form1,'ClientWidth',660);
  ClRTSetProperty(Form1,'ClientHeight',990);
  Form1.Run;

  query = TclSQLQuery.Create(nil);
  Clomosy.DBSQLServerConnect('SQL Server', 'DESKTOP-2GVDU8F\FURKAN', 'sa', '******', 'fApp', 1433);
  query.Connection = Clomosy.DBSQLServerConnection;
  
   dbtoUrl;
}

burada 1 ve 2. sütunları gizlemek istiyorum.
ProGrid1.ColumnWidths[0] = 0;
ProGrid1.ColumnWidths[1] = 0;
Bu sekilde yaptıgımda herhangi bir şey değişmiyor.Sebebi nedir? DB'den direkt verileri cekip aynı zamanda sütunları kontrol edemiyor muyum?Cry



Cevaplar:
Mesajı Yazan: Developer
Mesaj Tarihi: 25 Nisan 2025 Saat 17:10
Merhaba rxSfd
SELECT Name, Frequency, CreatedDate, IsActive FROM Endpoints WHERE UserID = '+ QuotedStr(k) burada veri çekerken istediğini yapabilirsin. Bu şekilde grid gereksiz alanlar olmamış olur.



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