git-svn-id: https://192.168.0.254/svn/Componentes.Terceros.DevExpressVCL@7 05c56307-c608-d34a-929d-697000501d7a
168 lines
5.3 KiB
ObjectPascal
168 lines
5.3 KiB
ObjectPascal
unit SummaryGroupDemoMain;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
|
|
Dialogs, StdCtrls, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
|
cxGridDBTableView, cxControls, cxGridCustomView, cxGrid, cxCustomData,
|
|
ExtCtrls, ActnList, ImgList, Menus, ComCtrls, cxGridCustomPopupMenu,
|
|
cxGridPopupMenu, ToolWin, cxStyles, cxGraphics, cxFilter, cxData, cxEdit,
|
|
DB, cxDBData, cxClasses, cxDataStorage, cxDBLookupComboBox, cxCalendar,
|
|
cxImageComboBox, cxCalc, cxBlobEdit, cxSpinEdit, cxLookAndFeels;
|
|
|
|
type
|
|
TSummaryGroupDemoMainForm = class(TForm)
|
|
mmMain: TMainMenu;
|
|
miAbout: TMenuItem;
|
|
miFile: TMenuItem;
|
|
miOptions: TMenuItem;
|
|
miExit: TMenuItem;
|
|
miSummaries: TMenuItem;
|
|
sbMain: TStatusBar;
|
|
Grid: TcxGrid;
|
|
tvOrders: TcxGridDBTableView;
|
|
tvOrdersCustomerID: TcxGridDBColumn;
|
|
tvOrdersPurchaseDate: TcxGridDBColumn;
|
|
tvOrdersPaymentType: TcxGridDBColumn;
|
|
tvOrdersPaymentAmount: TcxGridDBColumn;
|
|
tvOrdersDescription: TcxGridDBColumn;
|
|
tvOrdersQuantity: TcxGridDBColumn;
|
|
lbDescription: TLabel;
|
|
miSelectedRecordOnly: TMenuItem;
|
|
miIgnoreNullValues: TMenuItem;
|
|
N1: TMenuItem;
|
|
miGroupFooter: TMenuItem;
|
|
miMultiSelect: TMenuItem;
|
|
miGroupFooterAlwaysShow: TMenuItem;
|
|
miGroupFooterNeverShow: TMenuItem;
|
|
miGroupFooterShowWhenExpand: TMenuItem;
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|
lvOrders: TcxGridLevel;
|
|
tvOrdersProductID: TcxGridDBColumn;
|
|
tvOrdersPurchaseMonth: TcxGridDBColumn;
|
|
LookAndFeelController: TcxLookAndFeelController;
|
|
procedure miAboutClick(Sender: TObject);
|
|
procedure miExitClick(Sender: TObject);
|
|
procedure miSelectedRecordsOnlyClick(Sender: TObject);
|
|
procedure miIgnoreNullValuesClick(Sender: TObject);
|
|
procedure miMultiSelectClick(Sender: TObject);
|
|
procedure GridFocusedViewChanged(Sender: TcxCustomGrid;
|
|
APrevFocusedView, AFocusedView: TcxCustomGridView);
|
|
procedure miGroupFooterShowClick(Sender: TObject);
|
|
procedure tvOrdersStylesGetGroupStyle(Sender: TcxGridTableView;
|
|
ARecord: TcxCustomGridRecord; ALevel: Integer; out AStyle: TcxStyle);
|
|
procedure FormShow(Sender: TObject);
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
SummaryGroupDemoMainForm: TSummaryGroupDemoMainForm;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
uses
|
|
SummaryGroupDemoData, AboutDemoForm;
|
|
|
|
procedure TSummaryGroupDemoMainForm.miAboutClick(Sender: TObject);
|
|
begin
|
|
ShowAboutDemoForm;
|
|
end;
|
|
|
|
procedure TSummaryGroupDemoMainForm.miExitClick(Sender: TObject);
|
|
begin
|
|
Close;
|
|
end;
|
|
|
|
procedure TSummaryGroupDemoMainForm.miSelectedRecordsOnlyClick(
|
|
Sender: TObject);
|
|
var
|
|
ASummary: TcxDataSummary;
|
|
begin
|
|
with Sender as TMenuItem do
|
|
Checked := not Checked;
|
|
ASummary := Grid.FocusedView.DataController.Summary;
|
|
if (Sender as TMenuItem).Checked then
|
|
ASummary.Options := ASummary.Options + [soSelectedRecords]
|
|
else
|
|
ASummary.Options := ASummary.Options - [soSelectedRecords];
|
|
end;
|
|
|
|
procedure TSummaryGroupDemoMainForm.miIgnoreNullValuesClick(
|
|
Sender: TObject);
|
|
var
|
|
ASummary: TcxDataSummary;
|
|
begin
|
|
with Sender as TMenuItem do
|
|
Checked := not Checked;
|
|
ASummary := Grid.FocusedView.DataController.Summary;
|
|
if (Sender as TMenuItem).Checked then
|
|
ASummary.Options := ASummary.Options + [soNullIgnore]
|
|
else
|
|
ASummary.Options := ASummary.Options - [soNullIgnore];
|
|
end;
|
|
|
|
procedure TSummaryGroupDemoMainForm.miMultiSelectClick(Sender: TObject);
|
|
var
|
|
AView: TcxGridDBTableView;
|
|
begin
|
|
with Sender as TMenuItem do
|
|
Checked := not Checked;
|
|
AView := TcxGridDBTableView(Grid.FocusedView);
|
|
AView.OptionsSelection.MultiSelect := (Sender as TMenuItem).Checked;
|
|
end;
|
|
|
|
procedure TSummaryGroupDemoMainForm.GridFocusedViewChanged(
|
|
Sender: TcxCustomGrid; APrevFocusedView,
|
|
AFocusedView: TcxCustomGridView);
|
|
var
|
|
AView: TcxGridDBTableView;
|
|
begin
|
|
AView := TcxGridDBTableView(Grid.FocusedView);
|
|
miSelectedRecordOnly.Checked := soSelectedRecords in
|
|
AView.DataController.Summary.Options;
|
|
miIgnoreNullValues.Checked := soNullIgnore in
|
|
AView.DataController.Summary.Options;
|
|
miMultiSelect.Checked := AView.OptionsSelection.MultiSelect;
|
|
miGroupFooterAlwaysShow.Checked :=
|
|
AView.OptionsView.GroupFooters = gfAlwaysVisible;
|
|
miGroupFooterNeverShow.Checked :=
|
|
AView.OptionsView.GroupFooters = gfInvisible;
|
|
miGroupFooterShowWhenExpand.Checked :=
|
|
AView.OptionsView.GroupFooters = gfVisibleWhenExpanded;
|
|
end;
|
|
|
|
procedure TSummaryGroupDemoMainForm.miGroupFooterShowClick(Sender: TObject);
|
|
var
|
|
AView: TcxGridDBTableView;
|
|
begin
|
|
(Sender as TMenuItem).Checked := True;
|
|
AView := TcxGridDBTableView(Grid.FocusedView);
|
|
AView.OptionsView.GroupFooters :=
|
|
TcxGridGroupFootersMode(Byte((Sender as TMenuItem).Tag));
|
|
end;
|
|
|
|
procedure TSummaryGroupDemoMainForm.tvOrdersStylesGetGroupStyle(
|
|
Sender: TcxGridTableView; ARecord: TcxCustomGridRecord; ALevel: Integer;
|
|
out AStyle: TcxStyle);
|
|
begin
|
|
if (ALevel mod 2) = 0 then
|
|
AStyle := SummaryGroupDemoDataDM.stGreyLight
|
|
else
|
|
AStyle := SummaryGroupDemoDataDM.stBlueSky;
|
|
end;
|
|
|
|
procedure TSummaryGroupDemoMainForm.FormShow(Sender: TObject);
|
|
begin
|
|
if SummaryGroupDemoDataDM.tblOrders.Active then
|
|
begin
|
|
tvOrders.DataController.Groups.FullExpand;
|
|
tvOrders.Controller.GoToFirst;
|
|
end;
|
|
end;
|
|
|
|
end.
|