Стартовый пул
This commit is contained in:
BIN
RXLib/demos/rxdbgrid/MergeCell/project1.ico
Normal file
BIN
RXLib/demos/rxdbgrid/MergeCell/project1.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
86
RXLib/demos/rxdbgrid/MergeCell/project1.lpi
Normal file
86
RXLib/demos/rxdbgrid/MergeCell/project1.lpi
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="10"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="project1"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="5">
|
||||
<Item1>
|
||||
<PackageName Value="rxdbgrid_print"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="rxdbgrid_export_spreadsheet"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="FCL"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<PackageName Value="rxnew"/>
|
||||
</Item4>
|
||||
<Item5>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item5>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
21
RXLib/demos/rxdbgrid/MergeCell/project1.lpr
Normal file
21
RXLib/demos/rxdbgrid/MergeCell/project1.lpr
Normal file
@@ -0,0 +1,21 @@
|
||||
program project1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, rxnew, Unit1
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
263
RXLib/demos/rxdbgrid/MergeCell/unit1.lfm
Normal file
263
RXLib/demos/rxdbgrid/MergeCell/unit1.lfm
Normal file
@@ -0,0 +1,263 @@
|
||||
object Form1: TForm1
|
||||
Left = 574
|
||||
Height = 620
|
||||
Top = 316
|
||||
Width = 770
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 620
|
||||
ClientWidth = 770
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '1.9.0.0'
|
||||
object RxDBGrid1: TRxDBGrid
|
||||
Left = 0
|
||||
Height = 570
|
||||
Top = 50
|
||||
Width = 770
|
||||
ColumnDefValues.BlobText = '(данные)'
|
||||
TitleButtons = False
|
||||
AutoSort = True
|
||||
Columns = <
|
||||
item
|
||||
Alignment = taCenter
|
||||
Title.Alignment = taCenter
|
||||
Title.Orientation = toHorizontal
|
||||
Title.Caption = 'CODE'
|
||||
Width = 60
|
||||
FieldName = 'CODE'
|
||||
EditButtons = <>
|
||||
Filter.DropDownRows = 0
|
||||
Filter.EmptyValue = '(Пусто)'
|
||||
Filter.AllValue = '(Все значения)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
Footers = <>
|
||||
WordWrap = True
|
||||
OnDrawColumnCell = RxDBGrid1Columns0DrawColumnCell
|
||||
end
|
||||
item
|
||||
Title.Alignment = taCenter
|
||||
Title.Orientation = toHorizontal
|
||||
Title.Caption = 'DATE'
|
||||
Width = 90
|
||||
FieldName = 'DATE'
|
||||
EditButtons = <>
|
||||
Filter.DropDownRows = 0
|
||||
Filter.EmptyValue = '(Пусто)'
|
||||
Filter.AllValue = '(Все значения)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
Footers = <>
|
||||
end
|
||||
item
|
||||
Title.Alignment = taCenter
|
||||
Title.Orientation = toHorizontal
|
||||
Title.Caption = 'NAME'
|
||||
Width = 400
|
||||
FieldName = 'NAME'
|
||||
EditButtons = <>
|
||||
Filter.DropDownRows = 0
|
||||
Filter.EmptyValue = '(Пусто)'
|
||||
Filter.AllValue = '(Все значения)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
Footers = <>
|
||||
end>
|
||||
KeyStrokes = <
|
||||
item
|
||||
Command = rxgcShowFindDlg
|
||||
ShortCut = 16454
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcShowColumnsDlg
|
||||
ShortCut = 16471
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcShowFilterDlg
|
||||
ShortCut = 16468
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcShowSortDlg
|
||||
ShortCut = 16467
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcShowQuickFilter
|
||||
ShortCut = 16465
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcHideQuickFilter
|
||||
ShortCut = 16456
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcSelectAll
|
||||
ShortCut = 16449
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcDeSelectAll
|
||||
ShortCut = 16429
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcInvertSelection
|
||||
ShortCut = 16426
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcOptimizeColumnsWidth
|
||||
ShortCut = 16427
|
||||
Enabled = True
|
||||
end
|
||||
item
|
||||
Command = rxgcCopyCellValue
|
||||
ShortCut = 16451
|
||||
Enabled = True
|
||||
end>
|
||||
FooterOptions.DrawFullLine = False
|
||||
SearchOptions.QuickSearchOptions = [loCaseInsensitive, loPartialKey]
|
||||
SearchOptions.FromStart = False
|
||||
OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgAllowQuickFilter, rdgAllowToolMenu]
|
||||
Align = alClient
|
||||
Color = clWindow
|
||||
DrawFullLine = False
|
||||
FocusColor = clRed
|
||||
SelectedColor = clHighlight
|
||||
GridLineStyle = psSolid
|
||||
DataSource = dsData
|
||||
Options = [dgEditing, dgTitles, dgIndicator, dgColumnResize, dgColumnMove, dgColLines, dgRowLines, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit]
|
||||
TabOrder = 0
|
||||
OnMergeCells = RxDBGrid1MergeCells
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 50
|
||||
Top = 0
|
||||
Width = 770
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
ClientHeight = 50
|
||||
ClientWidth = 770
|
||||
TabOrder = 1
|
||||
object CheckBox1: TCheckBox
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = Panel1
|
||||
Left = 7
|
||||
Height = 24
|
||||
Top = 7
|
||||
Width = 108
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Col spanning'
|
||||
OnChange = CheckBox1Change
|
||||
TabOrder = 0
|
||||
end
|
||||
object Button1: TButton
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 694
|
||||
Height = 36
|
||||
Top = 7
|
||||
Width = 69
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Export...'
|
||||
OnClick = Button1Click
|
||||
TabOrder = 1
|
||||
end
|
||||
object Button2: TButton
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideRight.Control = Button1
|
||||
Left = 643
|
||||
Height = 36
|
||||
Top = 7
|
||||
Width = 45
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Print'
|
||||
OnClick = Button2Click
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
object rxData: TRxMemoryData
|
||||
FieldDefs = <
|
||||
item
|
||||
Name = 'CODE'
|
||||
DataType = ftInteger
|
||||
end
|
||||
item
|
||||
Name = 'DATE'
|
||||
DataType = ftDateTime
|
||||
end
|
||||
item
|
||||
Name = 'NAME'
|
||||
DataType = ftString
|
||||
Size = 150
|
||||
end>
|
||||
PacketRecords = 0
|
||||
Left = 293
|
||||
Top = 165
|
||||
object rxDataCODE: TLongintField
|
||||
FieldKind = fkData
|
||||
FieldName = 'CODE'
|
||||
Index = 0
|
||||
LookupCache = False
|
||||
ProviderFlags = [pfInUpdate, pfInWhere]
|
||||
ReadOnly = False
|
||||
Required = False
|
||||
end
|
||||
object rxDataDATE: TDateTimeField
|
||||
FieldKind = fkData
|
||||
FieldName = 'DATE'
|
||||
Index = 1
|
||||
LookupCache = False
|
||||
ProviderFlags = [pfInUpdate, pfInWhere]
|
||||
ReadOnly = False
|
||||
Required = False
|
||||
DisplayFormat = 'dd.mm.yyyy'
|
||||
end
|
||||
object rxDataNAME: TStringField
|
||||
FieldKind = fkData
|
||||
FieldName = 'NAME'
|
||||
Index = 2
|
||||
LookupCache = False
|
||||
ProviderFlags = [pfInUpdate, pfInWhere]
|
||||
ReadOnly = False
|
||||
Required = False
|
||||
Size = 150
|
||||
end
|
||||
end
|
||||
object dsData: TDataSource
|
||||
DataSet = rxData
|
||||
Left = 256
|
||||
Top = 165
|
||||
end
|
||||
object RxDBGridExportSpreadSheet1: TRxDBGridExportSpreadSheet
|
||||
RxDBGrid = RxDBGrid1
|
||||
Caption = 'Экспорт в электронную таблицу'
|
||||
ShowSetupForm = True
|
||||
FileName = 'aaa.ods'
|
||||
PageName = 'Test1'
|
||||
Options = [ressExportTitle, ressExportColors, ressExportFooter, ressExportFormula, ressOverwriteExisting, ressExportSelectedRows, ressHideZeroValues, ressColSpanning]
|
||||
OpenAfterExport = True
|
||||
Left = 336
|
||||
Top = 165
|
||||
end
|
||||
object RxDBGridPrint1: TRxDBGridPrint
|
||||
RxDBGrid = RxDBGrid1
|
||||
Caption = 'Печать списка'
|
||||
ShowSetupForm = True
|
||||
Options = [rxpoShowTitle, rxpoShowFooter, rxpoShowGridColor, rxpoShowFooterColor, rxpoShowReportTitle, rxpoHideZeroValues]
|
||||
ShowProgress = True
|
||||
ReportTitle = 'A'
|
||||
ShowColumnHeaderOnAllPage = True
|
||||
Left = 336
|
||||
Top = 208
|
||||
end
|
||||
end
|
110
RXLib/demos/rxdbgrid/MergeCell/unit1.pas
Normal file
110
RXLib/demos/rxdbgrid/MergeCell/unit1.pas
Normal file
@@ -0,0 +1,110 @@
|
||||
unit Unit1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, rxdbgrid, rxmemds, RxDBGridExportSpreadSheet,
|
||||
RxDBGridPrintGrid, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, db,
|
||||
Grids, DBGrids;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
CheckBox1: TCheckBox;
|
||||
dsData: TDataSource;
|
||||
Panel1: TPanel;
|
||||
rxDataCODE: TLongintField;
|
||||
rxDataDATE: TDateTimeField;
|
||||
rxDataNAME: TStringField;
|
||||
RxDBGrid1: TRxDBGrid;
|
||||
rxData: TRxMemoryData;
|
||||
RxDBGridExportSpreadSheet1: TRxDBGridExportSpreadSheet;
|
||||
RxDBGridPrint1: TRxDBGridPrint;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure CheckBox1Change(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure RxDBGrid1Columns0DrawColumnCell(Sender: TObject;
|
||||
const Rect: TRect; DataCol: Integer; Column: TColumn;
|
||||
State: TGridDrawState);
|
||||
procedure RxDBGrid1MergeCells(Sender: TObject; ACol: Integer; var ALeft,
|
||||
ARight: Integer; var ADisplayColumn: TRxColumn);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
rxData.Open;
|
||||
rxData.DisableControls;
|
||||
for i:=1 to 30 do
|
||||
rxData.AppendRecord([i, Date - i, 'Line '+IntToStr(i)]);
|
||||
rxData.First;
|
||||
rxData.EnableControls;
|
||||
end;
|
||||
|
||||
procedure TForm1.RxDBGrid1Columns0DrawColumnCell(Sender: TObject;
|
||||
const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
|
||||
var
|
||||
S: String;
|
||||
FAl: TAlignment;
|
||||
begin
|
||||
S:=rxDataCODE.DisplayText;
|
||||
if CheckBox1.Checked and (rxDataCODE.AsInteger mod 10 = 1) then
|
||||
FAl:=taCenter
|
||||
else
|
||||
FAl:=taRightJustify;
|
||||
WriteTextHeader(RxDBGrid1.Canvas, Rect, S, FAl)
|
||||
end;
|
||||
|
||||
procedure TForm1.RxDBGrid1MergeCells(Sender: TObject; ACol: Integer; var ALeft,
|
||||
ARight: Integer; var ADisplayColumn: TRxColumn);
|
||||
begin
|
||||
if rxDataCODE.AsInteger mod 10 = 1 then
|
||||
begin
|
||||
ALeft:=1;
|
||||
ARight:=3;
|
||||
{ if rxDataCODE.AsInteger > 10 then
|
||||
ADisplayColumn:=RxDBGrid1.ColumnByFieldName('DATE');}
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.CheckBox1Change(Sender: TObject);
|
||||
begin
|
||||
if CheckBox1.Checked then
|
||||
RxDBGrid1.OptionsRx:=RxDBGrid1.OptionsRx + [rdgColSpanning]
|
||||
else
|
||||
RxDBGrid1.OptionsRx:=RxDBGrid1.OptionsRx - [rdgColSpanning];
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
begin
|
||||
RxDBGridExportSpreadSheet1.Execute;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button2Click(Sender: TObject);
|
||||
begin
|
||||
RxDBGridPrint1.Execute;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user