您正在使用一款已经过时的浏览器!部分功能不能正常使用。
请尝试升级或使用
其他浏览器。
cxgrid 中选中一列的某记录,当焦点离开这个cxgrid后,如何使原来选中的记录变色显示? ( 积分: 50 )
wyxriver
Unregistered / Unconfirmed
GUEST, unregistred user!
目前项目需要选中一行记录后,再选另外一个cxgrid中的一行记录,但是第一个cxgrid中原来选中的项需要有明显的标志提示用户,目前只要焦点一离开cxgrid,原来选中的项虽然与没选中的稍有不同,可是差别太小了,如何加深颜色以标示其状态呢?
wyxriver
Unregistered / Unconfirmed
GUEST, unregistred user!
cxgrid1dbtableview1.DataController.Controller.FocusedRecord.Values[4];<br> cxgrid1dbtableview1.DataController.GetDisplayText(cxgrid1dbtableview1.DataController.FocusedRecordIndex,1)<br><br> cIndex:=cxgrid1dbtableview1.GetColumnByFieldName('pinming').Index;<br> s:=(cxgrid1dbtableview1.Controller.SelectedRows[0].RecordIndex,cIndex);<br> showmessage(cxgrid1dbtableview1.DataController.DataSource.DataSet.Fieldbyname('step_code').asstring);
wyxriver
Unregistered / Unconfirmed
GUEST, unregistred user!
好久没有写笔记了,现在有点时间,来篇。<br> happycyp 2007-7-19<br>cxGrid功能强大,适合做企业级的复杂查询。非常方便。<br>但是对其用法介绍的并不多,在此总结他人的使用经验和自己的一点小经验,供大家参考。<br><br>(1)动态设置显示格式<br>procedure SetDisplayFormat(ACtrlData: TClientDataSet;<br> TbView: TcxGridDBTableView);<br>var<br> i: integer;<br>begin<br> if ACtrlData.RecordCount <= 0 then Exit;<br> try<br> TbView.ClearItems;<br> ACtrlData.First;<br> for i := 0 to ACtrlData.RecordCount - 1 do<br> begin<br> if ACtrlData.FieldByName('SQBF_DisplayInGrid').AsString = '1' then //在表格中显示<br> with TbView.CreateColumn do<br> begin<br> DataBinding.FieldName := ACtrlData.FieldByName('SQBF_FieldName').AsString;<br> Caption := ACtrlData.FieldByName('SQBF_Caption').AsString; //字段中文标题<br> Hint := ACtrlData.FieldByName('SQBF_Hint').AsString;<br> Width := ACtrlData.FieldByName('SQBF_Width').AsInteger;<br> HeaderAlignmentHorz := taCenter;<br> end;<br> ACtrlData.Next;<br> end;<br> except<br> on E: Exception do<br> SaveLog('设置显示格式时出错:' + E.Message);<br> end;<br>end;<br><br>(2)显示行号<br>procedure TFmQueryBase.cxDBViewMasterCustomDrawIndicatorCell(<br> Sender: TcxGridTableView; ACanvas: TcxCanvas;<br> AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);<br>var<br> FValue: string;<br> FBounds: TRect;<br>begin<br> FBounds := AViewInfo.Bounds;<br> if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then<br> begin<br> ACanvas.FillRect(FBounds);<br> ACanvas.DrawComplexFrame(FBounds, clBlack, clBlack, [bBottom, bLeft, bRight], 1);<br> FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index+1);<br> InflateRect(FBounds, -3, -2); //Platform specific. May not work on Linux.<br> ACanvas.Font.Color := clBlack;<br> ACanvas.Brush.Style := bsClear;<br> ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);<br> ADone := True;<br> end;<br>end;<br>(3)设置显示格式,我的项目要求先动态添加字段,这时不知道字段类型,所以设置DisplayFormat不方便,我还没有找到好方法。<br>所以采用打开数据集后再设置:<br>procedure TFmQueryBase.cdsMasterAfterOpen(DataSet: TDataSet);<br>var<br> i: Integer;<br>begin<br> for i := 0 to cxDBViewMaster.DataController.DataSet.FieldCount -1 do<br> begin<br> if cxDBViewMaster.DataController.DataSet.Fields
is TNumericField then<br> begin<br> if Pos('AMOUNT', UpperCase(cxDBViewMaster.DataController.DataSet.Fields.FieldName)) > 0 then<br> begin<br> TNumericField(cxDBViewMaster.DataController.DataSet.Fields).DisplayFormat := '#,##0.000';<br> Continue;<br> end;<br> if Pos('QUANTITY', UpperCase(cxDBViewMaster.DataController.DataSet.Fields.FieldName)) > 0 then<br> begin<br> TNumericField(cxDBViewMaster.DataController.DataSet.Fields).DisplayFormat := '#,##0.000';<br> Continue;<br> end;<br> if Pos('MONEY', UpperCase(cxDBViewMaster.DataController.DataSet.Fields.FieldName)) > 0 then<br> begin<br> TNumericField(cxDBViewMaster.DataController.DataSet.Fields).DisplayFormat := '#,##0.00';<br> Continue;<br> end;<br> end;<br> end;<br>end; <br><br><br><br>2007-7-19 12:48:54 <br> 查看评语&raquo;&raquo;&raquo; <br><br> 2007-7-19 12:53:09 别人的,转载http://www.showding.cn/item/cxGrid__182526.aspx<br><br>最近在学习使用cxGrid,安装的版本是ExpressQuantumGrid Suite v5.10 <br> 我发现这个控件功能虽然强大,但是非常难用。 <br> <br> 现在我手头就有几个问题还没解决: <br> 1)主从模式下导出Excel中文会产生乱码,而且从表内容没有导出。 <br> 我不知道是不是因为我的字段名包括单引号的原因。 <br> 导出代码:ExportGrid4ToExcel(FileName, cxGrid); <br> <br> 2)主从模式下通过按钮对从表添加/删除行,代码怎么写。 <br> 附:单表添加/删除行的代码 <br> procedure TFormAccount.cxButtonNewClick(Sender: TObject); <br> begin <br> Self.tvAccount.DataController.Append; <br> Self.tvAccount.Columns[0].Focused := True; <br> cxGrid.SetFocus; <br> end; <br> <br> procedure TFormAccount.cxButtonDeleteClick(Sender: TObject); <br> begin <br> if Self.tvAccount.DataController.RowCount = 0 then <br> Exit; <br> if Application.MessageBox('确认删除当前记录?', '确认删除', <br> MB_YesNo + MB_IconQuestion) = IDNO then <br> Exit; <br> Self.tvAccount.DataController.DeleteFocused; <br> end; <br> <br> 3)动态创建主从结构出错(Compiler没错,运行时出现系统错误0000000018), <br> 我使用了二个ADOStoreProcedure作主从表 <br> 代码如下: <br> var <br> Level: TcxGridLevel; <br> GridView: TcxGridDBTableView; <br> begin <br> Level := cxGrid1.Levels[0].Add; <br> GridView := TcxGridDBTableView(cxGrid1.CreateView(TcxGridDBTableView)); <br> GridView.DataController.DataSource := Self.dsDetail; <br> <br> GridView.DataController.KeyFieldNames := 'PurchOrderID;POLineNbr;PromiseDate;ReceiverDate'; <br> GridView.DataController.MasterKeyFieldNames := 'VendorID'; <br> GridView.DataController.DetailKeyFieldNames := 'VendorID'; <br> GridView.DataController.DataModeController.SmartRefresh := True; <br> <br> GridView.OptionsCustomize.ColumnHiding := True; <br> GridView.OptionsCustomize.ColumnsQuickCustomization := True; <br> GridView.OptionsData.Deleting := False; <br> GridView.OptionsData.Inserting := False; <br> GridView.OptionsView.Indicator := True; <br> Level.GridView := GridView; <br> <br> GridView := TcxGridDBTableView(cxGrid1.Levels[0].GridView); <br> GridView.DataController.KeyFieldNames := 'VendorID'; <br> GridView.OptionsView.GroupByBox := False; <br> <br> //显示主表内容 <br> tvResult.BeginUpdate; <br> tvResult.ClearItems; <br> tvResult.DataController.CreateAllItems; <br> tvResult.EndUpdate; <br> <br> //显示明细表内容 <br> GridView := TcxGridDBTableView(cxGrid1.Levels[0].Items[0].GridView); <br> GridView.BeginUpdate; <br> GridView.ClearItems; <br> GridView.DataController.CreateAllItems; <br> GridView.DataController.Refresh; <br> GridView.EndUpdate; <br> end; <br> <br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>小技巧:用代码展开/收缩主从结构 <br> Self.tvDepartment.ViewData.Expand(True); <br> Self.tvDepartment.ViewData.Collaspe(True); <br> 注:tvDepartment为主表对应的TableView<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>你说的这几个问题我也遇到过。 <br> 第一个问题是编码的问题,修改了其中关于编码的函数,OK. <br> 第二个问题在cxGrid的社区可以找到解答,但从表必须满足某种条件,例如关键字排序。 <br> 第三个问题的解决办法,你可以尝试在动态创建的代码前后加上: <br> grid.beginupdate; <br> ... <br> grid.endupdate <br> 来解决。<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>没用过 <br> 不要经常使用三方控件<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>to tttk(网络芝麻): <br> 第一个问题:如何修改啊,贴出代码 <br> 第二个问题:没搜到啊 <br> 第三个问题:试一下再说<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>不要经常使用三方控件 <br> ====================== <br> 我感觉不用cxGrid的话,没必要用Delphi了,呵呵<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>樓上這話是不是有點問題?DELPHI能做得事情很多很多,難道非要用CXGRID?CXGRID不是用DELPHI做出來得?<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>没用过.....<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>回复人: zxkid(没有人会像我这样...) (   信誉:101 2006-01-06 16:58:00 得分: 0 <br> <br> <br> 不要经常使用三方控件 <br> ====================== <br> 我感觉不用cxGrid的话,没必要用Delphi了,呵呵 <br> <br> <br> ********** <br> 楼主乃天人也!!<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>呵呵<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>cxGrid比较不错,我也使用过导出到Excel,没有遇到你说的乱码 <br> <br> 主从表也没有问题的,其实跟单表操作还不是一回事<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>up<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>没用过cxGrid,以后考虑<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>楼主乃天人也!! <br> ============================= <br> Delphi下有cxGrid, .NET下有XtraGrid, 它们都是同一公司出的。 <br> 迟早都会转到.NET,所以。。。<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>路过<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>用过,挺好,只会使用最简单的。<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>发一个邮件给我,我把解决乱码后的源代码发一分给你,放到你的项目文件夹下即可。 <br> tttk2000@hotmail.com<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>第二个问题:https://www.devexpress.com/Support/Center/default.aspx?view=ViewIssue&issueid=B2691<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>谢谢tttk(网络芝麻) <br> <br> 第二个问题:我现在直接让用户用导航条的删除/添加按钮了。根据你给的网址上的内容我知道大概该怎么写了,有空再试试。 <br> <br> 第一个问题:不光是乱码问题,还有从表内容没导出的问题。 <br> 只有一个表的话是不会出现乱码的。 <br> <br> 第三个问题:还没来得及试。<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>第一个问题:看了一下帮助,原来cxGrid不支持主从表的导出,只能导出主表(顶层表)的内容。晕<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>贴一些小技巧,希望与各位使用cxGrid的朋友共同交流 <br> 各位有什么好个技巧也可以贴出来: <br> <br> 技巧二:在内置右键菜单的后面增加菜单项 <br> <br> 首先应在Form上加一个cxGridPopupMenu控件 以启用右键菜单 <br> UseBuildInPopupMenus设为True <br> <br> procedure TFormItemList.FormCreate(Sender: TObject); <br> var <br> AMenu: TComponent; <br> FMenuItem, FSubMenuItem: TMenuItem; <br> begin <br> AMenu := nil; <br> if cxGridPopupMenu.BuiltInPopupMenus.Count = 0 then <br> Exit; <br> AMenu := cxGridPopupMenu.BuiltInPopupMenus[0].PopupMenu; //第一个内置右键菜单(表头菜单) <br> if Assigned(AMenu) and AMenu.InheritsFrom(TPopupMenu) then <br> begin <br> TPopupMenu(AMenu).AutoHotkeys := maManual; //手动热键 <br> <br> //------------------------- <br> FMenuItem := TMenuItem.Create(Self); <br> FMenuItem.Caption := '-'; <br> FMenuItem.Name := 'miLineForGroup'; <br> TPopupMenu(AMenu).Items.Add(FMenuItem); <br> <br> //展开所有组 <br> FMenuItem := TMenuItem.Create(Self); <br> FMenuItem.Name := 'miExpandAllGroup'; <br> FMenuItem.Caption := '展开所有组(&X)'; <br> FMenuItem.OnClick := miExpandAllGroupClick; <br> TPopupMenu(AMenu).Items.Add(FMenuItem); <br> <br> //收缩所有组 <br> FMenuItem := TMenuItem.Create(Self); <br> FMenuItem.Name := 'miCollapseAllGroup'; <br> FMenuItem.Caption := '收缩所有组(&O)'; <br> FMenuItem.OnClick := miCollapseAllGroupClick; <br> TPopupMenu(AMenu).Items.Add(FMenuItem); <br> <br> //------------------------- <br> FMenuItem := TMenuItem.Create(Self); <br> FMenuItem.Caption := '-'; <br> TPopupMenu(AMenu).Items.Add(FMenuItem); <br> <br> //过滤面板 <br> FMenuItem := TMenuItem.Create(Self); <br> FMenuItem.Name := 'miFilterPanel'; <br> FMenuItem.Caption := '过滤面板(&P)'; <br> //自动显示 <br> FSubMenuItem := TMenuItem.Create(Self); <br> FSubMenuItem.Name := 'miFilterPanelAuto'; <br> FSubMenuItem.Caption := '自动(&A)'; <br> FSubMenuItem.RadioItem := True; <br> FSubMenuItem.GroupIndex := 5; //指定同一组 <br> FSubMenuItem.Checked := True; <br> FSubMenuItem.OnClick := miFilterPanelClick; <br> FMenuItem.Add(FSubMenuItem); //加入二级子菜单 <br> //总是显示 <br> FSubMenuItem := TMenuItem.Create(Self); <br> FSubMenuItem.Name := 'miFilterPanelAlways'; <br> FSubMenuItem.Caption := '总是显示(&W)'; <br> FSubMenuItem.RadioItem := True; <br> FSubMenuItem.GroupIndex := 5; <br> FSubMenuItem.OnClick := miFilterPanelClick; <br> FMenuItem.Add(FSubMenuItem); <br> //从不显示 <br> FSubMenuItem := TMenuItem.Create(Self); <br> FSubMenuItem.Name := 'miFilterPanelNerver'; <br> FSubMenuItem.Caption := '从不显示(&N)'; <br> FSubMenuItem.RadioItem := True; <br> FSubMenuItem.GroupIndex := 5; <br> FSubMenuItem.OnClick := miFilterPanelClick; <br> FMenuItem.Add(FSubMenuItem); <br> TPopupMenu(AMenu).Items.Add(FMenuItem); <br> <br> //自定义过滤 <br> FMenuItem := TMenuItem.Create(Self); <br> FMenuItem.Name := 'miCustomFilter'; <br> FMenuItem.Caption := '自定义过滤(&M)'; <br> FMenuItem.OnClick := miCustomFilterClick; <br> TPopupMenu(AMenu).Items.Add(FMenuItem); <br> <br> //过滤管理器 <br> FMenuItem := TMenuItem.Create(Self); <br> FMenuItem.Name := 'miFilterBuilder'; <br> TPopupMenu(AMenu).Images.AddImage(FormMain.ImageListExtend, 44); //添加图标图像 <br> FMenuItem.ImageIndex := TPopupMenu(AMenu).Images.Count - 1; //指定图标序号 <br> FMenuItem.Caption := '过滤管理器'; <br> FMenuItem.OnClick := Self.miFilterBuilderClick; <br> TPopupMenu(AMenu).Items.Add(FMenuItem); <br> <br> //--------------------- <br> FMenuItem := TMenuItem.Create(Self); <br> FMenuItem.Caption := '-'; <br> TPopupMenu(AMenu).Items.Add(FMenuItem); <br> <br> //导出 <br> FMenuItem := TMenuItem.Create(Self); <br> FMenuItem.Name := 'miExport'; <br> TPopupMenu(AMenu).Images.AddImage(FormMain.ImageListExtend, 37); <br> FMenuItem.ImageIndex := TPopupMenu(AMenu).Images.Count - 1; <br> FMenuItem.Caption := '导出(&E)'; <br> FMenuItem.OnClick := Self.miExportClick; <br> TPopupMenu(AMenu).Items.Add(FMenuItem); <br> <br> //打印 <br> FMenuItem := TMenuItem.Create(Self); <br> FMenuItem.Name := 'miPrint'; <br> FMenuItem.Caption := '打印(&P)'; <br> TPopupMenu(AMenu).Images.AddImage(FormMain.ImageListExtend, 14); <br> FMenuItem.ImageIndex := TPopupMenu(AMenu).Images.Count - 1; <br> FMenuItem.OnClick := Self.miPrintClick; <br> TPopupMenu(AMenu).Items.Add(FMenuItem); <br> end; <br> end; <br> <br> procedure TFormItemList.miExportClick(Sender: TObject); <br> var <br> FileName, FileExt, msg: String; <br> begin <br> if Self.aqyQuery.IsEmpty then <br> begin <br> msg := '没有导出数据...'; <br> Application.MessageBox(PChar(msg), PChar(Application.Title), <br> MB_OK or MB_IconWarning); <br> Exit; <br> end; <br> <br> Self.SaveDialogExport.Filter := 'Excel文件 (*.xls)|*.xls|XML文件 (*.xml)|*.xml' <br> + '|文本文件 (*.txt)|*.txt|网页文件 (*.html)|*.html'; <br> Self.SaveDialogExport.Title := '导出为'; <br> <br> if not Self.SaveDialogExport.Execute then <br> Exit; <br> <br> FileName := Self.SaveDialogExport.FileName; <br> FileExt := LowerCase(ExtractFileExt(FileName)); <br> if FileExt = '.xls' then <br> ExportGrid4ToExcel(FileName, Self.cxGrid1) <br> else if FileExt = '.xml' then <br> ExportGrid4ToXML(FileName, Self.cxGrid1) <br> else if FileExt = '.txt' then <br> ExportGrid4ToText(FileName, Self.cxGrid1) <br> else if FileExt = '.html' then <br> ExportGrid4ToHTML(FileName, Self.cxGrid1) <br> else <br> begin <br> msg := '不支持的导出文件类型...'; <br> Application.MessageBox(PChar(msg), PChar(Application.Title), <br> MB_OK or MB_IconError); <br> Exit; <br> end; <br> <br> msg := '导出完成...'; <br> Application.MessageBox(PChar(msg), PChar(Application.Title), <br> MB_OK or MB_IconInformation); <br> end; <br> <br> procedure TFormItemList.miPrintClick(Sender: TObject); <br> begin <br> //打印 <br> Self.dxComponentPrinter.Preview(True, Self.dxComponentPrinterLink1); <br> end; <br> <br> procedure TFormItemList.cxGridPopupMenuPopup(ASenderMenu: TComponent; <br> AHitTest: TcxCustomGridHitTest; X, Y: Integer; var AllowPopup: Boolean); <br> begin <br> if GetHitTypeByHitCode(AHitTest.HitTestCode) = gvhtColumnHeader then //右击列标题时 <br> begin <br> //if tvResult.DataController.Groups.GroupingItemCount > 0 then <br> if tvResult.GroupedColumnCount > 0 then //有分组时显示 <br> begin <br> TMenuItem(Self.FindComponent('miLineForGroup')).Visible := True; <br> TMenuItem(Self.FindComponent('miExpandAllGroup')).Visible := True; <br> TMenuItem(Self.FindComponent('miCollapseAllGroup')).Visible := True; <br> end <br> else <br> begin <br> TMenuItem(Self.FindComponent('miLineForGroup')).Visible := False; <br> TMenuItem(Self.FindComponent('miExpandAllGroup')).Visible := False; <br> TMenuItem(Self.FindComponent('miCollapseAllGroup')).Visible := False; <br> end; <br> end; <br> end; <br> <br> procedure TFormItemList.miFilterBuilderClick(Sender: TObject); <br> begin <br> //过滤管理器 <br> //弹出Filter Builder Dialog对话框 <br> tvResult.Filtering.RunCustomizeDialog; <br> end; <br> <br> procedure TFormItemList.miCustomFilterClick(Sender: TObject); <br> var <br> AHitTest: TcxCustomGridHitTest; <br> begin <br> //自定义过滤 <br> //弹出Custom Filter Dialog对话框 <br> AHitTest := cxGridPopupMenu.HitTest; <br> if GetHitTypeByHitCode(AHitTest.HitTestCode) = gvhtColumnHeader then //获得右击的列 <br> tvResult.Filtering.RunCustomizeDialog(TcxGridColumnHeaderHitTest(AHitTest).Column); <br> end; <br> <br> procedure TFormItemList.miFilterPanelClick(Sender: TObject); <br> var <br> mi: TMenuItem; <br> begin <br> //隐藏/显示过滤面板 <br> mi := TMenuItem(Sender); <br> mi.Checked := True; <br> if mi.Name = 'miFilterPanelAlways' then <br> tvResult.Filtering.Visible := fvAlways <br> else if mi.Name = 'miFilterPanelNerver' then <br> tvResult.Filtering.Visible := fvNever <br> else <br> tvResult.Filtering.Visible := fvNonEmpty; <br> end; <br> <br> procedure TFormItemList.miExpandAllGroupClick(Sender: TObject); <br> begin <br> //展开所有组 <br> tvResult.DataController.Groups.FullExpand; <br> end; <br> <br> procedure TFormItemList.miCollapseAllGroupClick(Sender: TObject); <br> begin <br> //收缩所有组 <br> tvResult.DataController.Groups.FullCollapse; <br> end; <br> <br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>在用,留名<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>技巧三 按条件计算合计值 <br> <br> 在Footer的第一列显示[合计:] <br> 加一个Summary项,Column设为Grid的第一列,Kind设为skNone <br> 在该Summary项的OnGetText事件中,输入: <br> procedure TFormExpense.tvExpenseTcxGridDBDataControllerTcxDataSummaryFooterSummaryItems2GetText( <br> Sender: TcxDataSummaryItem; const AValue: Variant; AIsFooter: Boolean; <br> var AText: String); <br> begin <br> AText := '合计:'; <br> end; <br> <br> 按条件汇总: <br> 在TableView的DataController->Summary->FooterSummary->OnSummary事件中,输入: <br> procedure TFormExpense.tvExpenseDataControllerSummaryFooterSummaryItemsSummary( <br> ASender: TcxDataSummaryItems; Arguments: TcxSummaryEventArguments; <br> var OutArguments: TcxSummaryEventOutArguments); <br> begin <br> //得到字段名 TcxDBDataSummaryItem(Arguments.SummaryItem).FieldName; <br> if (ASender.DataController.Values[Arguments.RecordIndex, tvExpenseLevel.Index] > 1) //只统计Level列=1的值 <br> and (TcxDBDataSummaryItem(Arguments.SummaryItem).Kind = skSum) then <br> OutArguments.Value := 0; //Level > 1的统计值设为0 <br> end; <br> <br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>借贵地一用,问个CXGrid问题,在cxgrid中如何使一些行不能编辑,如:字段isenable = false的行<br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>楼上的问题 <br> 请参考下面的技巧 <br> <br> 技巧四:根据某列的值设定其它列的可编辑性 <br> <br> procedure TFormUser.tvUserEditing(Sender: TcxCustomGridTableView; <br> AItem: TcxCustomGridTableItem; var AAllow: Boolean); <br> begin <br> //如果第三列值为True,则第4列不能修改 <br> if (tvUser.Controller.FocusedRecord.Values[2] = True) and (AItem.Index = 4) then <br> AAllow := False <br> else <br> AAllow := True; <br> end; <br> <br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>技巧五:保存/恢复Grid布局 <br> <br> //恢复布局 <br> IniFileName := ExtractFilePath(Application.ExeName) + 'Layout/' + Self.Name + '.ini'; <br> if FileExists(IniFileName) then <br> Self.tvResult.RestoreFromIniFile(IniFileName) //从布局文件中恢复 <br> else <br> begin <br> Self.tvResult.BeginUpdate; <br> for i := 0 to Self.tvResult.ItemCount - 1 do <br> Self.tvResult.Items.ApplyBestFit; //调整为最佳宽度 <br> Self.tvResult.EndUpdate; <br> end; <br> <br> //保存布局 <br> IniFileName := ExtractFilePath(Application.ExeName) + 'Layout/' + Self.Name + '.ini'; <br> if not DirectoryExists(ExtractFileDir(IniFileName)) then <br> CreateDir(ExtractFileDir(IniFileName)); <br> Self.tvResult.StoreToIniFile(IniFileName); //保存为布局文件 <br> <br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>借用地问一下:在 cxgrid中,如果我同时选中主表与子表中的记录,怎么样能同时进行对其所选记录进行处理呢。 <br> 我现在只能判断 焦点是在主表还是从表中,然后只能对主表或子表中的数据进行处理。 <br> <br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>看来用cxGrid人不多啊 <br> <br> 再多贴一些技巧,需要的朋友顶一下 <br> <br> ========================================================================== <br> <br> 在主从TableView中根据主TableView得到对应的从TableView <br> var <br> ADetailDC: TcxGridDataController; <br> AView: TcxCustomGridTableView; <br> begin <br> with cxGrid1DBTableView1.DataController do <br> ADetailDC := TcxGridDataController(GetDetailDataController(FocusedRecordIndex, 0)); <br> AView := ADetailDC.GridView; <br> end; <br> <br> ============================================================================== <br> <br> 定位在第一行并显示内置编辑器 <br> <br> cxDBVerticalGrid1.FocusedRow := cxDBVerticalGrid1.Rows[0]; <br> cxDBVerticalGrid1.ShowEdit; <br> <br> ============================================================================== <br> <br> 隐藏 "<No data to display>" 字符串 <br> <br> 该文本存储在scxGridNoDataInfoText资源字符串,可以将该资源字符串的内容设为空 <br> 来隐藏该文本。 <br> <br> uses cxClasses, cxGridStrs; <br> ... <br> cxSetResourceString(@scxGridNoDataInfoText, ''); <br> <br> //如果"<No data to display>" 字符串已经显示,需要调用: <br> <View>.LayoutChanged; <br> <br> ============================================================ <br> <br> 删除应用过滤后的行 <br> <br> var <br> I: Integer; <br> begin <br> with <GridView> do <br> for I := 0 to ViewData.RecordCount - 1 do <br> begin <br> ViewData.Records[0].Focused := True; <br> DataController.DataSet.Delete; <br> end; <br> <br> ============================================================= <br> <br> 根据单元的值设置样式 <br> <br> procedure <aForm>.<aColumn>StylesGetContentStyle( <br> Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; <br> AItem: TcxCustomGridTableItem; out AStyle: TcxStyle); <br> begin <br> if ARecord.Values[AItem.Index] = aSomeValue then <br> AStyle := <aSomeStyle>; <br> end; <br> <br> procedure <aForm>.<aView>StylesGetContentStyle( <br> Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; <br> AItem: TcxCustomGridTableItem; out AStyle: TcxStyle); <br> var <br> AColumn: TcxCustomGridTableItem; <br> begin <br> AColumn := (Sender as TcxGridDBTableView).GetColumnByFieldName('Email'); <br> if VarToStr(ARecord.Values[AColumn.Index]) = '' then <br> AStyle := cxStyleNullEmail; <br> end; <br> <br> ============================================================================== <br> <br> TcxCustomGridTableView.FindItemByName, TcxGridDBTableView.GetColumnByFieldName or <br> TcxGridDBDataController.GetItemByFieldName <br> <br> with cxGrid1DBBandedTableView1.DataController do <br> AValue := Values[FocusedRecordIndex, GetItemByFieldName('SomeFieldName').Index]; <br> <br> =================================================================== <br> <br> 动态生成BandedView <br> <br> var <br> AView: TcxCustomGridView; <br> begin <br> AView := <cxGrid>.CreateView(TcxGridDBBandedTableView); <br> TcxGridDBBandedTableView(AView).DataController.DataSource := <DataSource>; <br> TcxGridDBBandedTableView(AView).Bands.Add; <br> with TcxGridDBBandedTableView(AView).Bands.Add do <br> begin <br> Visible := False; <br> FixedKind := fkLeft; <br> end; <br> TcxGridDBBandedTableView(AView).DataController.CreateAllItems; <br> <cxGridLevel>.GridView := AView; <br> <br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>====================================================================== <br> <br> 当底层数据集为空时显示一条空记录 <br> <br> procedure <Form>.<cxGrid>Enter(Sender: TObject); <br> var <br> View: TcxGridDBTableView; <br> begin <br> View := TcxGridDBTableView((Sender as TcxGrid).FocusedView); <br> if View.DataController.DataSet.IsEmpty then <br> begin <br> View.DataController.DataSet.Append; <br> View.Controller.EditingController.ShowEdit; <br> end; <br> end; <br> <br> ======================================================================= <br> <br> 在当前View插入记录 <br> <br> 使用FocusedView属性得到当前焦点View,用View.DataController得到对应的Data Controller, <br> 之后使用Data Controller的方法来操作数据: <br> - Append <br> - Insert <br> - Post <br> - Cancel <br> - DeleteFocused <br> - DeleteSelection <br> <br> 示例: <br> var <br> ARecIndex: Integer; <br> … <br> View.DataController.Append; <br> ARecIndex := View.DataController.FocusedRecordIndex; <br> View.DataController.Values[ARecIndex, SomeItemIndex] := SomeValue; <br> View.DataController.Post; <br> <br> 另外一种方法是使用View.DataController.DataSource.DataSet得到底层数据集后,再用数据集的 <br> 方法来操作数据。 <br> <br> ======================================================================== <br> <br> 激活内置编辑控件 <br> <br> 1) <aView>.Controller.EditingController.ShowEdit(<aColumn> <br> 2) <aView>.Controller.EditingController.StartEditShowingTimer(<aColumn> <br> 3) <aView>.Controller.EditingItem := <aColumn>; <br> 4) <aColumn>.Editing := True; <br> <br> 隐藏内置编辑控件 <br> <aView>.Controller.EditingController.HideEdit(True); <br> <br> =========================================================================== <br> <br> 移除一个分组列 <br> <br> <aColumn>.GroupIndex := -1; <br> <aColumn>.Visible := True; <br> <br> =========================================================================== <br> <br> 保存修改到数据库 <br> <br> procedure <aForm>.FormClose(Sender: TObject; var Action: TCloseAction); <br> begin <br> if (<aGrid>.FocusedView <> nil) and (<aGrid>.FocusedView.DataController.EditState <> []) then <br> <aGrid>.FocusedView.DataController.Post; <br> end; <br> <br> ============================================================================ <br> <br> 设置内置右键菜单 <br> <br> 内置右键菜单包括二个菜单:cxGridStdHeaderMenu, TcxGridStdFooterMenu <br> <br> uses cxGridStdPopupMenu; <br> <br> procedure TForm1.cxGridPopupMenu1Popup(ASenderMenu: TComponent; <br> AHitTest: TcxCustomGridHitTest; X, Y: Integer; var AllowPopup: Boolean); <br> begin <br> if ASenderMenu is TcxGridStdHeaderMenu then <br> TcxGridStdHeaderMenu(ASenderMenu).OnPopup := StdHeaderMenuPopup; <br> end; <br> <br> procedure TForm1.StdHeaderMenuPopup(Sender: TObject); <br> var <br> I: Integer; <br> begin <br> with TcxGridStdHeaderMenu(Sender).Items do <br> for I := 0 to Count - 1 do <br> if Items.Caption = 'Group By Box' then <br> begin <br> Items.Enabled := False; <br> System.Break; <br> end <br> end; <br> <br> =========================================================================== <br> <br> 得到选中记录的值 <br> <br> 1) View.DataController.DataModeController.GridMode = False时 <br> <br> RecIdx := View.Controller.SelectedRecords.RecordIndex; <br> ColIdx := View.DataController.GetItemByFieldName(AFieldName).Index; <br> OutputVal := View.DataController.Values[RecIdx, ColIdx]; <br> <br> //RecID := View.DataController.GetRecordId(RecIdx); <br> //OutputVal := ADataSet.Lookup(View.DataController.KeyFieldNames, RecID, AFieldName); <br> <br> 2) View.DataController.DataModeController.GridMode = True时 <br> Bkm := View.DataController.GetSelectedBookmark(ASelectedRecordIndex); <br> if ADataSet.BookmarkValid(TBookmark(Bkm)) then <br> begin <br> ADataSet.Bookmark := TBookmark(Bkm); <br> OutputVal := ADataSet.FieldByName(AFieldName).Value; <br> end; <br> <br> View.BeginUpdate; <br> View.DataController.BeginLocate; <br> try <br> // make changes here… <br> finally <br> View.DataController.EndLocate; <br> View.EndUpdate; <br> end; <br> <br> ============================================================= <br> <br> 在GridMode禁用内置的右键Footer菜单 <br> <br> uses cxGridStdPopupMenu; <br> <br> procedure cxGridPopupMenuOnPopup(...) <br> begin <br> if (ASenderMenu is TcxGridStdFooterMenu) and <br> <GridView>.DataController.DataModeController.GridMode then <br> AllowPopup := False; <br> end; <br> <br> ============================================================== <br> <br> 主从表任何时候只能展开一个组 <br> <br> procedure TForm1.ADetailDataControllerCollapsing( <br> ADataController: TcxCustomDataController; ARecordIndex: Integer; <br> var AAllow: Boolean); <br> var <br> I: Integer; <br> C: Integer; <br> begin <br> AAllow := False; <br> C := 0; <br> for I := 0 to ADataController.RecordCount - 1 do <br> begin <br> if ADataController.GetDetailExpanding(I) then <br> Inc(C); <br> if C > 1 then <br> AAllow := True; <br> end; <br> end; <br> <br> procedure TForm1.ADetailDataControllerExpanding( <br> ADataController: TcxCustomDataController; ARecordIndex: Integer; <br> var AAllow: Boolean); <br> begin <br> ADataController.CollapseDetails; <br> end; <br> <br> procedure TForm1.FormCreate(Sender: TObject); <br> begin <br> cxGrid1DBTableView1.DataController.OnDetailExpanding := ADetailDataControllerExpanding; <br> cxGrid1DBTableView1.DataController.OnDetailCollapsing := ADetailDataControllerCollapsing; <br> end; <br> <br> ================================================================= <br> <br> 动态创建层次(Level)和视图(View) <br> <br> var <br> Grid: TcxGrid; <br> Level: TcxGridLevel; <br> View: TcxGridDBTableView; <br> begin <br> // Creates a Grid instance <br> Grid := TcxGrid.Create(SomeOwner); <br> Grid.Parent := SomeParent; <br> // Creates a Level <br> Level := Grid.Levels.Add; <br> Level.Name := 'SomeLevelName'; <br> // Creates a View <br> View := Grid.CreateView(TcxGridDBTableView) as TcxGridDBTableView; <br> View.Name := 'SomeViewName'; <br> // … and binds it to the Level <br> Level.GridView := View; <br> // Hooks up the View to the data <br> View.DataController.DataSource := SomeDataSource; <br> // … and creates all columns <br> View.DataController.CreateAllItems; <br> end; <br> <br><br><br>此楼回复Re: <br>--------------------------------------------------------------------------------<br><br>====================================================================== <br> <br> 获得Group Footer合计行对应的记录 <br> <br> procedure TForm1.cxGrid1DBTableView1CustomDrawFooterCell( <br> Sender: TcxGridTableView; ACanvas: TcxCanvas; <br> AViewInfo: TcxGridColumnHeaderViewInfo; var ADone: Boolean); <br> var <br> ALevel, ADataGroupIndex: Integer; <br> AGridRecord, AGroupRecord: TcxCustomGridRecord; <br> begin <br> if AViewInfo is TcxGridRowFooterCellViewInfo and // Row footer <br> (TcxGridDBColumn(AViewInfo.Column).DataBinding.FieldName = 'Area') then // Area column <br> begin <br> AGridRecord := TcxGridRowFooterCellViewInfo(AViewInfo).GridRecord; <br> ALevel := TcxGridRowFooterCellViewInfo(AViewInfo).Container.GroupLevel; <br> ADataGroupIndex := Sender.DataController.Groups.DataGroupIndexByRowIndex[AGridRecord.Index]; <br> if ADataGroupIndex <> -1 then <br> begin <br> AGroupRecord := AGridRecord; <br> while AGroupRecord.Level <> ALevel do <br> AGroupRecord := AGroupRecord.ParentRecord; <br> AViewInfo.Text := AGroupRecord.DisplayTexts[0]; <br> end; <br> end; <br> end; <br> <br> =========================================================================== <br> <br> 访问过滤之后的记录 <br> <br> var <br> I: Integer; <br> begin <br> Memo1.Lines.Clear; <br> with cxGrid1DBTableView1.DataController do <br> for I := 0 to FilteredRecordCount - 1 do <br> Memo1.Lines.Add(DisplayTexts[FilteredRecordIndex, 0]); <br> end; <br> <br> ============================================================================ <br> <br> 获得单元的Font <br> <br> cxGrid1DBTableView1.ViewInfo.RecordsViewInfo.Items[1].GetCellViewInfoByItem( <br> cxGrid1DBTableView1Company).EditViewInfo.Font; <br> <br> ============================================================================ <br> <br> 根据Level名称找到Level对象 <br> <br> function GetLevelByName(AGrid: TcxGrid; ALevelName: string): TcxGridLevel; <br> <br> function LoopThroughLevels(ALevel: TcxGridLevel; ALevelName: string): TcxGridLevel; <br> var <br> I: Integer; <br> begin <br> Result := nil; <br> for I := 0 to ALevel.Count - 1 do <br> begin <br> if ALevel.Name = ALevelName then <br> begin <br> Result := ALevel; <br> Exit; <br> end; <br> if ALevel.Count > 0 then <br> begin <br> Result := LoopThroughLevels(ALevel, ALevelName); <br> if Result <> nil then <br> Exit; <br> end; <br> end; <br> end; <br> <br> var <br> I: Integer; <br> begin <br> Result := nil; <br> for I := 0 to AGrid.Levels.Count - 1 do <br> begin <br> if AGrid.Levels.Name = ALevelName then <br> begin <br> Result := AGrid.Levels; <br> Exit; <br> end; <br> if AGrid.Levels.Count > 0 then <br> begin <br> Result := LoopThroughLevels(AGrid.Levels, ALevelName); <br> if Result <> nil then <br> Exit; <br> end; <br> end; <br> end; <br> <br> ============================================================================ <br> <br> 指定Filter Builder打开/保存过滤文件的默认路径 <br> <br> uses <br> ..., cxFilterControlDialog; <br> <br> procedure TForm.GridView1FilterControlDialogShow( <br> Sender: TObject); <br> begin <br> TfmFilterControlDialog(Sender).OpenDialog.InitialDir := 'D:/' <br> end; <br> <br> ============================================================================ <br> <br> 保存/恢复带汇总行的布局 <br> <br> <TableView>.StoreToIniFile('c:/Grid.ini', True, [gsoUseSummary]); <br> <GridView>.RestoreFromIniFile(<inifilename>,True,False {or True, optional},[gsoUseSummary]); <br> <br> ============================================================================ <br> <br> 取消过滤时移到第一行 <br> <br> uses <br> cxCustomData; <br> <br> procedure TYour_Form.AViewDataControllerFilterChanged(Sender: TObject); <br> var <br> Filter: TcxDataFilterCriteria; <br> begin <br> with Sender as TcxDataFilterCriteria do <br> if IsEmpty then <br> DataController.FocusedRowIndex := 0; <br> end; <br> <br> ============================================================================= <br> <br> 排序后移到第一行 <br> <br> 可以设置DataController.Options.FocusTopRowAfterSorting := True,也可以使用如下的代码: <br> <br> uses <br> cxCustomData; <br> <br> procedure TYour_Form.Your_ViewDataControllerSortingChanged(Sender: TObject); <br> begin <br> TcxCustomDataController(Sender).FocusedRowIndex := 0; <br> end; <br> <br> ============================================================================== <br> <br> 判断当前行是否第一行或最后一行 <br> <br> 可以使用DataController的IsBOF, IsEOF方法,或者: <br> <AView>.Controller.Controller.FocusedRow.IsFirst <br> <AView>.Controller.Controller.FocusedRow.IsLast <br> <br> ============================================================================== <br> <br> 根据指定值查找记录 <br> <br> DataController提供了好几个方法来得到指定值对应的RecordIndex <br> 对于Bound View可以使用FindRecordIndexByKeyValue方法 <br> <br> =============================================================================== <br> <br> 编辑和显示Blob字段 <br> <br> 该字段的Properties设置为BlobEdit,并将BlobPaintStyle 属性设为 bpsText <br> <br> =============================================================================== <br> <br> 得到可见行数 <br> <br> <View>.ViewInfo.VisibleRecordCount <br> <br> =============================================================================== <br> <br> 保存后的行设置为当前行 <br> <br> const <br> CM_SETFOCUSEDRECORD = WM_USER + 1002; <br> <br> type <br> TForm1 = class(TForm) <br> cxGrid1DBTableView1: TcxGridDBTableView; <br> cxGrid1Level1: TcxGridLevel; <br> cxGrid1: TcxGrid; <br> dxMemData1: TdxMemData; <br> dxMemData1Field1: TStringField; <br> dxMemData1Field2: TIntegerField; <br> DataSource1: TDataSource; <br> cxGrid1DBTableView1RecId: TcxGridDBColumn; <br> cxGrid1DBTableView1Field1: TcxGridDBColumn; <br> cxGrid1DBTableView1Field2: TcxGridDBColumn; <br> Timer1: TTimer; <br> CheckBox1: TCheckBox; <br> procedure Timer1Timer(Sender: TObject); <br> procedure dxMemData1AfterPost(DataSet: TDataSet); <br> procedure CheckBox1Click(Sender: TObject); <br> private <br> procedure CMSetFocusedRecord(var Msg: TMessage); message CM_SETFOCUSEDRECORD; <br> public <br> { Public declarations } <br> end; <br> <br> var <br> Form1: TForm1; <br> FocusedIdx: Integer; <br> <br> <br> implementation <br> <br> {$R *.dfm} <br> <br> procedure TForm1.Timer1Timer(Sender: TObject); <br> begin <br> dxMemData1.AppendRecord(['', IntToStr(Random(1000)), Random(1000)]); <br> end; <br> <br> procedure TForm1.dxMemData1AfterPost(DataSet: TDataSet); <br> begin <br> PostMessage(Handle, CM_SETFOCUSEDRECORD, Integer(cxGrid1DBTableView1), MakeLParam(cxGrid1DBTableView1.Controller.FocusedRowIndex, cxGrid1DBTableView1.Controller.TopRowIndex)); <br> end; <br> <br> procedure TForm1.CMSetFocusedRecord(var Msg: TMessage); <br> begin <br> TcxGridDBTableView(msg.WParam).Controller.FocusedRowIndex := Msg.LParamLo; <br> TcxGridDBTableView(msg.WParam).Controller.TopRowIndex := Msg.LParamHi; <br> end; <br> <br> procedure TForm1.CheckBox1Click(Sender: TObject); <br> begin <br> Timer1.Enabled := TCheckBox(Sender).Checked; <br> end; <br> <br> end. <br> <br> ================================================================================= <br> <br> 删除记录并获得焦点 <br> <br> procedure TForm1.BtnDeleteClick(Sender: TObject); <br> var <br> FocusedRow, TopRow: Integer; <br> View: TcxGridTableView; <br> DataController: TcxGridDataController; <br> begin <br> View := cxGrid1.FocusedView as TcxGridTableView; <br> DataController := View.DataController; <br> <br> // Remember the top row (the vertical scrollbar position) <br> TopRow := View.Controller.TopRowIndex; <br> // Remember the focused row(!) index <br> FocusedRow := DataController.FocusedRowIndex; <br> <br> DataController.DeleteFocused; <br> <br> // After deletion the same row must be focused, <br> // although it will correspond to a different data record <br> DataController.FocusedRowIndex := FocusedRow; <br> // Restore the top row <br> View.Controller.TopRowIndex := TopRow; <br> end; <br><br>//=======================================================================================<br>数据库中的财务表为: <br> ID 收支类型 金额 其它属性 <br> <br> 其中收支类型只有两种值:0 表示收入,1 表示支出 ;金额都是正数。 <br> <br> 设置cxGrid的Footer 可以使得在显示时,列表的下方出现汇总行:“金额”的和 <br> 同样设置Default For Groups可以使得在用户拖动表头属性实现分组时,显示组内的汇总行:“金额”的和。 <br> <br> 上面说的,用过cxGrid应该都会,下面就有这么一个问题 <br> <br> 如果我想使汇总行的值变为如下的值应该怎样实现: <br> 收支类型为0的金额的和 - 收支类型为1的金额的和 <br> 实现Footer的功能好办,因为它的值不会变,自己用循环写一个就完了,但是Default For Groups的功能就不好说了,因为它的值是根据用户拖动的属性计算的,而且还有可能是多层分组,想不出来了,所有到这来问 <br> 是不是要设置什么属性?或者cxGrid根本就没这个功能,那该用什么方法解决?希望哪位帮我解决,谢谢了先! <br><br>给你一个例子,可能对你有帮助, <br> with tvOrders.DataController.Summary do <br> <br> begin <br> BeginUpdate; <br> try <br> SummaryGroups.Clear; <br> //The first summary group <br> with SummaryGroups.Add do <br> begin <br> //Add proposed grouping column(s) <br> TcxGridTableSummaryGroupItemLink(Links.Add).Column := tvOrdersCustomerID; <br> //Add summary items <br> with SummaryItems.Add as TcxGridDBTableSummaryItem do <br> begin <br> Column := tvOrdersPaymentAmount; <br> Kind := skSum; <br> Format := 'Amount Paid: $,0'; <br> end; <br> <br> with SummaryItems.Add as TcxGridDBTableSummaryItem do <br> begin <br> Column := tvOrdersPaymentAmount; <br> Kind := skCount; <br> Format := 'Records: 0'; <br> end; <br> <br> end; <br> <br> //The second summary group <br> with SummaryGroups.Add do <br> begin <br> //Add proposed grouping column(s) <br> TcxGridTableSummaryGroupItemLink(Links.Add).Column := tvOrdersProductID; <br> //Add summary items <br> with SummaryItems.Add as TcxGridDBTableSummaryItem do <br> begin <br> Column := tvOrdersQuantity; <br> Kind := skSum; <br> Position := spFooter; <br> Format := 'TOTAL = 0'; <br> end; <br> <br> with SummaryItems.Add as TcxGridDBTableSummaryItem do <br> begin <br> Column := tvOrdersPurchaseDate; <br> Kind := skMin; <br> Position := spFooter; <br> end; <br> end; <br> <br> finally <br> EndUpdate; <br> end; <br> end;