diff --git a/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi b/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi index 435991a27..89ac28034 100644 --- a/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi +++ b/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi @@ -11,6 +11,7 @@ + @@ -36,7 +37,7 @@ - + @@ -44,27 +45,23 @@ - + - - + - - - - + - + - + @@ -73,8 +70,12 @@ - - + + + + + + @@ -99,13 +100,14 @@ - - - + + + + - - + + @@ -434,20 +436,25 @@ - - - + + + + - - + + + + + + @@ -563,9 +570,13 @@ - - + + + + + + @@ -712,111 +723,147 @@ - - - + - + + + + + + + + + + + + + + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -840,6 +887,9 @@ + + + @@ -868,4 +918,5 @@ + diff --git a/components/rx/trunk/Demos/RxDBGrid/rxdbgridmainunit.lfm b/components/rx/trunk/Demos/RxDBGrid/rxdbgridmainunit.lfm index 5ca9e8a67..ea2c320ca 100644 --- a/components/rx/trunk/Demos/RxDBGrid/rxdbgridmainunit.lfm +++ b/components/rx/trunk/Demos/RxDBGrid/rxdbgridmainunit.lfm @@ -5,17 +5,17 @@ object RxDBGridMainForm: TRxDBGridMainForm Width = 1151 ActiveControl = Panel1 Caption = 'RxDBGrid Demo' - ClientHeight = 696 + ClientHeight = 694 ClientWidth = 1151 Menu = MainMenu1 OnCreate = FormCreate SessionProperties = 'RxDBGridExportSpreadSheet1.FileName;RxDBGridExportSpreadSheet1.OpenAfterExport;RxDBGridExportSpreadSheet1.Options;RxDBGridExportSpreadSheet1.PageName;RxDBGridPrint1.Options;RxDBGridPrint1.Orientation;RxDBGridPrint1.PageMargin;RxDBGridPrint1.ReportTitle;RxDBGridPrint1.ShowColumnHeaderOnAllPage' ShowHint = True - LCLVersion = '1.3' + LCLVersion = '1.2.4.0' object RxDBGrid1: TRxDBGrid Left = 0 - Height = 630 - Top = 66 + Height = 624 + Top = 70 Width = 1151 TitleButtons = True AutoSort = True @@ -80,6 +80,12 @@ object RxDBGridMainForm: TRxDBGridMainForm Filter.EmptyValue = '(Нет)' Filter.EmptyFont.Style = [fsItalic] Filter.ItemIndex = -1 + Footer.Value = 'This is test' + Footer.ValueType = fvtStaticText + Footer.Font.Color = clRed + Footer.Font.Height = -15 + Footer.Font.Name = 'Liberation Mono' + Footer.Font.Style = [fsBold, fsItalic] end item Title.Alignment = taCenter @@ -131,6 +137,8 @@ object RxDBGridMainForm: TRxDBGridMainForm Footer.DisplayFormat = '#,##0.00' Footer.FieldName = 'PRICE' Footer.ValueType = fvtSum + Footer.Font.Color = clPurple + Footer.Font.Style = [fsBold, fsItalic] end item Title.Alignment = taCenter @@ -297,22 +305,22 @@ object RxDBGridMainForm: TRxDBGridMainForm end object Panel1: TPanel Left = 0 - Height = 66 + Height = 70 Top = 0 Width = 1151 Align = alTop AutoSize = True - ClientHeight = 66 + ClientHeight = 70 ClientWidth = 1151 TabOrder = 1 object Label1: TLabel AnchorSideLeft.Control = Button2 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 262 - Height = 19 + Left = 274 + Height = 21 Top = 7 - Width = 34 + Width = 36 BorderSpacing.Around = 6 Caption = 'Mode' ParentColor = False @@ -321,9 +329,9 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = Panel1 AnchorSideTop.Control = Panel1 Left = 7 - Height = 31 + Height = 33 Top = 7 - Width = 85 + Width = 89 Action = actCalcTotal AutoSize = True BorderSpacing.Around = 6 @@ -333,10 +341,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = Button1 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 98 - Height = 31 + Left = 102 + Height = 33 Top = 7 - Width = 158 + Width = 166 Action = actOptimizeColumnsWidthAll AutoSize = True BorderSpacing.Around = 6 @@ -347,11 +355,11 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CheckBox2 AnchorSideTop.Side = asrBottom - Left = 491 - Height = 23 + Left = 503 + Height = 25 Hint = 'Use filter line' - Top = 36 - Width = 80 + Top = 38 + Width = 85 BorderSpacing.Left = 6 Caption = 'Use filter' OnChange = CheckBox1Change @@ -361,9 +369,9 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = Label1 AnchorSideTop.Control = Label1 AnchorSideTop.Side = asrBottom - Left = 268 - Height = 27 - Top = 32 + Left = 280 + Height = 29 + Top = 34 Width = 217 BorderSpacing.Around = 6 ItemHeight = 0 @@ -381,11 +389,11 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = ComboBox1 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 491 - Height = 23 + Left = 503 + Height = 25 Hint = 'Auto fill column width' Top = 7 - Width = 125 + Width = 134 BorderSpacing.Around = 6 Caption = 'Auto fill columns' OnChange = CheckBox2Change @@ -395,10 +403,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = CheckBox2 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 622 - Height = 23 + Left = 643 + Height = 25 Top = 7 - Width = 116 + Width = 122 BorderSpacing.Around = 6 Caption = 'Show indicator' Checked = True @@ -411,10 +419,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CheckBox3 AnchorSideTop.Side = asrBottom - Left = 622 - Height = 23 - Top = 36 - Width = 112 + Left = 643 + Height = 25 + Top = 38 + Width = 118 BorderSpacing.Around = 6 Caption = 'Show headers' Checked = True @@ -426,10 +434,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = CheckBox3 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 744 - Height = 23 + Left = 771 + Height = 25 Top = 7 - Width = 95 + Width = 97 BorderSpacing.Around = 6 Caption = 'Word wrap' OnChange = CheckBox5Change diff --git a/components/rx/trunk/Demos/RxDBGrid/rxdbgridmainunit.pas b/components/rx/trunk/Demos/RxDBGrid/rxdbgridmainunit.pas index e648021c1..fd0200a72 100644 --- a/components/rx/trunk/Demos/RxDBGrid/rxdbgridmainunit.pas +++ b/components/rx/trunk/Demos/RxDBGrid/rxdbgridmainunit.pas @@ -8,7 +8,7 @@ uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, rxmemds, DB, rxdbgrid, RxAboutDialog, RxIniPropStorage, RxDBGridPrintGrid, RxDBGridExportSpreadSheet, ExtCtrls, Buttons, Menus, ActnList, StdCtrls, - DBGrids, XMLPropStorage, types; + DBGrids, types; type diff --git a/components/rx/trunk/rx.inc b/components/rx/trunk/rx.inc index 888ab414e..00ef0b8b1 100644 --- a/components/rx/trunk/rx.inc +++ b/components/rx/trunk/rx.inc @@ -52,14 +52,14 @@ // {.$DEFINE DBDateEdit_OLD} -{.$DEFINE OLD_EDITBUTTON} +{$DEFINE OLD_EDITBUTTON} {$if FPC_FULLVERSION<20701} {$DEFINE NoAutomatedBookmark} {$DEFINE RX_USE_LCL_DEVEL} {$endif} -{$IFDEF OLD_EDITBUTTON} +{.$IFDEF OLD_EDITBUTTON} {$if FPC_FULLVERSION<20701} {$DEFINE RX_USE_LAZARUS_RESOURCE} {$ENDIF} diff --git a/components/rx/trunk/rxdbgrid.pas b/components/rx/trunk/rxdbgrid.pas index ac27243d6..8335ac7b3 100644 --- a/components/rx/trunk/rxdbgrid.pas +++ b/components/rx/trunk/rxdbgrid.pas @@ -257,19 +257,25 @@ type TRxColumnFooter = class(TPersistent) private + FIsDefaultFont: boolean; FLayout: TTextLayout; FOwner: TRxColumn; FAlignment: TAlignment; FDisplayFormat: string; FFieldName: string; FField:TField; + FFont: TFont; FValue: string; FValueType: TFooterValueType; FTestValue: double; FCountRec:integer; + procedure FontChanged(Sender: TObject); + function GetFont: TFont; + function IsFontStored: Boolean; procedure SetAlignment(const AValue: TAlignment); procedure SetDisplayFormat(const AValue: string); procedure SetFieldName(const AValue: string); + procedure SetFont(AValue: TFont); procedure SetLayout(const AValue: TTextLayout); procedure SetValue(const AValue: string); procedure SetValueType(const AValue: TFooterValueType); @@ -285,11 +291,14 @@ type function ErrorTestValue: boolean; protected procedure UpdateTestValueFromVar(AValue:Variant); + property IsDefaultFont: boolean read FIsDefaultFont; public constructor Create(Owner: TRxColumn); + destructor Destroy; override; property Owner: TRxColumn read FOwner; property NumericValue: double read FTestValue; function DisplayText: string; + procedure FillDefaultFont; published property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify; @@ -297,8 +306,8 @@ type property DisplayFormat: string read FDisplayFormat write SetDisplayFormat; property FieldName: string read FFieldName write SetFieldName; property Value: string read FValue write SetValue; - property ValueType: TFooterValueType - read FValueType write SetValueType default fvtNon; + property ValueType: TFooterValueType read FValueType write SetValueType default fvtNon; + property Font: TFont read GetFont write SetFont stored IsFontStored; end; @@ -3482,6 +3491,10 @@ if ScrollBarIsVisible(SB_HORZ) then TxS.Alignment := C.Footer.Alignment; TxS.Layout := C.Footer.Layout; Canvas.TextStyle := TxS; + if not C.Footer.IsDefaultFont then + Canvas.Font:=C.Footer.Font + else + Canvas.Font:=Font; DrawCellText(i, 0, R, [], C.Footer.DisplayText); end; end; @@ -5399,6 +5412,22 @@ begin FOwner.ColumnChanged; end; +procedure TRxColumnFooter.FontChanged(Sender: TObject); +begin + FisDefaultFont := False; + FOwner.ColumnChanged; +end; + +function TRxColumnFooter.GetFont: TFont; +begin + result := FFont; +end; + +function TRxColumnFooter.IsFontStored: Boolean; +begin + result := not FisDefaultFont; +end; + procedure TRxColumnFooter.SetFieldName(const AValue: string); begin if FFieldName = AValue then @@ -5407,6 +5436,12 @@ begin FOwner.ColumnChanged; end; +procedure TRxColumnFooter.SetFont(AValue: TFont); +begin + if not FFont.IsEqual(AValue) then + FFont.Assign(AValue); +end; + procedure TRxColumnFooter.SetLayout(const AValue: TTextLayout); begin if FLayout = AValue then @@ -5441,6 +5476,18 @@ begin end; end; +procedure TRxColumnFooter.FillDefaultFont; +var + AGrid: TCustomGrid; +begin + AGrid := FOwner.Grid; + if (AGrid<>nil) then + begin + FFont.Assign(AGrid.Font); + FIsDefaultFont := True; + end; +end; + function TRxColumnFooter.GetFieldValue: string; begin if (FFieldName <> '') and TRxDBGrid(FOwner.Grid).DatalinkActive then @@ -5752,6 +5799,16 @@ begin FOwner := Owner; FTestValue := 0; FLayout := tlCenter; + + FFont := TFont.Create; + FillDefaultFont; + FFont.OnChange := @FontChanged; +end; + +destructor TRxColumnFooter.Destroy; +begin + FreeThenNil(FFont); + inherited Destroy; end; { TFilterListCellEditor }