cxgrid multi select

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
uzanet
Üye
Mesajlar: 2
Kayıt: 18 Eyl 2011 08:08

cxgrid multi select

Mesaj gönderen uzanet »

öncelikle merhabalar uzun süredir araştıma yapıyorum fakat sonuca ulaşamadığıdan dolayı en son buraya yazmaya karar verdim.
cxgride datasource den kayıtları çekiyor ve listeliyorum ve bir tane column ekledim ve databinding den valutype i bolean yaptım ayrıca aynı columun propertiesinide checkbox yaptım. ayrıca cxGrid1DBBandedTableView1 in TcxGridTableOptionsSelection tabından ise multiselect,cellseleck,sellmultiseleck kısımlarını ise true yaptım formu çalııştırdığımda kayıtların en sağında checkbox görünüyor fakat gelen 10 adet kayıt var ve ben bunları tek tek ctrl ye basmadan seçmek istiyorum yada tümü seçimli gelsin kullanıcı seçimleri kaldırsın istiyorum fakat checkbox tıkladığınızda seçiliyor hemen altındaki kayıta tıklandığında ise önceki seçimim uncheck halini alıyor.Lütfen bilgisi olan arkadaşlardan yardım talep ediyorum.sorunumu zannediyorum ayrıntılı şekilde anlattım.saygılar.
Kullanıcı avatarı
adelphiforumz
Üye
Mesajlar: 602
Kayıt: 01 Nis 2008 05:38
Konum: İstanbul

Re: cxgrid multi select

Mesaj gönderen adelphiforumz »

Selamlar
Ben genelde gridleri memdata ile kullanıyorum
ekte basit bir örnek yapmaya çalıştım umarım fikir verir.

Kod: Tümünü seç

unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
  cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,  cxStyles, cxCustomData, cxFilter,
  cxData, cxDataStorage, cxEdit, cxNavigator, Data.DB, cxDBData, cxCheckBox, cxGridBandedTableView,
  cxGridDBBandedTableView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
  cxClasses, cxGridCustomView,  cxGrid, dxmdaset;

type
  TForm2 = class(TForm)
    memData: TdxMemData;
    DsMemData: TDataSource;
    memDataId: TIntegerField;
    memDataTanim: TStringField;
    memDataSec: TBooleanField;
    cxGrid1DBTableView1: TcxGridDBTableView;
    cxGrid1Level1: TcxGridLevel;
    cxGrid1: TcxGrid;
    cxGrid1DBTableView1RecId: TcxGridDBColumn;
    cxGrid1DBTableView1Id: TcxGridDBColumn;
    cxGrid1DBTableView1Tanim: TcxGridDBColumn;
    cxGrid1DBTableView1Sec: TcxGridDBColumn;
    cxGrid2Level1: TcxGridLevel;
    cxGrid2: TcxGrid;
    cxGrid2DBBandedTableView1: TcxGridDBBandedTableView;
    cxGrid2DBBandedTableView1RecId: TcxGridDBBandedColumn;
    cxGrid2DBBandedTableView1Id: TcxGridDBBandedColumn;
    cxGrid2DBBandedTableView1Tanim: TcxGridDBBandedColumn;
    cxGrid2DBBandedTableView1Sec: TcxGridDBBandedColumn;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

end.

Kod: Tümünü seç

object Form2: TForm2
  Left = 0
  Top = 0
  Caption = 'Form2'
  ClientHeight = 322
  ClientWidth = 651
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object cxGrid1: TcxGrid
    Left = 8
    Top = 8
    Width = 273
    Height = 283
    TabOrder = 0
    object cxGrid1DBTableView1: TcxGridDBTableView
      Navigator.Buttons.CustomButtons = <>
      DataController.DataSource = DsMemData
      DataController.Summary.DefaultGroupSummaryItems = <>
      DataController.Summary.FooterSummaryItems = <>
      DataController.Summary.SummaryGroups = <>
      object cxGrid1DBTableView1RecId: TcxGridDBColumn
        DataBinding.FieldName = 'RecId'
        Visible = False
        Options.Editing = False
      end
      object cxGrid1DBTableView1Id: TcxGridDBColumn
        DataBinding.FieldName = 'Id'
        Options.Editing = False
      end
      object cxGrid1DBTableView1Tanim: TcxGridDBColumn
        DataBinding.FieldName = 'Tanim'
        Options.Editing = False
      end
      object cxGrid1DBTableView1Sec: TcxGridDBColumn
        DataBinding.FieldName = 'Sec'
        PropertiesClassName = 'TcxCheckBoxProperties'
        Properties.NullStyle = nssUnchecked
        Width = 45
      end
    end
    object cxGrid1Level1: TcxGridLevel
      GridView = cxGrid1DBTableView1
    end
  end
  object cxGrid2: TcxGrid
    Left = 328
    Top = 16
    Width = 305
    Height = 275
    TabOrder = 1
    object cxGrid2DBBandedTableView1: TcxGridDBBandedTableView
      Navigator.Buttons.CustomButtons = <>
      DataController.DataSource = DsMemData
      DataController.Summary.DefaultGroupSummaryItems = <>
      DataController.Summary.FooterSummaryItems = <>
      DataController.Summary.SummaryGroups = <>
      Bands = <
        item
        end>
      object cxGrid2DBBandedTableView1RecId: TcxGridDBBandedColumn
        DataBinding.FieldName = 'RecId'
        Visible = False
        Position.BandIndex = 0
        Position.ColIndex = 0
        Position.RowIndex = 0
      end
      object cxGrid2DBBandedTableView1Id: TcxGridDBBandedColumn
        DataBinding.FieldName = 'Id'
        Options.Editing = False
        Position.BandIndex = 0
        Position.ColIndex = 1
        Position.RowIndex = 0
      end
      object cxGrid2DBBandedTableView1Tanim: TcxGridDBBandedColumn
        DataBinding.FieldName = 'Tanim'
        Options.Editing = False
        Position.BandIndex = 0
        Position.ColIndex = 2
        Position.RowIndex = 0
      end
      object cxGrid2DBBandedTableView1Sec: TcxGridDBBandedColumn
        DataBinding.FieldName = 'Sec'
        PropertiesClassName = 'TcxCheckBoxProperties'
        Properties.NullStyle = nssUnchecked
        Position.BandIndex = 0
        Position.ColIndex = 3
        Position.RowIndex = 0
      end
    end
    object cxGrid2Level1: TcxGridLevel
      GridView = cxGrid2DBBandedTableView1
    end
  end
  object memData: TdxMemData
    Active = True
    Indexes = <>
    Persistent.Data = {
      5665728FC2F5285C8FFE3F030000000400000003000300496400140000000100
      060054616E696D00020000000500040053656300010100000001030000004141
      4100000001020000000103000000424242000000010300000001030000004343
      4300000001040000000103000000444444000000010400000001030000004545
      45000000}
    SortOptions = []
    Left = 288
    Top = 16
    object memDataId: TIntegerField
      FieldName = 'Id'
    end
    object memDataTanim: TStringField
      FieldName = 'Tanim'
    end
    object memDataSec: TBooleanField
      FieldName = 'Sec'
    end
  end
  object DsMemData: TDataSource
    DataSet = memData
    Left = 288
    Top = 80
  end
end

Ehil olmayanlara sabretmek ehil olanları parlatır.
Akıllı birisinden gelen cefa, bilgisizlerin vefasından iyidir.
Bilgiye ulaştı mı ayak, kanat olur
Biz insanı kıyafetiyle ağırlar bilgisiyle uğurlarız.
Mevlana
Cevapla