diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-12-15 12:07:01 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-12-15 12:07:01 +0200 |
commit | b956076431dc82d83d73de24ee5436c5c9a8f4a2 (patch) | |
tree | 7782b86693a001d4171f6ae28e2ca5d1fec0c8ad /extras | |
parent | f9aed3bf96db7c51b2362e9149279015ed9eb28c (diff) | |
download | fpGUI-b956076431dc82d83d73de24ee5436c5c9a8f4a2.tar.xz |
Updated tiOPF List Mediators to work with latest tiOPF2 code.
* DoCreateItemMediator is now a function instead of a procedure.
Diffstat (limited to 'extras')
-rw-r--r-- | extras/tiopf/gui/tiListMediators.pas | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/extras/tiopf/gui/tiListMediators.pas b/extras/tiopf/gui/tiListMediators.pas index 8f924306..0476cd27 100644 --- a/extras/tiopf/gui/tiListMediators.pas +++ b/extras/tiopf/gui/tiListMediators.pas @@ -26,7 +26,7 @@ type function GetSelectedObject: TtiObject; override; procedure SetSelectedObject(const AValue: TtiObject); override; procedure CreateColumns; override; - procedure DoCreateItemMediator(AData: TtiObject; ARowIdx: integer); override; + function DoCreateItemMediator(AData: TtiObject; ARowIdx: integer): TtiListItemMediator; override; procedure DoDeleteItemMediator(AIndex: Integer; AMediator: TtiListItemMediator); override; procedure SetupGUIandObject; override; procedure ClearList; override; @@ -47,7 +47,7 @@ type { Composite mediator for TfpgStringGrid } TtiStringGridMediatorView = class(TtiCustomListMediatorView) private - procedure DoCreateItemMediator(AData: TtiObject; ARowIdx: integer); override; + function DoCreateItemMediator(AData: TtiObject; ARowIdx: integer): TtiListItemMediator; override; procedure DoDeleteItemMediator(AIndex: Integer; AMediator: TtiListItemMediator); override; protected function GetSelectedObject: TtiObject; override; @@ -131,10 +131,9 @@ begin Result := GetObjectFromItem(View.Items.Item[View.ItemIndex]); end; -procedure TtiListViewMediatorView.DoCreateItemMediator(AData: TtiObject; ARowIdx: integer); +function TtiListViewMediatorView.DoCreateItemMediator(AData: TtiObject; ARowIdx: integer): TtiListItemMediator; var li: TfpgLVItem; - m: TtiListViewListItemMediator; begin DataAndPropertyValid(AData); { Create ListItem and Mediator } @@ -142,9 +141,9 @@ begin try li := TfpgLVItem.Create(View.Items); View.Items.Add(li); - m := TtiListViewListItemMediator.CreateCustom(AData, li, OnBeforeSetupField, FieldsInfo, Active); - li.UserData := m; - MediatorList.Add(m); + Result := TtiListViewListItemMediator.CreateCustom(AData, li, OnBeforeSetupField, FieldsInfo, Active); + li.UserData := Result; + MediatorList.Add(Result); finally View.EndUpdate; end; @@ -395,11 +394,10 @@ begin end; { for } end; -procedure TtiStringGridMediatorView.DoCreateItemMediator(AData: TtiObject; ARowIdx: integer); +function TtiStringGridMediatorView.DoCreateItemMediator(AData: TtiObject; ARowIdx: integer): TtiListItemMediator; var i: integer; lFieldName: string; - lMediatorView: TtiStringGridRowMediator; begin View.BeginUpdate; try @@ -410,9 +408,9 @@ begin lFieldName := FieldsInfo[i].PropName; View.Cells[i, ARowIdx] := tiGetProperty(AData, lFieldName); // set Cell text end; - lMediatorView := TtiStringGridRowMediator.CreateCustom(AData, View, FieldsInfo, ARowIdx, Active); - View.Objects[0, ARowIdx] := lMediatorView; // set Object reference inside grid. It used to be AData. - MediatorList.Add(lMediatorView); + Result := TtiStringGridRowMediator.CreateCustom(AData, View, FieldsInfo, ARowIdx, Active); + View.Objects[0, ARowIdx] := Result; // set Object reference inside grid. It used to be AData. + MediatorList.Add(Result); finally View.EndUpdate; end; |