From 5042df3f7a3f4ea7932a4329559dd93477290322 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 23 Mar 2006 21:10:05 +0000 Subject: Fixed a bug in triggering onActiveStepChanged event. --- framework/Web/UI/WebControls/TMultiView.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'framework/Web/UI/WebControls/TMultiView.php') diff --git a/framework/Web/UI/WebControls/TMultiView.php b/framework/Web/UI/WebControls/TMultiView.php index 42e76349..5e9398f3 100644 --- a/framework/Web/UI/WebControls/TMultiView.php +++ b/framework/Web/UI/WebControls/TMultiView.php @@ -95,7 +95,7 @@ class TMultiView extends TControl $this->setControlState('ActiveViewIndex',$index,-1); $this->_cachedActiveViewIndex=-1; if($index>=0) - $this->activateView($views->itemAt($index)); + $this->activateView($views->itemAt($index),true); } else throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index); @@ -115,7 +115,7 @@ class TMultiView extends TControl return null; $view=$views->itemAt($index); if(!$view->getActive()) - $this->activateView($view); + $this->activateView($view,false); return $view; } @@ -135,20 +135,24 @@ class TMultiView extends TControl * Activates the specified view. * If there is any view currently active, it will be deactivated. * @param TView the view to be activated + * @param boolean whether to trigger OnActiveViewChanged event. */ - protected function activateView($view) + protected function activateView($view,$triggerViewChangedEvent=true) { if($view->getActive()) return; - $triggerEvent=$this->getControlStage()>=TControl::CS_STATE_LOADED || !$this->getPage() || !$this->getPage()->getIsPostBack(); + $triggerEvent=($this->getControlStage()>=TControl::CS_STATE_LOADED || ($this->getPage() && !$this->getPage()->getIsPostBack())); foreach($this->getViews() as $v) { if($v===$view) { $view->setActive(true); if($triggerEvent) + { $view->onActivate(null); - $this->onActiveViewChanged(null); + if($triggerViewChangedEvent) + $this->onActiveViewChanged(null); + } } else if($v->getActive()) { -- cgit v1.2.3