diff --git a/components/rx/rxdbgrid.pas b/components/rx/rxdbgrid.pas index 807b27c45..ff9ecbadd 100644 --- a/components/rx/rxdbgrid.pas +++ b/components/rx/rxdbgrid.pas @@ -4884,8 +4884,7 @@ begin if FCommand = AValue then exit; FCommand := AValue; - Changed(true); -/// Changed(False); + Changed(False); end; procedure TRxDBGridKeyStroke.SetShortCut(const AValue: TShortCut); @@ -4894,8 +4893,7 @@ begin exit; FShortCut := AValue; Menus.ShortCutToKey(FShortCut, FKey, FShift); - Changed(true); -/// Changed(False); + Changed(False); end; function TRxDBGridKeyStroke.GetDisplayName: string; @@ -4911,9 +4909,6 @@ begin Command := TRxDBGridKeyStroke(Source).Command; ShortCut := TRxDBGridKeyStroke(Source).ShortCut; Enabled := TRxDBGridKeyStroke(Source).Enabled; - -{ Shift := TSynEditKeyStroke(Source).Shift; - Shift2 := TSynEditKeyStroke(Source).Shift2; } end else inherited Assign(Source); diff --git a/components/rx/rxlookup.pas b/components/rx/rxlookup.pas index 6794d1d3a..83150f443 100644 --- a/components/rx/rxlookup.pas +++ b/components/rx/rxlookup.pas @@ -621,7 +621,7 @@ begin Glyph.Assign(P); P.Free; ButtonWidth:=15; - FPopUpFormOptions:=TPopUpFormOptions.Create; + FPopUpFormOptions:=TPopUpFormOptions.Create(Self); end; destructor TRxCustomDBLookupEdit.Destroy; @@ -1562,7 +1562,7 @@ begin FFieldList := TStringList.Create; FValuesList:= TStringList.Create; FLocateObject:=CreateLocate(nil); - FPopUpFormOptions:=TPopUpFormOptions.Create; + FPopUpFormOptions:=TPopUpFormOptions.Create(Self); //Lookup FLookupDataLink:=TLookupSourceLink.Create; // FLookupDataLink.FDataControl:=Self; diff --git a/components/rx/rxpopupunit.pas b/components/rx/rxpopupunit.pas index 319c3218f..e3e779efd 100644 --- a/components/rx/rxpopupunit.pas +++ b/components/rx/rxpopupunit.pas @@ -136,12 +136,14 @@ type { TPopUpFormColumns } - TPopUpFormColumns = class(TCollection) + TPopUpFormColumns = class(TOwnedCollection) private FPopUpFormOptions: TPopUpFormOptions; function GetPopUpColumn(Index: Integer): TPopUpColumn; procedure SetPopUpColumn(Index: Integer; const AValue: TPopUpColumn); public + Constructor Create(AOwner: TPersistent); + procedure Assign(Source: TPersistent); override; property PopUpFormOptions:TPopUpFormOptions read FPopUpFormOptions write FPopUpFormOptions; property Items[Index: Integer]: TPopUpColumn read GetPopUpColumn write SetPopUpColumn; default; end; @@ -162,6 +164,7 @@ type FShowTitles: boolean; FTitleButtons: boolean; FTitleStyle: TTitleStyle; + FOwner:TPersistent; function GetColumns: TPopUpFormColumns; procedure SetAutoFillColumns(const AValue: boolean); procedure SetAutoSort(const AValue: boolean); @@ -172,8 +175,10 @@ type procedure SetShowTitles(const AValue: boolean); procedure SetTitleButtons(const AValue: boolean); procedure SetTitleStyle(const AValue: TTitleStyle); + protected + function GetOwner: TPersistent; dynamic; public - constructor Create; + constructor Create(AOwner:TPersistent); destructor Destroy; override; procedure Assign(Source: TPersistent); override; property DataSource:TDataSource read FDataSource write FDataSource; @@ -615,8 +620,14 @@ begin FTitleStyle:=AValue; end; -constructor TPopUpFormOptions.Create; +function TPopUpFormOptions.GetOwner: TPersistent; begin + Result:=FOwner; +end; + +constructor TPopUpFormOptions.Create(AOwner: TPersistent); +begin + FOwner:=AOwner; inherited Create; FAutoSort:=false; FDropDownCount:=8; @@ -626,7 +637,7 @@ begin FTitleButtons:=false; FTitleStyle:=tsLazarus; FBorderStyle:=bsNone; - FColumns:=TPopUpFormColumns.Create(TPopUpColumn); + FColumns:=TPopUpFormColumns.Create(AOwner); FColumns.FPopUpFormOptions:=Self; end; @@ -814,6 +825,27 @@ begin Items[Index].Assign( AValue ); end; +constructor TPopUpFormColumns.Create(AOwner: TPersistent); +begin + inherited Create(AOwner, TPopUpColumn); +end; + +procedure TPopUpFormColumns.Assign(Source: TPersistent); +var + i: integer; +begin + if Source is TPopUpFormColumns then + begin + Clear; + for i := 0 to TPopUpFormColumns(Source).Count-1 do + begin + with Add do + Assign(TPopUpFormColumns(Source)[i]); + end; + end else + inherited Assign(Source); +end; + { TPopUpGrid } procedure TPopUpGrid.ClearFind;