summaryrefslogtreecommitdiff
path: root/demos/quickstart
diff options
context:
space:
mode:
Diffstat (limited to 'demos/quickstart')
-rw-r--r--demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.page20
-rw-r--r--demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php27
2 files changed, 23 insertions, 24 deletions
diff --git a/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.page b/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.page
index 977b2a04..6f5508d3 100644
--- a/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.page
+++ b/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.page
@@ -3,7 +3,9 @@
<h1>Hangman Game</h1>
-<com:TPanel ID="IntroPanel">
+<com:TMultiView ID="GameMultiView">
+
+<com:TView ID="IntroView">
<p>This is the game of Hangman. You must guess a word, a letter at a time.
If you make too many mistakes, you lose the game!</p>
<com:TRadioButtonList ID="LevelSelection">
@@ -13,9 +15,9 @@ If you make too many mistakes, you lose the game!</p>
</com:TRadioButtonList>
<com:TButton Text="Play!" OnClick="selectLevel" />
<com:TLabel ID="LevelError" Text="You must choose a difficulty level!" ForeColor="red" Visible="false" />
-</com:TPanel>
+</com:TView>
-<com:TPanel ID="GuessPanel" Visible="false">
+<com:TView ID="GuessView">
<h2>Please make a guess</h2>
<h3 style="letter-spacing: 4px;"><%= $this->Page->GuessWord %></h3>
<p>You have made <%=$this->Page->Misses %> bad guesses
@@ -49,18 +51,20 @@ out of a maximum of <%= $this->Page->Level %>.</p>
<com:TLinkButton ID="GuessZ" Text="Z" OnClick="guessWord" />
</p>
<p><com:TLinkButton Text="Give up?" OnClick="giveUp" /></p>
-</com:TPanel>
+</com:TView>
-<com:TPanel ID="WinPanel" Visible="false">
+<com:TView ID="WinView">
<h2>You Win!</h2>
<p>The word was: <%= $this->Page->Word %>.</p>
<p><com:TLinkButton Text="Start Again" OnClick="startAgain" /></p>
-</com:TPanel>
+</com:TView>
-<com:TPanel ID="LosePanel" Visible="false">
+<com:TView ID="LoseView">
<h2>You Lose!</h2>
<p>The word was: <%= $this->Page->Word %>.</p>
<p><com:TLinkButton Text="Start Again" OnClick="startAgain" /></p>
-</com:TPanel>
+</com:TView>
+
+</com:TMultiView>
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php b/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php
index cbbd1c56..1d78186d 100644
--- a/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php
+++ b/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php
@@ -1,7 +1,12 @@
<?php
-
class Home extends TPage
{
+ public function onLoad($param)
+ {
+ if (!$this->IsPostBack)
+ $this->GameMultiView->ActiveView=$this->IntroView;
+ }
+
public function selectLevel($sender,$param)
{
if(($selection=$this->LevelSelection->SelectedValue)==='')
@@ -10,11 +15,11 @@ class Home extends TPage
return;
}
else
- $this->Level=TPropertyValue::ensureInteger($selection);
+ $this->Level=TPropertyValue::ensureInteger($selection);
$this->Word=$this->generateWord();
$this->GuessWord=str_repeat('_',strlen($this->Word));
$this->Misses=0;
- $this->showPanel('GuessPanel');
+ $this->GameMultiView->ActiveView=$this->GuessView;
}
public function guessWord($sender,$param)
@@ -35,7 +40,7 @@ class Home extends TPage
{
$this->GuessWord=$guessWord;
if($guessWord===$word)
- $this->showPanel('WinPanel');
+ $this->GameMultiView->ActiveView=$this->WinView;
}
else
{
@@ -47,12 +52,12 @@ class Home extends TPage
public function giveUp($sender,$param)
{
- $this->showPanel('LosePanel');
+ $this->GameMultiView->ActiveView=$this->LoseView;
}
public function startAgain($sender,$param)
{
- $this->showPanel('IntroPanel');
+ $this->GameMultiView->ActiveView=$this->IntroView;
$this->LevelError->Visible=false;
for($letter=65;$letter<=90;++$letter)
{
@@ -73,15 +78,6 @@ class Home extends TPage
return strtoupper($word);
}
- protected function showPanel($panelID)
- {
- $this->IntroPanel->Visible=false;
- $this->GuessPanel->Visible=false;
- $this->WinPanel->Visible=false;
- $this->LosePanel->Visible=false;
- $this->$panelID->Visible=true;
- }
-
public function setLevel($value)
{
$this->setViewState('Level',$value,0);
@@ -122,5 +118,4 @@ class Home extends TPage
return $this->getViewState('Misses',0);
}
}
-
?> \ No newline at end of file