From a9bdf9fde29c5bf71d3a402fc15806ca8923aea8 Mon Sep 17 00:00:00 2001
From: xue <>
Date: Fri, 4 Aug 2006 15:40:44 +0000
Subject: Fixed #320.

---
 framework/Web/UI/WebControls/TWizard.php | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'framework/Web/UI/WebControls')

diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php
index f92742e7..2d54afbe 100644
--- a/framework/Web/UI/WebControls/TWizard.php
+++ b/framework/Web/UI/WebControls/TWizard.php
@@ -716,9 +716,11 @@ class TWizard extends TWebControl implements INamingContainer
 	}
 
 	/**
+	 * Returns the multiview that holds the wizard steps.
+	 * This method should only be used by control developers.
 	 * @return TMultiView the multiview holding wizard steps
 	 */
-	protected function getMultiView()
+	public function getMultiView()
 	{
 		if($this->_multiView===null)
 		{
@@ -741,7 +743,6 @@ class TWizard extends TWebControl implements INamingContainer
 		if(($wizard=$step->getWizard())!==null)
 			$wizard->getWizardSteps()->remove($step);
 		$step->setWizard($this);
-		$this->getMultiView()->getViews()->add($step);
 		$this->wizardStepsChanged();
 	}
 
@@ -753,7 +754,6 @@ class TWizard extends TWebControl implements INamingContainer
 	 */
 	public function removedWizardStep($step)
 	{
-		$this->getMultiView()->getViews()->remove($step);
 		$step->setWizard(null);
 		$this->wizardStepsChanged();
 	}
@@ -1263,7 +1263,7 @@ class TWizard extends TWebControl implements INamingContainer
 		if($this->_sideBarDataList!==null)
 		{
 			$this->_sideBarDataList->setDataSource($this->getWizardSteps());
-			$this->_sideBarDataList->setSelectedIndex($this->getActiveStepIndex());
+			$this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex());
 			$this->_sideBarDataList->dataBind();
 		}
 	}
@@ -1817,6 +1817,7 @@ class TWizardStepCollection extends TList
 		if($item instanceof TWizardStep)
 		{
 			parent::insertAt($index,$item);
+			$this->_wizard->getMultiView()->getViews()->insertAt($index,$item);
 			$this->_wizard->addedWizardStep($item);
 		}
 		else
@@ -1831,6 +1832,7 @@ class TWizardStepCollection extends TList
 	public function removeAt($index)
 	{
 		$step=parent::removeAt($index);
+		$this->_wizard->getMultiView()->getViews()->remove($step);
 		$this->_wizard->removedWizardStep($step);
 		return $step;
 	}
-- 
cgit v1.2.3