diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-06-06 10:53:53 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-06-06 10:53:53 +0000 |
commit | e13c6696573c00f10d169f17111c4e88ac9f6085 (patch) | |
tree | 2389bbf1e15f6bf2ebc22ef142569da4a12e49e6 /extras/tiopf/gui | |
parent | 71e003bf3981beb941fb5724bb7031b9410c7ea0 (diff) | |
download | fpGUI-e13c6696573c00f10d169f17111c4e88ac9f6085.tar.xz |
* Fixed a bug in the tiCompositeMediators (StringGrid) where it still used 1-based indexing and not 0-based indexing.
Diffstat (limited to 'extras/tiopf/gui')
-rw-r--r-- | extras/tiopf/gui/tiCompositeMediators.pas | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/extras/tiopf/gui/tiCompositeMediators.pas b/extras/tiopf/gui/tiCompositeMediators.pas index 4ecd1b92..adb7e69c 100644 --- a/extras/tiopf/gui/tiCompositeMediators.pas +++ b/extras/tiopf/gui/tiCompositeMediators.pas @@ -76,7 +76,7 @@ type procedure SetSelectedObject(const AValue: TtiObject); procedure SetShowDeleted(const AValue: Boolean); procedure DoCreateItemMediator(AData: TtiObject); overload; - procedure DoCreateItemMediator(AData: TtiObject; pRowIdx : Integer); overload; + procedure DoCreateItemMediator(AData: TtiObject; ARowIdx : Integer); overload; protected FDisplayNames: string; FIsObserving: boolean; @@ -140,7 +140,7 @@ type protected // procedure SetupFields; public - constructor CreateCustom(AModel: TtiObject; AGrid: TfpgStringGrid; ADisplayNames: string; pRowIndex: integer; IsObserving: Boolean = True); + constructor CreateCustom(AModel: TtiObject; AGrid: TfpgStringGrid; ADisplayNames: string; ARowIndex: integer; IsObserving: Boolean = True); procedure BeforeDestruction; override; procedure Update(ASubject: TtiObject); override; published @@ -222,13 +222,15 @@ end; //end; -constructor TStringGridRowMediator.CreateCustom(AModel: TtiObject; AGrid : TfpgStringGrid; ADisplayNames: string; pRowIndex : integer; IsObserving: Boolean); +constructor TStringGridRowMediator.CreateCustom(AModel: TtiObject; + AGrid: TfpgStringGrid; ADisplayNames: string; ARowIndex: integer; + IsObserving: Boolean); begin inherited Create; FModel := AModel; FView := AGrid; FDisplayNames := ADisplayNames; - FRowIndex := pRowIndex; + FRowIndex := ARowIndex; if IsObserving then FModel.AttachObserver(self); @@ -248,11 +250,10 @@ var lFieldName: string; begin Assert(FModel = ASubject); - for i := 1 to tiNumToken(FDisplayNames, cFieldDelimiter) do + for i := 0 to tiNumToken(FDisplayNames, cFieldDelimiter)-1 do begin - lField := tiToken(FDisplayNames, cFieldDelimiter, i); + lField := tiToken(FDisplayNames, cFieldDelimiter, i+1); lFieldName := tiFieldName(lField); - FView.Cells[i, FRowIndex] := FModel.PropValue[lFieldName]; end; end; @@ -654,21 +655,20 @@ begin DataAndPropertyValid(AData); end; -procedure TCompositeStringGridMediator.DoCreateItemMediator(AData: TtiObject; pRowIdx: Integer); +procedure TCompositeStringGridMediator.DoCreateItemMediator(AData: TtiObject; ARowIdx: Integer); var i: Integer; lField: string; lFieldName: string; lMediatorView: TStringGridRowMediator; begin - FView.Objects[0, pRowIdx] := AData; - for i := 1 to tiNumToken(FDisplayNames, cFieldDelimiter) do + FView.Objects[0, ARowIdx] := AData; + for i := 0 to tiNumToken(FDisplayNames, cFieldDelimiter)-1 do begin - lField := tiToken(FDisplayNames, cFieldDelimiter, i); + lField := tiToken(FDisplayNames, cFieldDelimiter, i+1); lFieldName := tiFieldName(lField); - FView.Cells[i-1, pRowIdx] := AData.PropValue[lFieldName]; - - lMediatorView := TStringGridRowMediator.CreateCustom(AData, FView, FDisplayNames, pRowIdx, FIsObserving); + FView.Cells[i, ARowIdx] := AData.PropValue[lFieldName]; + lMediatorView := TStringGridRowMediator.CreateCustom(AData, FView, FDisplayNames, ARowIdx, FIsObserving); FMediatorList.Add(lMediatorView); end; end; @@ -695,7 +695,7 @@ begin for i := 0 to FModel.Count-1 do begin - if not FModel.Items[i].Deleted or FShowDeleted then + if (not FModel.Items[i].Deleted) or FShowDeleted then DoCreateItemMediator(FModel.Items[i], i); end; end; @@ -772,7 +772,6 @@ begin FModel.DetachObserver(Self); FModel := nil; FView := nil; - inherited BeforeDestruction; end; |