diff --git a/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi b/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi index 30399a8b0..dbdcf9a73 100644 --- a/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi +++ b/components/rx/Demos/RxDBGrid/RxDBGridDemo.lpi @@ -71,9 +71,10 @@ + - + @@ -497,8 +498,6 @@ - - @@ -508,27 +507,22 @@ - - - - - @@ -780,127 +774,39 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - - - - - - + + - - + + - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - + diff --git a/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm b/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm index 735113a85..71106241c 100644 --- a/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm +++ b/components/rx/Demos/RxDBGrid/rxdbgridmainunit.lfm @@ -5,7 +5,7 @@ object RxDBGridMainForm: TRxDBGridMainForm Width = 1187 ActiveControl = Panel1 Caption = 'RxDBGrid Demo' - ClientHeight = 698 + ClientHeight = 702 ClientWidth = 1187 Menu = MainMenu1 OnCreate = FormCreate @@ -13,8 +13,8 @@ object RxDBGridMainForm: TRxDBGridMainForm LCLVersion = '1.1' object RxDBGrid1: TRxDBGrid Left = 0 - Height = 634 - Top = 64 + Height = 648 + Top = 54 Width = 1187 TitleButtons = True AutoSort = True @@ -81,7 +81,7 @@ object RxDBGridMainForm: TRxDBGridMainForm Title.Orientation = toHorizontal Title.Hint = 'Product name' Title.ShowHint = True - Width = 136 + Width = 110 FieldName = 'NAME' Filter.Font.Style = [fsItalic] Filter.DropDownRows = 0 @@ -268,22 +268,22 @@ object RxDBGridMainForm: TRxDBGridMainForm end object Panel1: TPanel Left = 0 - Height = 64 + Height = 54 Top = 0 Width = 1187 Align = alTop AutoSize = True - ClientHeight = 64 + ClientHeight = 54 ClientWidth = 1187 TabOrder = 1 object Label1: TLabel AnchorSideLeft.Control = Button2 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 245 - Height = 15 + Left = 240 + Height = 13 Top = 7 - Width = 34 + Width = 26 BorderSpacing.Around = 6 Caption = 'Mode' ParentColor = False @@ -292,9 +292,9 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = Panel1 AnchorSideTop.Control = Panel1 Left = 7 - Height = 27 + Height = 23 Top = 7 - Width = 77 + Width = 83 Action = actCalcTotal AutoSize = True BorderSpacing.Around = 6 @@ -304,10 +304,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = Button1 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 90 - Height = 27 + Left = 96 + Height = 23 Top = 7 - Width = 149 + Width = 138 Action = actOptimizeColumnsWidthAll AutoSize = True BorderSpacing.Around = 6 @@ -318,11 +318,11 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CheckBox2 AnchorSideTop.Side = asrBottom - Left = 474 - Height = 22 + Left = 469 + Height = 17 Hint = 'Use filter line' - Top = 35 - Width = 78 + Top = 30 + Width = 63 BorderSpacing.Left = 6 Caption = 'Use filter' OnChange = CheckBox1Change @@ -332,12 +332,12 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = Label1 AnchorSideTop.Control = Label1 AnchorSideTop.Side = asrBottom - Left = 251 - Height = 25 - Top = 28 + Left = 246 + Height = 21 + Top = 26 Width = 217 BorderSpacing.Around = 6 - ItemHeight = 0 + ItemHeight = 13 ItemIndex = 0 Items.Strings = ( 'Edit mode' @@ -352,11 +352,11 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = ComboBox1 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 474 - Height = 22 + Left = 469 + Height = 17 Hint = 'Auto fill column width' Top = 7 - Width = 122 + Width = 97 BorderSpacing.Around = 6 Caption = 'Auto fill columns' OnChange = CheckBox2Change @@ -366,10 +366,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = CheckBox2 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 602 - Height = 22 + Left = 572 + Height = 17 Top = 7 - Width = 113 + Width = 90 BorderSpacing.Around = 6 Caption = 'Show indicator' Checked = True @@ -382,10 +382,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CheckBox3 AnchorSideTop.Side = asrBottom - Left = 602 - Height = 22 - Top = 35 - Width = 111 + Left = 572 + Height = 17 + Top = 30 + Width = 88 BorderSpacing.Around = 6 Caption = 'Show headers' Checked = True @@ -397,10 +397,10 @@ object RxDBGridMainForm: TRxDBGridMainForm AnchorSideLeft.Control = CheckBox3 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Panel1 - Left = 721 - Height = 22 + Left = 668 + Height = 17 Top = 7 - Width = 90 + Width = 73 BorderSpacing.Around = 6 Caption = 'Word wrap' OnChange = CheckBox5Change diff --git a/components/rx/rxdbgrid.pas b/components/rx/rxdbgrid.pas index bc473d3ec..48ab93a26 100644 --- a/components/rx/rxdbgrid.pas +++ b/components/rx/rxdbgrid.pas @@ -2086,13 +2086,14 @@ end; procedure TRxDBGrid.UpdateJMenuStates; begin - F_PopupMenu.Items[0].Enabled := rdgAllowDialogFind in FOptionsRx; - F_PopupMenu.Items[1].Enabled := rdgAllowFilterForm in FOptionsRx; - F_PopupMenu.Items[2].Enabled := rdgAllowQuickFilter in FOptionsRx; - F_PopupMenu.Items[3].Enabled := + F_PopupMenu.Items[0].Visible := rdgAllowDialogFind in FOptionsRx; + F_PopupMenu.Items[1].Visible := rdgAllowFilterForm in FOptionsRx; + F_PopupMenu.Items[2].Visible := rdgAllowQuickFilter in FOptionsRx; + F_PopupMenu.Items[3].Visible := (rdgFilter in FOptionsRx) or (rdgAllowFilterForm in FOptionsRx); - F_PopupMenu.Items[5].Enabled := rdgAllowSortForm in FOptionsRx; - F_PopupMenu.Items[6].Enabled := rdgAllowColumnsForm in FOptionsRx; + F_PopupMenu.Items[5].Visible := rdgAllowSortForm in FOptionsRx; + F_PopupMenu.Items[6].Visible := rdgAllowColumnsForm in FOptionsRx; + F_PopupMenu.Items[7].Visible := dgMultiselect in Options; end; procedure TRxDBGrid.UpdateJMenuKeys; @@ -3139,7 +3140,7 @@ begin else MPT.Y := Rct.Bottom; MPT := ClientToScreen(MPT); - // DrawCell(0,0,F_TopRect,[gdFixed]); + UpdateJMenuStates; F_PopupMenu.Popup(MPT.X, MPT.Y); end; @@ -3260,14 +3261,18 @@ begin exit; end; - VK_DOWN: if not (aoAppend in FAllowedOperations) then + VK_DOWN: + if not (aoAppend in FAllowedOperations) then begin FTmpReadOnly := ReadOnly; ReadOnly := True; inherited KeyDown(Key, Shift); ReadOnly := FTmpReadOnly; exit; - end; + end +{ else + UpdateRowsHeight; + VK_UP:UpdateRowsHeight}; end; inherited KeyDown(Key, Shift); if Key <> 0 then @@ -3356,6 +3361,9 @@ end; procedure TRxDBGrid.Paint; begin + if rdgWordWrap in FOptionsRx then + UpdateRowsHeight; + inherited Paint; if FFooterOptions.Active and (FFooterOptions.RowCount > 0) then DrawFooterRows; @@ -3374,7 +3382,8 @@ begin else if FFooterOptions.Active and (FFooterOptions.RowCount > 0) then UpdateFooterRowOnUpdateActive; -// CalcStatTotals; + + // UpdateRowsHeight; end; procedure TRxDBGrid.UpdateData; @@ -3387,84 +3396,9 @@ begin inherited MoveSelection; if Assigned(FFooterOptions) and FFooterOptions.Active and (FFooterOptions.RowCount > 0) then DrawFooterRows; +// UpdateRowsHeight; end; -(* -function TRxDBGrid.GetBufferCount: integer; -var - i, J, W, H, H1, HW, k:integer; - B:boolean; - F:TField; - S:string; - - CurActiveRecord: Integer; -begin - b:=false; - for i:=0 to Columns.Count-1 do - begin - if TRxColumn(Columns[i]).WordWrap then - begin - B:=true; - Break; - end; - end; - if not B then - Result:=inherited GetBufferCount - else - begin - CurActiveRecord:=DataLink.ActiveRecord; - Result:=0; - HW:=0; - K:=1; - for i:=GCache.VisibleGrid.Top to GCache.VisibleGrid.Bottom do - begin - DataLink.ActiveRecord:=i - FixedRows; - H:=1; //DefaultRowHeight; - for j:=0 to Columns.Count-1 do - begin - W:=Columns[i].Width; - if TRxColumn(Columns[i]).WordWrap then - begin - F:=Columns[i].Field; - if Assigned(F) then - S:=F.DisplayText - else - S:=''; - - H1 := Max((Canvas.TextWidth(S) + 2) div W + 1, H); - if H1 > WordCount(S, [' ']) then - H1 := WordCount(S, [' ']); - end; - H:=Max(H, H1); - end; - HW:=HW + H * DefaultRowHeight; - - if HW>Height then - break; - - RowHeights[K] := DefaultRowHeight * H; - - inc(K); - inc(Result); - end; - DataLink.ActiveRecord:=CurActiveRecord; -{ - if (ARow>=FixedRows) and FDataLink.Active then - begin - FDataLink.ActiveRecord:=ARow-FixedRows; - FDrawingActiveRecord := ARow = Row; - FDrawingMultiSelRecord := (dgMultiSelect in Options) and - SelectedRows.CurrentRowSelected - end else begin - FDrawingActiveRecord := False; - FDrawingMultiSelRecord := False; - end; - - } - end; -end; -*) - procedure TRxDBGrid.CMHintShow(var Message: TLMessage); var Cell: TGridCoord; @@ -3580,8 +3514,8 @@ begin inherited VisualChange; CalcTitle; - if rdgWordWrap in FOptionsRx then - UpdateRowsHeight; +{ if rdgWordWrap in FOptionsRx then + UpdateRowsHeight;} end; function TRxDBGrid.EditorByStyle(Style: TColumnButtonStyle): TWinControl;