From 1edb9a7a9cfefb2847e36beac5287435267c69e9 Mon Sep 17 00:00:00 2001 From: alexs75 Date: Thu, 14 Mar 2013 14:29:55 +0000 Subject: [PATCH] 1. TRxDBLookupCombo - fix fired OnClosePopup event 2. TRxDBGrid - fix show filter in table dropdown box in Windows XP git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2702 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/rxdbgrid.pas | 51 +++++++++++++++++++---------------- components/rx/rxlookup.pas | 2 +- components/rx/rxpopupunit.pas | 6 ++--- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/components/rx/rxdbgrid.pas b/components/rx/rxdbgrid.pas index 68e470c4c..fd2a4915d 100644 --- a/components/rx/rxdbgrid.pas +++ b/components/rx/rxdbgrid.pas @@ -680,9 +680,7 @@ type read FAllowedOperations write FAllowedOperations default [aoInsert, aoUpdate, aoDelete, aoAppend]; property OptionsRx: TOptionsRx read FOptionsRx write SetOptionsRx; -// property FooterColor: TColor read FFooterColor write SetFooterColor default clWindow; property FooterColor: TColor read GetFooterColor write SetFooterColor default clWindow; deprecated; -// property FooterRowCount: integer read FFooterRowCount write SetFooterRowCount default 0; property FooterRowCount: integer read GetFooterRowCount write SetFooterRowCount default 0; deprecated; property OnFiltred: TNotifyEvent read FOnFiltred write FOnFiltred; @@ -1694,24 +1692,25 @@ var begin if FOptionsRx = AValue then exit; + BeginUpdate; OldOpt := FOptionsRx; FOptionsRx := AValue; UseXORFeatures := rdgXORColSizing in AValue; if (rdgFilter in AValue) and not (rdgFilter in OldOpt) then begin LayoutChanged; - BeginUpdate; +{ BeginUpdate; CalcTitle; - EndUpdate; + EndUpdate;} end else if rdgFilter in OldOpt then begin FFilterListEditor.Hide; LayoutChanged; - BeginUpdate; +{ BeginUpdate; CalcTitle; - EndUpdate; + EndUpdate;} end; FFooterOptions.FActive:=rdgFooterRows in FOptionsRx; @@ -1719,7 +1718,8 @@ begin if (rdgWordWrap in OldOpt) and not (rdgWordWrap in FOptionsRx) then ResetRowHeght; - VisualChange; +// VisualChange; + EndUpdate; end; procedure TRxDBGrid.SetPropertyStorage(const AValue: TCustomPropertyStorage); @@ -3066,6 +3066,7 @@ procedure TRxDBGrid.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: in var Cell: TGridCoord; Rect: TRect; + C:TRxColumn; begin QuickUTF8Search := ''; @@ -3086,20 +3087,23 @@ begin Rect := getFilterRect(CellRect(Cell.x, Cell.y)); if (Cell.Y = 0) and (Cell.X >= Ord(dgIndicator in Options)) and (Rect.Top < Y) then begin - if TRxColumn(Columns[Columns.RealIndex(Cell.x - 1)]).Filter.ValueList.Count > 0 then - with FFilterListEditor do - begin - Items.Clear; - Items.AddStrings(TRxColumn(Columns[Columns.RealIndex(Cell.x - 1)]).Filter.ValueList); - Parent := Self; - Width := Rect.Right - Rect.Left; - Height := Rect.Bottom - Rect.Top; - BoundsRect := Rect; - Style := csDropDownList; - 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; + C:=TRxColumn (Columns[Columns.RealIndex(Cell.x - 1)]); + if C.Filter.ValueList.Count > 0 then + begin + FFilterListEditor.Style := csDropDownList; + if C.Filter.DropDownRows>0 then + FFilterListEditor.DropDownCount := C.Filter.DropDownRows; + + FFilterListEditor.Parent := Self; + FFilterListEditor.Width := Rect.Right - Rect.Left; + FFilterListEditor.Height := Rect.Bottom - Rect.Top; + FFilterListEditor.BoundsRect := Rect; + + FFilterListEditor.Items.Assign(C.Filter.ValueList); + + FFilterListEditor.Text := C.Filter.Value; + FFilterListEditor.Show(Self, Cell.x - 1); + end; exit; end; end; @@ -3905,6 +3909,7 @@ var C: TRxColumn; i: integer; begin + BeginUpdate; OptionsRx := OptionsRx + [rdgFilter]; for i := 0 to Columns.Count - 1 do @@ -3934,6 +3939,8 @@ begin DataSource.DataSet.First; DataSource.DataSet.EnableControls; end; + + EndUpdate; end; procedure TRxDBGrid.OnFilterClose(Sender: TObject); @@ -4977,10 +4984,8 @@ begin FValueList.Sorted := True; FColor := clWhite; - // FColor := clSkyBlue; FEmptyFont.Style := [fsItalic]; FEmptyValue := sRxDBGridEmptiFilter; - //FFont.Style := [fsItalic]; end; destructor TRxColumnFilter.Destroy; diff --git a/components/rx/rxlookup.pas b/components/rx/rxlookup.pas index 83150f443..7f2ff962c 100644 --- a/components/rx/rxlookup.pas +++ b/components/rx/rxlookup.pas @@ -1075,7 +1075,7 @@ begin {$IFDEF LINUX} TempF:=FRxPopUpForm; if FRxPopUpForm.ShowModal = mrOk then - OnInternalClosePopup(true); + {OnInternalClosePopup(true)}; TempF.Free; FRxPopUpForm:=nil {$ENDIF} diff --git a/components/rx/rxpopupunit.pas b/components/rx/rxpopupunit.pas index e3e779efd..84cab8bf7 100644 --- a/components/rx/rxpopupunit.pas +++ b/components/rx/rxpopupunit.pas @@ -252,13 +252,11 @@ begin Result.DataSet:=ADataSet; Result.LookupDisplayIndex:=ALookupDisplayIndex; -// AControl.Caption:=''; Result.WControl:=AControl; if Assigned(Font) then begin Result.FGrid.Font.Assign(Font); -// Result.Font.Assign(Font); end; {$IFDEF LINUX} @@ -299,7 +297,7 @@ end; procedure TPopUpForm.FormClose(Sender: TObject; var CloseAction: TCloseAction); begin CloseAction:=caFree; - if Assigned(FOnPopUpCloseEvent) then + if (ModalResult <> mrOk) and Assigned(FOnPopUpCloseEvent) then FOnPopUpCloseEvent(FFindResult); end; @@ -321,7 +319,7 @@ end; procedure TPopUpForm.Deactivate; begin inherited Deactivate; - if Assigned(FOnPopUpCloseEvent) then + if (ModalResult = mrOk) and Assigned(FOnPopUpCloseEvent) then FOnPopUpCloseEvent(FFindResult); Close; end;