AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

cxGrid Anzahl selektierter Datensätze

Ein Thema von Mazen · begonnen am 9. Aug 2012 · letzter Beitrag vom 9. Aug 2012
 
Iwo Asnet

Registriert seit: 11. Jun 2011
313 Beiträge
 
#4

AW: cxGrid Anzahl selektierter Datensätze

  Alt 9. Aug 2012, 10:20
Doch.

Habe ein TdxMemData (drei zeilen mit testdaten), ein Datasource, ein TcxGrid mit einem DBGridTableView und einen Timer.

Beim Start zeigt mir der Timer, das 0 Reihen selektiert sind.
Klicke ich eine Zeile an dann ist N=1 und die selektierte Zeile wird angezeigt, bewege ich den Fokus mit den Cursortasten, bleibt die eins bestehen und ich sehe auch, welche Zeile selektiert ist.

Hier ein hingerotzter Test.
Delphi-Quellcode:
unit Unit14;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData,
  StdCtrls, ExtCtrls, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
  dxmdaset, cxGridLevel, cxClasses, cxGridCustomView, cxGrid;

type
  TForm14 = class(TForm)
    cxGrid1DBTableView1: TcxGridDBTableView;
    cxGrid1Level1: TcxGridLevel;
    cxGrid1: TcxGrid;
    DataSource1: TDataSource;
    dxMemData1: TdxMemData;
    dxMemData1Feld: TStringField;
    cxGrid1DBTableView1RecId: TcxGridDBColumn;
    cxGrid1DBTableView1Feld: TcxGridDBColumn;
    Timer1: TTimer;
    Label1: TLabel;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form14: TForm14;

implementation

{$R *.dfm}

procedure TForm14.Timer1Timer(Sender: TObject);
Var
  i : Integer;
  s : String;
begin
  s := IntToStr(cxGrid1DBTableView1.Controller.SelectedRowCount)+' rows selected: ';
  for I := 0 to cxGrid1DBTableView1.Controller.SelectedRowCount - 1 do
    s := s + VarToStr(cxGrid1DBTableView1.Controller.SelectedRows[i].Values[0])+', ';

  Label1.Caption := s;
end;

end.
Und die DFM.
Code:
object Form14: TForm14
  Left = 0
  Top = 0
  Caption = 'Form14'
  ClientHeight = 243
  ClientWidth = 527
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 169
    Top = 15
    Width = 31
    Height = 13
    Caption = 'Label1'
  end
  object cxGrid1: TcxGrid
    Left = 146
    Top = 41
    Width = 367
    Height = 200
    TabOrder = 0
    object cxGrid1DBTableView1: TcxGridDBTableView
      NavigatorButtons.ConfirmDelete = False
      DataController.DataSource = DataSource1
      DataController.Summary.DefaultGroupSummaryItems = <>
      DataController.Summary.FooterSummaryItems = <>
      DataController.Summary.SummaryGroups = <>
      OptionsSelection.MultiSelect = True
      object cxGrid1DBTableView1RecId: TcxGridDBColumn
        DataBinding.FieldName = 'RecId'
        Visible = False
      end
      object cxGrid1DBTableView1Feld: TcxGridDBColumn
        DataBinding.FieldName = 'Feld'
      end
    end
    object cxGrid1Level1: TcxGridLevel
      GridView = cxGrid1DBTableView1
    end
  end
  object DataSource1: TDataSource
    DataSet = dxMemData1
    Left = 257
    Top = 126
  end
  object dxMemData1: TdxMemData
    Active = True
    Indexes = <>
    Persistent.Data = {
      5665728FC2F5285C8FFE3F01000000140000000100050046656C640001010000
      0031010100000032010100000033}
    SortOptions = []
    Left = 318
    Top = 107
    object dxMemData1Feld: TStringField
      FieldName = 'Feld'
    end
  end
  object Timer1: TTimer
    Interval = 100
    OnTimer = Timer1Timer
    Left = 267
    Top = 136
  end
end
  Mit Zitat antworten Zitat
 

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:53 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz