From ba30bb0298fc9c7b448d280884d1beb1368300c3 Mon Sep 17 00:00:00 2001 From: graemeg Date: Sun, 7 Sep 2008 22:20:47 +0000 Subject: * Bugfix in TDynamicComboBoxView mediator class. * A few other minor changes to mediators * Extended the tiOPF demo 21 even further, showing more features of MGM implementation. --- extras/tiopf/gui/tiListMediators.pas | 14 ++++++++++---- extras/tiopf/gui/tiMediators.pas | 8 ++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'extras/tiopf/gui') diff --git a/extras/tiopf/gui/tiListMediators.pas b/extras/tiopf/gui/tiListMediators.pas index 5aca05d7..f00fa56d 100644 --- a/extras/tiopf/gui/tiListMediators.pas +++ b/extras/tiopf/gui/tiListMediators.pas @@ -33,9 +33,10 @@ type procedure SetSelectedObject(const AValue: TtiObject);override; procedure CreateColumns; override; procedure DoCreateItemMediator(AData: TtiObject; ARowIdx : Integer); override; - Function GetGuiControl : TComponent; override; - Procedure SetGuiControl (Const AValue : TComponent); override; + function GetGuiControl : TComponent; override; + procedure SetGuiControl (Const AValue : TComponent); override; procedure SetupGUIandObject; override; + procedure ClearList; override; procedure RebuildList; override; public constructor CreateCustom(AModel: TtiObjectList; AView: TfpgListView; ADisplayNames: string; AIsObserving: Boolean = True); overload; @@ -43,7 +44,7 @@ type class function ComponentClass: TClass; override; Constructor Create; override; Destructor Destroy; override; - procedure HandleSelectionChanged; override; + procedure HandleSelectionChanged; {override;} published property View: TfpgListView read FView Write SetView; end; @@ -131,7 +132,7 @@ type destructor Destroy; override; class function CompositeMediator: Boolean; override; class function ComponentClass: TClass; override; - procedure HandleSelectionChanged; override; + procedure HandleSelectionChanged; {override;} property View: TfpgListBox read FView; end; @@ -234,6 +235,11 @@ begin // FView.ScrollBars := ssAutoBoth; end; +procedure TListViewMediator.ClearList; +begin + View.Items.Clear; +end; + procedure TListViewMediator.RebuildList; begin MediatorList.Clear; diff --git a/extras/tiopf/gui/tiMediators.pas b/extras/tiopf/gui/tiMediators.pas index 828a5eb8..2825c1f4 100644 --- a/extras/tiopf/gui/tiMediators.pas +++ b/extras/tiopf/gui/tiMediators.pas @@ -508,8 +508,10 @@ end; procedure TMediatorDynamicComboBoxView.SetListObject(const AValue: TtiObjectList); begin - Inherited; + inherited; InternalListRefresh; + if Assigned(ValueList) then + EditControl.Enabled := ValueList.Count > 0; end; procedure TMediatorDynamicComboBoxView.InternalListRefresh; @@ -565,7 +567,9 @@ begin if UseInternalOnChange then EditControl.OnChange := @DoOnChange; // default OnChange event handler - EditControl.Enabled := (ValueList.Count > 0); + {$Note As far as I can see, ValueList is always going to be nil here! - Graeme } + if ValueList <> nil then + EditControl.Enabled := (ValueList.Count > 0); end; procedure TMediatorDynamicComboBoxView.DoGuiToObject; -- cgit v1.2.3-70-g09d2