diff --git a/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi b/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi index 1bd17ec67..c06542f1e 100644 --- a/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi +++ b/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi @@ -1,13 +1,13 @@ - - + + - + @@ -28,27 +28,25 @@ - - + + - - + + - + - - - + @@ -56,106 +54,234 @@ - - + + - + - + - + - + - - - + - - - + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + @@ -172,16 +298,6 @@ - - - - - - - - - - diff --git a/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm b/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm index b31bc4acf..8818d4363 100644 --- a/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm +++ b/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm @@ -1,19 +1,19 @@ object RxDBGridMainForm: TRxDBGridMainForm - Left = 353 + Left = 301 Height = 582 Top = 161 - Width = 859 - HorzScrollBar.Page = 858 + Width = 969 + HorzScrollBar.Page = 968 VertScrollBar.Page = 581 ActiveControl = RxDBGrid1 - Caption = 'RxDBGrid Demo (ver 2) ...' + Caption = 'RxDBGrid Demo (ver 3) ...' ClientHeight = 582 - ClientWidth = 859 + ClientWidth = 969 OnCreate = FormCreate object RxDBGrid1: TRxDBGrid Height = 532 Top = 50 - Width = 859 + Width = 969 Columns = < item Title.Alignment = taCenter @@ -28,7 +28,7 @@ object RxDBGridMainForm: TRxDBGridMainForm item Title.Alignment = taCenter Title.Caption = 'Software Name' - Width = 450 + Width = 350 FieldName = 'NAME' Filter.Color = clLime Filter.ItemIndex = -1 @@ -52,6 +52,19 @@ object RxDBGridMainForm: TRxDBGridMainForm Footer.ValueType = fvtSum Filter.Color = clLime Filter.ItemIndex = -1 + end + item + Title.Alignment = taCenter + Title.Caption = 'Date Present' + Width = 100 + FieldName = 'Date_Present' + Filter.ItemIndex = -1 + end + item + Title.Alignment = taCenter + Width = 150 + FieldName = 'DEVELOPER_ID' + Filter.ItemIndex = -1 end> OptionsRx = [rdgFooterRows] FooterColor = clYellow @@ -66,16 +79,15 @@ object RxDBGridMainForm: TRxDBGridMainForm OptionsExtra = [dgeAutoColumns, dgeCheckboxColumn] ParentColor = False PopupMenu = PopupMenu1 - Scrollbars = ssBoth TabOrder = 0 TabStop = True end object Panel1: TPanel Height = 50 - Width = 859 + Width = 969 Align = alTop ClientHeight = 50 - ClientWidth = 859 + ClientWidth = 969 TabOrder = 1 object Button1: TButton Left = 8 @@ -97,9 +109,9 @@ object RxDBGridMainForm: TRxDBGridMainForm end object CheckBox1: TCheckBox Left = 241 - Height = 13 + Height = 20 Top = 8 - Width = 61 + Width = 75 Caption = 'Use filter' OnChange = CheckBox1Change TabOrder = 2 @@ -131,6 +143,14 @@ object RxDBGridMainForm: TRxDBGridMainForm DataType = ftString Precision = -1 Size = 150 + end + item + Name = 'Date_Present' + DataType = ftDate + end + item + Name = 'DEVELOPER_ID' + DataType = ftInteger end> OnFilterRecordEx = RxMemoryData1FilterRecordEx left = 152 @@ -164,6 +184,23 @@ object RxDBGridMainForm: TRxDBGridMainForm ProviderFlags = [pfInUpdate, pfInWhere] Size = 150 end + object RxMemoryData1Date_Present1: TDateField + DisplayWidth = 10 + FieldName = 'Date_Present' + Index = 4 + ProviderFlags = [pfInUpdate, pfInWhere] + end + object RxMemoryData1DEVELOPER_ID1: TLongintField + AlignMent = taRightJustify + DisplayWidth = 10 + FieldName = 'DEVELOPER_ID' + Index = 5 + LookupDataSet = RxMemoryData2 + LookupKeyFields = 'DEVELOPER_ID' + LookupResultField = 'DEVELOPER_NAME' + KeyFields = 'DEVELOPER_ID' + ProviderFlags = [pfInUpdate, pfInWhere] + end end object Datasource1: TDatasource DataSet = RxMemoryData1 @@ -208,4 +245,36 @@ object RxDBGridMainForm: TRxDBGridMainForm OnExecute = actOptimizeWidthCol1Execute end end + object Datasource2: TDatasource + DataSet = RxMemoryData2 + left = 207 + top = 264 + end + object RxMemoryData2: TRxMemoryData + FieldDefs = < + item + Name = 'DEVELOPER_ID' + DataType = ftInteger + end + item + Name = 'DEVELOPER_NAME' + DataType = ftString + Size = 130 + end> + left = 240 + top = 264 + object RxMemoryData2DEVELOPER_ID1: TLongintField + AlignMent = taRightJustify + DisplayWidth = 10 + FieldName = 'DEVELOPER_ID' + ProviderFlags = [pfInUpdate, pfInWhere] + end + object RxMemoryData2DEVELOPER_NAME1: TStringField + DisplayWidth = 130 + FieldName = 'DEVELOPER_NAME' + Index = 1 + ProviderFlags = [pfInUpdate, pfInWhere] + Size = 130 + end + end end diff --git a/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lrs b/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lrs index e0c1c110b..637971b76 100644 --- a/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lrs +++ b/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lrs @@ -1,69 +1,90 @@ { Это - файл ресурсов, автоматически созданный lazarus } LazarusResources.Add('TRxDBGridMainForm','FORMDATA',[ - 'TPF0'#17'TRxDBGridMainForm'#16'RxDBGridMainForm'#4'Left'#3'a'#1#6'Height'#3 - +'F'#2#3'Top'#3#161#0#5'Width'#3'['#3#18'HorzScrollBar.Page'#3'Z'#3#18'VertSc' - +'rollBar.Page'#3'E'#2#13'ActiveControl'#7#9'RxDBGrid1'#7'Caption'#6#26'RxDBG' - +'rid Demo (ver 2) ...'#12'ClientHeight'#3'F'#2#11'ClientWidth'#3'['#3#8'OnC' - +'reate'#7#10'FormCreate'#0#9'TRxDBGrid'#9'RxDBGrid1'#6'Height'#3#20#2#3'Top' - +#2'2'#5'Width'#3'['#3#7'Columns'#14#1#15'Title.Alignment'#7#8'taCenter'#13'T' - +'itle.Caption'#6#4'Code'#9'FieldName'#6#2'ID'#16'Footer.Alignment'#7#14'taRi' - +'ghtJustify'#20'Footer.DisplayFormat'#6#9'Count: %d'#16'Footer.ValueType'#7#8 - +'fvtCount'#12'Filter.Color'#7#6'clLime'#16'Filter.ItemIndex'#2#255#0#1#15'Ti' - +'tle.Alignment'#7#8'taCenter'#13'Title.Caption'#6#13'Software Name'#5'Width' - +#3#194#1#9'FieldName'#6#4'NAME'#12'Filter.Color'#7#6'clLime'#16'Filter.ItemI' - +'ndex'#2#255#0#1#15'Title.Alignment'#7#8'taCenter'#5'Width'#3#150#0#9'FieldN' - +'ame'#6#9'Developer'#12'Filter.Color'#7#6'clLime'#16'Filter.ItemIndex'#2#255 - +#0#1#15'Title.Alignment'#7#8'taCenter'#13'Title.Caption'#6#4'Cost'#5'Width'#2 - +'Z'#9'FieldName'#6#5'PRICE'#13'DisplayFormat'#6#8'#,##0.00'#16'Footer.Alignm' - +'ent'#7#14'taRightJustify'#20'Footer.DisplayFormat'#6#8'#,##0.00'#16'Footer.' - +'FieldName'#6#5'PRICE'#16'Footer.ValueType'#7#6'fvtSum'#12'Filter.Color'#7#6 - +'clLime'#16'Filter.ItemIndex'#2#255#0#0#9'OptionsRx'#11#13'rdgFooterRows'#0 - +#11'FooterColor'#7#8'clYellow'#14'FooterRowCount'#2#1#9'OnFiltred'#7#16'RxDB' - +'Grid1Filtred'#5'Align'#7#8'alClient'#10'FocusColor'#7#5'clRed'#13'SelectedC' - +'olor'#7#11'clHighlight'#10'DataSource'#7#11'Datasource1'#10'FixedColor'#7#9 - +'clBtnFace'#7'Options'#11#9'dgEditing'#8'dgTitles'#11'dgIndicator'#14'dgColu' - +'mnResize'#12'dgColumnMove'#10'dgColLines'#10'dgRowLines'#6'dgTabs'#21'dgAlw' - +'aysShowSelection'#15'dgConfirmDelete'#14'dgCancelOnExit'#13'dgMultiselect'#0 - +#12'OptionsExtra'#11#14'dgeAutoColumns'#17'dgeCheckboxColumn'#0#11'ParentCol' - +'or'#8#9'PopupMenu'#7#10'PopupMenu1'#10'Scrollbars'#7#6'ssBoth'#8'TabOrder'#2 - +#0#7'TabStop'#9#0#0#6'TPanel'#6'Panel1'#6'Height'#2'2'#5'Width'#3'['#3#5'Ali' - +'gn'#7#5'alTop'#12'ClientHeight'#2'2'#11'ClientWidth'#3'['#3#8'TabOrder'#2#1 - +#0#7'TButton'#7'Button1'#4'Left'#2#8#6'Height'#2#25#3'Top'#2#8#5'Width'#2'K' - +#6'Action'#7#12'actCalcTotal'#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2 - +#0#0#0#7'TButton'#7'Button2'#4'Left'#2'X'#6'Height'#2#25#3'Top'#2#8#5'Width' - +#3#136#0#6'Action'#7#26'actOptimizeColumnsWidthAll'#25'BorderSpacing.InnerBo' - +'rder'#2#4#8'TabOrder'#2#1#0#0#9'TCheckBox'#9'CheckBox1'#4'Left'#3#241#0#6'H' - +'eight'#2#13#3'Top'#2#8#5'Width'#2'='#7'Caption'#6#10'Use filter'#8'OnChange' - +#7#15'CheckBox1Change'#8'TabOrder'#2#2#11'UseOnChange'#9#0#0#0#13'TRxMemoryD' - +'ata'#13'RxMemoryData1'#9'FieldDefs'#14#1#4'Name'#6#2'ID'#8'DataType'#7#9'ft' - +'Integer'#9'Precision'#2#255#4'Size'#2#7#0#1#4'Name'#6#4'NAME'#8'DataType'#7 - +#8'ftString'#9'Precision'#2#255#4'Size'#3#150#0#0#1#4'Name'#6#5'PRICE'#8'Dat' - +'aType'#7#7'ftFloat'#9'Precision'#2#2#4'Size'#2#12#0#1#4'Name'#6#9'Developer' - +#8'DataType'#7#8'ftString'#9'Precision'#2#255#4'Size'#3#150#0#0#0#16'OnFilte' - +'rRecordEx'#7#27'RxMemoryData1FilterRecordEx'#4'left'#3#152#0#3'top'#3#8#1#0 - +#13'TLongintField'#16'RxMemoryData1ID1'#9'AlignMent'#7#14'taRightJustify'#12 - +'DisplayWidth'#2#10#9'FieldName'#6#2'ID'#13'ProviderFlags'#11#10'pfInUpdate' - +#9'pfInWhere'#0#0#0#12'TStringField'#18'RxMemoryData1NAME1'#12'DisplayWidth' - +#3#150#0#9'FieldName'#6#4'NAME'#5'Index'#2#1#13'ProviderFlags'#11#10'pfInUpd' - +'ate'#9'pfInWhere'#0#4'Size'#3#150#0#0#0#11'TFloatField'#19'RxMemoryData1PRI' - +'CE1'#9'AlignMent'#7#14'taRightJustify'#12'DisplayWidth'#2#10#9'FieldName'#6 - +#5'PRICE'#5'Index'#2#2#13'ProviderFlags'#11#10'pfInUpdate'#9'pfInWhere'#0#13 - +'DisplayFormat'#6#8'#,##0.00'#9'Precision'#2#2#0#0#12'TStringField'#23'RxMem' - +'oryData1Developer1'#12'DisplayWidth'#3#150#0#9'FieldName'#6#9'Developer'#5 - +'Index'#2#3#13'ProviderFlags'#11#10'pfInUpdate'#9'pfInWhere'#0#4'Size'#3#150 - +#0#0#0#0#11'TDatasource'#11'Datasource1'#7'DataSet'#7#13'RxMemoryData1'#4'le' - +'ft'#2'x'#3'top'#3#8#1#0#0#10'TPopupMenu'#10'PopupMenu1'#4'left'#3#152#0#3't' - +'op'#3#197#0#0#9'TMenuItem'#9'MenuItem1'#6'Action'#7#20'actOptimizeWidthCol1' - +#7'OnClick'#7#27'actOptimizeWidthCol1Execute'#0#0#9'TMenuItem'#9'MenuItem2'#7 - +'Caption'#6#1'-'#0#0#9'TMenuItem'#9'MenuItem4'#6'Action'#7#12'actCalcTotal'#7 - +'OnClick'#7#19'actCalcTotalExecute'#0#0#9'TMenuItem'#9'MenuItem3'#6'Action'#7 - +#26'actOptimizeColumnsWidthAll'#7'OnClick'#7'!actOptimizeColumnsWidthAllExec' - +'ute'#0#0#0#11'TActionList'#11'ActionList1'#4'left'#3#206#0#3'top'#3#197#0#0 - +#7'TAction'#12'actCalcTotal'#7'Caption'#6#13'Calc total...'#18'DisableIfNoHa' - +'ndler'#9#9'OnExecute'#7#19'actCalcTotalExecute'#0#0#7'TAction'#26'actOptimi' - +'zeColumnsWidthAll'#7'Caption'#6#25'Optimize width for all...'#18'DisableIfN' - +'oHandler'#9#9'OnExecute'#7'!actOptimizeColumnsWidthAllExecute'#0#0#7'TActio' - +'n'#20'actOptimizeWidthCol1'#7'Caption'#6#17'Optimize width...'#18'DisableIf' - ,'NoHandler'#9#9'OnExecute'#7#27'actOptimizeWidthCol1Execute'#0#0#0#0 + 'TPF0'#17'TRxDBGridMainForm'#16'RxDBGridMainForm'#4'Left'#3'-'#1#6'Height'#3 + +'F'#2#3'Top'#3#161#0#5'Width'#3#201#3#18'HorzScrollBar.Page'#3#200#3#18'Vert' + +'ScrollBar.Page'#3'E'#2#13'ActiveControl'#7#9'RxDBGrid1'#7'Caption'#6#26'RxD' + +'BGrid Demo (ver 3) ...'#12'ClientHeight'#3'F'#2#11'ClientWidth'#3#201#3#8 + +'OnCreate'#7#10'FormCreate'#0#9'TRxDBGrid'#9'RxDBGrid1'#6'Height'#3#20#2#3'T' + +'op'#2'2'#5'Width'#3#201#3#7'Columns'#14#1#15'Title.Alignment'#7#8'taCenter' + +#13'Title.Caption'#6#4'Code'#9'FieldName'#6#2'ID'#16'Footer.Alignment'#7#14 + +'taRightJustify'#20'Footer.DisplayFormat'#6#9'Count: %d'#16'Footer.ValueType' + +#7#8'fvtCount'#12'Filter.Color'#7#6'clLime'#16'Filter.ItemIndex'#2#255#0#1#15 + +'Title.Alignment'#7#8'taCenter'#13'Title.Caption'#6#13'Software Name'#5'Widt' + +'h'#3'^'#1#9'FieldName'#6#4'NAME'#12'Filter.Color'#7#6'clLime'#16'Filter.Ite' + +'mIndex'#2#255#0#1#15'Title.Alignment'#7#8'taCenter'#5'Width'#3#150#0#9'Fiel' + +'dName'#6#9'Developer'#12'Filter.Color'#7#6'clLime'#16'Filter.ItemIndex'#2 + +#255#0#1#15'Title.Alignment'#7#8'taCenter'#13'Title.Caption'#6#4'Cost'#5'Wid' + +'th'#2'Z'#9'FieldName'#6#5'PRICE'#13'DisplayFormat'#6#8'#,##0.00'#16'Footer.' + +'Alignment'#7#14'taRightJustify'#20'Footer.DisplayFormat'#6#8'#,##0.00'#16'F' + +'ooter.FieldName'#6#5'PRICE'#16'Footer.ValueType'#7#6'fvtSum'#12'Filter.Colo' + +'r'#7#6'clLime'#16'Filter.ItemIndex'#2#255#0#1#15'Title.Alignment'#7#8'taCen' + +'ter'#13'Title.Caption'#6#12'Date Present'#5'Width'#2'd'#9'FieldName'#6#12'D' + +'ate_Present'#16'Filter.ItemIndex'#2#255#0#1#15'Title.Alignment'#7#8'taCente' + +'r'#5'Width'#3#150#0#9'FieldName'#6#12'DEVELOPER_ID'#16'Filter.ItemIndex'#2 + +#255#0#0#9'OptionsRx'#11#13'rdgFooterRows'#0#11'FooterColor'#7#8'clYellow'#14 + +'FooterRowCount'#2#1#9'OnFiltred'#7#16'RxDBGrid1Filtred'#5'Align'#7#8'alClie' + +'nt'#10'FocusColor'#7#5'clRed'#13'SelectedColor'#7#11'clHighlight'#10'DataSo' + +'urce'#7#11'Datasource1'#10'FixedColor'#7#9'clBtnFace'#7'Options'#11#9'dgEdi' + +'ting'#8'dgTitles'#11'dgIndicator'#14'dgColumnResize'#12'dgColumnMove'#10'dg' + +'ColLines'#10'dgRowLines'#6'dgTabs'#21'dgAlwaysShowSelection'#15'dgConfirmDe' + +'lete'#14'dgCancelOnExit'#13'dgMultiselect'#0#12'OptionsExtra'#11#14'dgeAuto' + +'Columns'#17'dgeCheckboxColumn'#0#11'ParentColor'#8#9'PopupMenu'#7#10'PopupM' + +'enu1'#8'TabOrder'#2#0#7'TabStop'#9#0#0#6'TPanel'#6'Panel1'#6'Height'#2'2'#5 + +'Width'#3#201#3#5'Align'#7#5'alTop'#12'ClientHeight'#2'2'#11'ClientWidth'#3 + +#201#3#8'TabOrder'#2#1#0#7'TButton'#7'Button1'#4'Left'#2#8#6'Height'#2#25#3 + +'Top'#2#8#5'Width'#2'K'#6'Action'#7#12'actCalcTotal'#25'BorderSpacing.InnerB' + +'order'#2#4#8'TabOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Left'#2'X'#6'Height' + +#2#25#3'Top'#2#8#5'Width'#3#136#0#6'Action'#7#26'actOptimizeColumnsWidthAll' + +#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#1#0#0#9'TCheckBox'#9'CheckB' + +'ox1'#4'Left'#3#241#0#6'Height'#2#20#3'Top'#2#8#5'Width'#2'K'#7'Caption'#6#10 + +'Use filter'#8'OnChange'#7#15'CheckBox1Change'#8'TabOrder'#2#2#11'UseOnChang' + +'e'#9#0#0#0#13'TRxMemoryData'#13'RxMemoryData1'#9'FieldDefs'#14#1#4'Name'#6#2 + +'ID'#8'DataType'#7#9'ftInteger'#9'Precision'#2#255#4'Size'#2#7#0#1#4'Name'#6 + +#4'NAME'#8'DataType'#7#8'ftString'#9'Precision'#2#255#4'Size'#3#150#0#0#1#4 + +'Name'#6#5'PRICE'#8'DataType'#7#7'ftFloat'#9'Precision'#2#2#4'Size'#2#12#0#1 + +#4'Name'#6#9'Developer'#8'DataType'#7#8'ftString'#9'Precision'#2#255#4'Size' + +#3#150#0#0#1#4'Name'#6#12'Date_Present'#8'DataType'#7#6'ftDate'#0#1#4'Name'#6 + +#12'DEVELOPER_ID'#8'DataType'#7#9'ftInteger'#0#0#16'OnFilterRecordEx'#7#27'R' + +'xMemoryData1FilterRecordEx'#4'left'#3#152#0#3'top'#3#8#1#0#13'TLongintField' + +#16'RxMemoryData1ID1'#9'AlignMent'#7#14'taRightJustify'#12'DisplayWidth'#2#10 + +#9'FieldName'#6#2'ID'#13'ProviderFlags'#11#10'pfInUpdate'#9'pfInWhere'#0#0#0 + +#12'TStringField'#18'RxMemoryData1NAME1'#12'DisplayWidth'#3#150#0#9'FieldNam' + +'e'#6#4'NAME'#5'Index'#2#1#13'ProviderFlags'#11#10'pfInUpdate'#9'pfInWhere'#0 + +#4'Size'#3#150#0#0#0#11'TFloatField'#19'RxMemoryData1PRICE1'#9'AlignMent'#7 + +#14'taRightJustify'#12'DisplayWidth'#2#10#9'FieldName'#6#5'PRICE'#5'Index'#2 + +#2#13'ProviderFlags'#11#10'pfInUpdate'#9'pfInWhere'#0#13'DisplayFormat'#6#8 + +'#,##0.00'#9'Precision'#2#2#0#0#12'TStringField'#23'RxMemoryData1Developer1' + +#12'DisplayWidth'#3#150#0#9'FieldName'#6#9'Developer'#5'Index'#2#3#13'Provid' + +'erFlags'#11#10'pfInUpdate'#9'pfInWhere'#0#4'Size'#3#150#0#0#0#10'TDateField' + +#26'RxMemoryData1Date_Present1'#12'DisplayWidth'#2#10#9'FieldName'#6#12'Date' + +'_Present'#5'Index'#2#4#13'ProviderFlags'#11#10'pfInUpdate'#9'pfInWhere'#0#0 + +#0#13'TLongintField'#26'RxMemoryData1DEVELOPER_ID1'#9'AlignMent'#7#14'taRigh' + +'tJustify'#12'DisplayWidth'#2#10#9'FieldName'#6#12'DEVELOPER_ID'#5'Index'#2#5 + +#13'LookupDataSet'#7#13'RxMemoryData2'#15'LookupKeyFields'#6#12'DEVELOPER_ID' + +#17'LookupResultField'#6#14'DEVELOPER_NAME'#9'KeyFields'#6#12'DEVELOPER_ID' + +#13'ProviderFlags'#11#10'pfInUpdate'#9'pfInWhere'#0#0#0#0#11'TDatasource'#11 + +'Datasource1'#7'DataSet'#7#13'RxMemoryData1'#4'left'#2'x'#3'top'#3#8#1#0#0#10 + ,'TPopupMenu'#10'PopupMenu1'#4'left'#3#152#0#3'top'#3#197#0#0#9'TMenuItem'#9 + +'MenuItem1'#6'Action'#7#20'actOptimizeWidthCol1'#7'OnClick'#7#27'actOptimize' + +'WidthCol1Execute'#0#0#9'TMenuItem'#9'MenuItem2'#7'Caption'#6#1'-'#0#0#9'TMe' + +'nuItem'#9'MenuItem4'#6'Action'#7#12'actCalcTotal'#7'OnClick'#7#19'actCalcTo' + +'talExecute'#0#0#9'TMenuItem'#9'MenuItem3'#6'Action'#7#26'actOptimizeColumns' + +'WidthAll'#7'OnClick'#7'!actOptimizeColumnsWidthAllExecute'#0#0#0#11'TAction' + +'List'#11'ActionList1'#4'left'#3#206#0#3'top'#3#197#0#0#7'TAction'#12'actCal' + +'cTotal'#7'Caption'#6#13'Calc total...'#18'DisableIfNoHandler'#9#9'OnExecute' + +#7#19'actCalcTotalExecute'#0#0#7'TAction'#26'actOptimizeColumnsWidthAll'#7'C' + +'aption'#6#25'Optimize width for all...'#18'DisableIfNoHandler'#9#9'OnExecut' + +'e'#7'!actOptimizeColumnsWidthAllExecute'#0#0#7'TAction'#20'actOptimizeWidth' + +'Col1'#7'Caption'#6#17'Optimize width...'#18'DisableIfNoHandler'#9#9'OnExecu' + +'te'#7#27'actOptimizeWidthCol1Execute'#0#0#0#11'TDatasource'#11'Datasource2' + +#7'DataSet'#7#13'RxMemoryData2'#4'left'#3#207#0#3'top'#3#8#1#0#0#13'TRxMemor' + +'yData'#13'RxMemoryData2'#9'FieldDefs'#14#1#4'Name'#6#12'DEVELOPER_ID'#8'Dat' + +'aType'#7#9'ftInteger'#0#1#4'Name'#6#14'DEVELOPER_NAME'#8'DataType'#7#8'ftSt' + +'ring'#4'Size'#3#130#0#0#0#4'left'#3#240#0#3'top'#3#8#1#0#13'TLongintField' + +#26'RxMemoryData2DEVELOPER_ID1'#9'AlignMent'#7#14'taRightJustify'#12'Display' + +'Width'#2#10#9'FieldName'#6#12'DEVELOPER_ID'#13'ProviderFlags'#11#10'pfInUpd' + +'ate'#9'pfInWhere'#0#0#0#12'TStringField'#28'RxMemoryData2DEVELOPER_NAME1'#12 + +'DisplayWidth'#3#130#0#9'FieldName'#6#14'DEVELOPER_NAME'#5'Index'#2#1#13'Pro' + +'viderFlags'#11#10'pfInUpdate'#9'pfInWhere'#0#4'Size'#3#130#0#0#0#0#0 ]); diff --git a/components/rx/Demos/RxDBGrid/rxdbgridmainunit.pas b/components/rx/Demos/RxDBGrid/rxdbgridmainunit.pas index a69ba93ff..fac1038d0 100644 --- a/components/rx/Demos/RxDBGrid/rxdbgridmainunit.pas +++ b/components/rx/Demos/RxDBGrid/rxdbgridmainunit.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, rxmemds, - DB, rxdbgrid, ExtCtrls, Buttons, Menus, ActnList, StdCtrls; + DB, rxdbgrid, ExtCtrls, Buttons, Menus, ActnList, StdCtrls, DBGrids; type @@ -21,6 +21,7 @@ type Button2: TButton; CheckBox1: TCheckBox; Datasource1: TDatasource; + Datasource2: TDatasource; MenuItem1: TMenuItem; MenuItem2: TMenuItem; MenuItem3: TMenuItem; @@ -29,10 +30,15 @@ type PopupMenu1: TPopupMenu; RxDBGrid1: TRxDBGrid; RxMemoryData1: TRxMemoryData; + RxMemoryData1Date_Present1: TDateField; RxMemoryData1Developer1: TStringField; + RxMemoryData1DEVELOPER_ID1: TLongintField; RxMemoryData1ID1: TLongintField; RxMemoryData1NAME1: TStringField; RxMemoryData1PRICE1: TFloatField; + RxMemoryData2: TRxMemoryData; + RxMemoryData2DEVELOPER_ID1: TLongintField; + RxMemoryData2DEVELOPER_NAME1: TStringField; procedure actCalcTotalExecute(Sender: TObject); procedure actOptimizeColumnsWidthAllExecute(Sender: TObject); procedure actOptimizeWidthCol1Execute(Sender: TObject); @@ -56,18 +62,23 @@ implementation procedure TRxDBGridMainForm.FormCreate(Sender: TObject); begin + RxMemoryData2.Open; + RxMemoryData2.AppendRecord([1, 'Open source']); + RxMemoryData2.AppendRecord([2, 'Borland']); + RxMemoryData2.AppendRecord([3, 'Microsoft']); + RxMemoryData1.Open; - RxMemoryData1.AppendRecord([1, 'Lazarus 0.9.23', 0, 'Open source']); - RxMemoryData1.AppendRecord([2, 'Delphi 7.0 Prof', 990, 'Borland']); - RxMemoryData1.AppendRecord([3, 'Open Office 2.2.0', 0, 'Open source']); - RxMemoryData1.AppendRecord([4, 'Microsoft Office', 150, 'Microsoft']); - RxMemoryData1.AppendRecord([5, 'Microsoft Windows 95', 50, 'Microsoft']); - RxMemoryData1.AppendRecord([6, 'Microsoft Windows 98', 90, 'Microsoft']); - RxMemoryData1.AppendRecord([7, 'Microsoft Windows ME', 90, 'Microsoft']); - RxMemoryData1.AppendRecord([8, 'Microsoft Windows NT 4.0', 250, 'Microsoft']); - RxMemoryData1.AppendRecord([9, 'Microsoft Windows 2000', 150, 'Microsoft']); - RxMemoryData1.AppendRecord([10, 'Microsoft Windows XP', 130, 'Microsoft']); - RxMemoryData1.AppendRecord([11, 'Microsoft Windows Vista', 180, 'Microsoft']); + RxMemoryData1.AppendRecord([1, 'Lazarus 0.9.23', 0, 'Open source', EncodeDate(2006, 1, 1), 1]); + RxMemoryData1.AppendRecord([2, 'Delphi 7.0 Prof', 990, 'Borland', EncodeDate(2002, 1, 1), 2]); + RxMemoryData1.AppendRecord([3, 'Open Office 2.2.0', 0, 'Open source', EncodeDate(2006, 10, 1), 1]); + RxMemoryData1.AppendRecord([4, 'Microsoft Office', 150, 'Microsoft', EncodeDate(1997, 8, 12), 3]); + RxMemoryData1.AppendRecord([5, 'Microsoft Windows 95', 50, 'Microsoft', EncodeDate(1995, 8, 12), 3]); + RxMemoryData1.AppendRecord([6, 'Microsoft Windows 98', 90, 'Microsoft', EncodeDate(1997, 12, 12), 3]); + RxMemoryData1.AppendRecord([7, 'Microsoft Windows ME', 90, 'Microsoft', EncodeDate(1999, 10, 25), 3]); + RxMemoryData1.AppendRecord([8, 'Microsoft Windows NT 4.0', 250, 'Microsoft', EncodeDate(1996, 2, 3), 3]); + RxMemoryData1.AppendRecord([9, 'Microsoft Windows 2000', 150, 'Microsoft', EncodeDate(1999, 11, 13), 3]); + RxMemoryData1.AppendRecord([10, 'Microsoft Windows XP', 130, 'Microsoft', EncodeDate(2003, 10, 1), 3]); + RxMemoryData1.AppendRecord([11, 'Microsoft Windows Vista', 180, 'Microsoft', EncodeDate(2007, 2, 1), 3]); DoFillFilters; RxMemoryData1.First; RxDBGrid1.CalcStatTotals; //fix error in GotoBookmark @@ -100,6 +111,13 @@ var C:TRxColumn; i:integer; begin + for i:=0 to RxDBGrid1.Columns.Count-1 do + begin + C:=TRxColumn(RxDBGrid1.Columns[i]); + C.Filter.EmptyValue:='None...'; + C.Filter.ValueList.Add(C.Filter.EmptyValue); + end; + RxMemoryData1.First; while not RxMemoryData1.EOF do begin diff --git a/components/rx/docs/WhatsNew.eng.txt b/components/rx/docs/WhatsNew.eng.txt index 2bdd734af..711c3627f 100644 --- a/components/rx/docs/WhatsNew.eng.txt +++ b/components/rx/docs/WhatsNew.eng.txt @@ -23,6 +23,10 @@ + Cosmetic fix in paint TRxCustomDBLookupCombo + Dropdown list in TRxCustomDBLookupCombo show after clikc on component + minor fix in RxDBGrid paint sort marker and column title + + New component - TRxDateEdit + + In RxDBGrid create editor for field with type ftDate, ftDateTime - based on TRxDateEdit + (see Demos/RxDBGrid) + - minor fix in filter combobox in RxDBGrid for GTK and GTK2 29.08.2007 - ўҐабЁп 1.1.5.98 (svn revision 39) + In RxDBgrid - after close dataset list of SelectedRows is cleared + fix resaizing find form for RxDbGrd diff --git a/components/rx/docs/WhatsNew.rus.txt b/components/rx/docs/WhatsNew.rus.txt index ff88422d3..1d392a0b4 100644 --- a/components/rx/docs/WhatsNew.rus.txt +++ b/components/rx/docs/WhatsNew.rus.txt @@ -28,6 +28,10 @@ + Косметические изменения отрисовки TRxCustomDBLookupCombo + Выпадающий список в TRxCustomDBLookupCombo отображатеся просто по клику на компоненте + В RxDBGrid доработана отрисовка маркера сортировки и заголовка колонки + + Перенесён и дописан компонент TRxDateEdit + + В RxDBGrid реализован редактор для полей типа ftDate, ftDateTime на основае TRxDateEdit + (см. Demos/RxDBGrid) + + Доработки фильтрации в RxDBGrid для GTK и GTK2 29.08.2007 - версия 1.1.5.98 (svn revision 39) + В RxDBGrid После закрытия набора данных список помеченных строк (SelectedRows) очищается diff --git a/components/rx/rxdbgrid.pas b/components/rx/rxdbgrid.pas index 366120f9d..4fed99e74 100644 --- a/components/rx/rxdbgrid.pas +++ b/components/rx/rxdbgrid.pas @@ -39,7 +39,7 @@ type TOptionsRx = set of TOptionRx; - TDataSetClass = class of TDataSet; +// TDataSetClass = class of TDataSet; TRxColumn = class; @@ -229,7 +229,8 @@ type FVersion: Integer; FPropertyStorageLink:TPropertyStorageLink; FRxDbGridLookupComboEditor:TCustomControl; - + FRxDbGridDateEditor:TWinControl; + function GetColumns: TRxDbGridColumns; function GetPropertyStorage: TCustomPropertyStorage; function IsColumnsStored: boolean; @@ -398,7 +399,8 @@ type procedure RegisterExDBGridSortEngine(ExDBGridSortEngineClass:TExDBGridSortEngineClass; DataSetClass:TDataSetClass); implementation -uses Math, rxdconst, rxstrutils, rxdbgrid_findunit, rxdbgrid_columsunit, rxlookup; +uses Math, rxdconst, rxstrutils, rxdbgrid_findunit, rxdbgrid_columsunit, + rxlookup, tooledit, LCLProc; var ExDBGridSortEngineList:TStringList; @@ -442,6 +444,164 @@ type destructor Destroy; override; end; + { TRxDBGridDateEditor } + TRxDBGridDateEditor = class(TCustomRxDateEdit) + private + FGrid: TRxDBGrid; + FCol,FRow: Integer; + protected + procedure Change; override; + procedure KeyDown(var Key : Word; Shift : TShiftState); override; + + procedure WndProc(var TheMessage : TLMessage); override; + procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID; + procedure msg_SetValue(var Msg: TGridMessage); message GM_SETVALUE; + procedure msg_GetValue(var Msg: TGridMessage); message GM_GETVALUE; + procedure msg_SelectAll(var Msg: TGridMessage); message GM_SELECTALL; + + procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); override; + public + procedure EditingDone; override; + end; + + +{ TRxDBGridDateEditor } + +procedure TRxDBGridDateEditor.Change; +begin + inherited Change; + if Assigned(FGrid) and FGrid.DatalinkActive and not FGrid.EditorIsReadOnly then + begin + if not (FGrid.DataSource.DataSet.State in dsEditModes) then + FGrid.DataSource.Edit; + if Self.Text <> '' then + FGrid.SelectedField.AsDateTime:=Self.Date + else + FGrid.SelectedField.Clear; + + if FGrid<>nil then + FGrid.SetEditText(FCol, FRow, Text); + end; +end; + +procedure TRxDBGridDateEditor.KeyDown(var Key: Word; Shift: TShiftState); + function AllSelected: boolean; + begin + result := (SelLength>0) and (SelLength=UTF8Length(Text)); + end; + function AtStart: Boolean; + begin + Result:= (SelStart=0); + end; + function AtEnd: Boolean; + begin + result := ((SelStart+1)>UTF8Length(Text)) or AllSelected; + end; + procedure doEditorKeyDown; + begin + if FGrid<>nil then + FGrid.EditorkeyDown(Self, key, shift); + end; + procedure doGridKeyDown; + begin + if FGrid<>nil then + FGrid.KeyDown(Key, shift); + end; + function GetFastEntry: boolean; + begin + if FGrid<>nil then + Result := FGrid.FastEditing + else + Result := False; + end; + procedure CheckEditingKey; + begin + if (FGrid=nil) or FGrid.EditorIsReadOnly then + Key := 0; + end; +var + IntSel: boolean; +begin + inherited KeyDown(Key,Shift); + case Key of + VK_F2: + if AllSelected then begin + SelLength := 0; + SelStart := Length(Text); + end; + VK_DELETE: + CheckEditingKey; + VK_UP, VK_DOWN: + doGridKeyDown; + VK_LEFT, VK_RIGHT: + if GetFastEntry then begin + IntSel:= + ((Key=VK_LEFT) and not AtStart) or + ((Key=VK_RIGHT) and not AtEnd); + if not IntSel then begin + doGridKeyDown; + end; + end; + VK_END, VK_HOME: + ; + else + doEditorKeyDown; + end; +end; + +procedure TRxDBGridDateEditor.WndProc(var TheMessage: TLMessage); +begin + if TheMessage.msg=LM_KILLFOCUS then + begin + if HWND(TheMessage.WParam) = HWND(Handle) then + begin + // lost the focus but it returns to ourselves + // eat the message. + TheMessage.Result := 0; + exit; + end; + end; + inherited WndProc(TheMessage); +end; + +procedure TRxDBGridDateEditor.msg_SetGrid(var Msg: TGridMessage); +begin + FGrid:=Msg.Grid as TRxDBGrid; + Msg.Options:=EO_AUTOSIZE or EO_SELECTALL {or EO_HOOKEXIT or EO_HOOKKEYPRESS or EO_HOOKKEYUP}; +end; + +procedure TRxDBGridDateEditor.msg_SetValue(var Msg: TGridMessage); +begin + Self.Date:=FGrid.SelectedField.AsDateTime; +end; + +procedure TRxDBGridDateEditor.msg_GetValue(var Msg: TGridMessage); +var + sText:string; +begin + sText:=Text; + Msg.Value:=sText; +end; + +procedure TRxDBGridDateEditor.msg_SelectAll(var Msg: TGridMessage); +begin + SelectAll; +end; + +procedure TRxDBGridDateEditor.SetBounds(aLeft, aTop, aWidth, aHeight: integer); +begin + Dec(aWidth, 25); + inherited SetBounds(aLeft, aTop, aWidth, aHeight); +end; + +procedure TRxDBGridDateEditor.EditingDone; +begin + inherited EditingDone; + if FGrid<>nil then + FGrid.EditingDone; +end; + + { TRxDBGridLookupComboEditor } procedure TRxDBGridLookupComboEditor.WndProc(var TheMessage: TLMessage); @@ -489,7 +649,7 @@ end; procedure TRxDBGridLookupComboEditor.msg_SetValue(var Msg: TGridMessage); var - F, LF:TField; + F:TField; begin FCol := Msg.Col; FRow := Msg.Row; @@ -498,8 +658,8 @@ begin if Assigned(F) then begin DataField:=F.FieldName; - LookupDisplay:=F.LookupKeyFields; - LookupField:=F.LookupResultField; + LookupDisplay:=F.LookupResultField; + LookupField:=F.LookupKeyFields; FLDS.DataSet:=F.LookupDataSet; end; end; @@ -737,13 +897,13 @@ end; function TRxDBGrid.getFilterRect(bRect: TRect): TRect; begin Result := bRect; - Result.Top := bRect.Bottom - 19; + Result.Top := bRect.Bottom - DefaultRowHeight; end; function TRxDBGrid.getTitleRect(bRect: TRect): TRect; begin Result := bRect; - Result.Bottom := bRect.Bottom - 19; + Result.Bottom := bRect.Bottom - DefaultRowHeight; end; procedure TRxDBGrid.OnIniSave(Sender: TObject); @@ -782,7 +942,7 @@ end; var i, ACount:integer; - S, S1, ColumName, S2:string; + S, S1, ColumName{, S2}:string; C:TRxColumn; begin @@ -1278,11 +1438,11 @@ procedure TRxDBGrid.MouseDown(Button: TMouseButton; Shift: TShiftState; X, var Cell: TGridCoord; Rect : TRect; - X1,X2,Y1,Y2 : integer; - msg: TGridMessage; - pow : TForm; - curCol,curRow : integer; - dump : integer; +// X1,X2,Y1,Y2 : integer; +// msg: TGridMessage; +// pow : TForm; +// curCol,curRow : integer; +// dump : integer; begin Cell := MouseCoord(X, Y); if (Cell.Y=0) and (Cell.X >= ord(dgIndicator in Options)) then @@ -1303,7 +1463,8 @@ begin Height := Rect.Bottom - Rect.Top; BoundsRect := Rect; Style := csDropDownList; - DropDownCount := TRxColumn(Columns[Columns.RealIndex(Cell.x-1)]).Filter.DropDownRows; +// DropDownCount := TRxColumn(Columns[Columns.RealIndex(Cell.x-1)]).Filter.DropDownRows; + Text:=TRxColumn(Columns[Columns.RealIndex(Cell.x-1)]).Filter.Value; Show(Self,Cell.x-1); end; exit; @@ -1627,6 +1788,12 @@ begin Result:=FRxDbGridLookupComboEditor; exit; end + else + if F.DataType in [ftDate, ftDateTime] then + begin + Result:=FRxDbGridDateEditor; + exit; + end; end end; Result:=inherited EditorByStyle(Style); @@ -1750,11 +1917,16 @@ begin FRxDbGridLookupComboEditor:=TRxDBGridLookupComboEditor.Create(nil); FRxDbGridLookupComboEditor.Name:='RxDBGridLookupComboEditor'; FRxDbGridLookupComboEditor.Visible:=false; + + FRxDbGridDateEditor:=TRxDBGridDateEditor.Create(nil); + FRxDbGridDateEditor.Name:='RxDbGridDateEditor'; + FRxDbGridDateEditor.Visible:=false; end; destructor TRxDBGrid.Destroy; begin FreeAndNil(FRxDbGridLookupComboEditor); + FreeAndNil(FRxDbGridDateEditor); FreeAndNil(FMarkerDown); FreeAndNil(FMarkerUp); FreeAndNil(FPropertyStorageLink); @@ -2166,11 +2338,12 @@ end; procedure TFilterListCellEditor.Show(Grid: TCustomGrid; Col: Integer); begin - FGrid := Grid; - FCol := Col; - Visible := true; - DroppedDown := true; - SetFocus; + FGrid := Grid; + FCol := Col; + Visible := true; +// Text:=TRxColumn(TRxDBGrid(Grid).SelectedColumn).Filter.Value; + SetFocus; +// DroppedDown := true; end;