summaryrefslogtreecommitdiff
path: root/demos/quickstart
diff options
context:
space:
mode:
authorxue <>2005-12-30 22:19:07 +0000
committerxue <>2005-12-30 22:19:07 +0000
commit71ca767f51b53d6b162bd6fdccfb125f2dc94d35 (patch)
treee239318ea5ef056900440bd89af7fced400539ae /demos/quickstart
parentf5545817ebd1aeea0fd1527720ab83954665689e (diff)
Added TListBox samples.
Diffstat (limited to 'demos/quickstart')
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page121
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php46
2 files changed, 107 insertions, 60 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page
index 43ab16f7..776fc073 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page
@@ -1,81 +1,92 @@
<com:TContent ID="body">
-<h1>TTextBox Samples</h1>
+<h1>TListBox Samples</h1>
<div class="samplepanel">
-<div class="sampletitle">SingleLine and Password Text Boxes</div>
-
-Text box with default settings:
-<com:TTextBox />
-<br/>
-
-Password text box:
-<com:TTextBox TextMode="Password" />
+<div class="sampletitle"><tt>Single</tt> Selection List Box</div>
+List box with default settings:<br/>
+<com:TListBox />
<br/>
-Text box with customized color, font, columns, maximum length:
-<com:TTextBox
- Text="text"
- ForeColor="yellow"
- BackColor="blue"
- Font.Size="14pt"
- Columns="4"
- MaxLength="6"
-/>
+List box with initial items:<br/>
+<com:TListBox>
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TListBox>
<br/>
-Disabled text box:
-<com:TTextBox Text="disabled" Enabled="false" />
+List box with customized row number, color and font:<br/>
+<com:TListBox Rows="3" ForeColor="blue" Font.Size="14pt">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TListBox>
<br/>
-Read-only text box:
-<com:TTextBox Text="read only" ReadOnly="true" />
+Auto postback list box:<br/>
+<com:TListBox AutoPostBack="true" SelectedIndexChanged="selectionChanged">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TListBox>
+<com:TLabel ID="SelectionResult" ForeColor="red" />
<br/>
-Auto postback text box:
-<com:TTextBox Text="change me" AutoPostBack="true" TextChanged="textChanged" />
+List box's behavior upon postback:<br/>
+<com:TListBox ID="ListBox1">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TListBox>
+<com:TButton Text="Submit" Click="buttonClicked"/>
+<com:TLabel ID="SelectionResult2" ForeColor="red" />
<br/>
-
-Text box's behavior upon postback:
-<com:TTextBox ID="TextBox1" Text="text" />
-<com:TButton Text="Submit" Click="submitText" />
-
</div>
<div class="samplepanel">
-<div class="sampletitle">MultiLine Text Boxes</div>
-
-Text box with default settings:<br/>
-<com:TTextBox TextMode="MultiLine" />
+<div class="sampletitle"><tt>Multiple</tt> Selection List Box</div>
+<i>Use Shift + Left Click to change selection</i>
<br/>
-
-Text box with customized dimensions, font and content:<br/>
-<com:TTextBox TextMode="MultiLine" Rows="6" Columns="60" Font.Italic="true">
-<prop:Text>
-This is a multiline text box.
-In HTML, it is displayed as a textarea.
-</prop:Text>
-</com:TTextBox>
+List box with default settings:<br/>
+<com:TListBox SelectionMode="Multiple" />
<br/>
-Disabled text box:<br/>
-<com:TTextBox
- TextMode="MultiLine"
- Text="disabled"
- Enabled="false" />
+List box with initial items:<br/>
+<com:TListBox SelectionMode="Multiple">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" Selected="true" />
+</com:TListBox>
<br/>
-Read-only text box with text-wrapping disabled:<br/>
-<com:TTextBox
- TextMode="MultiLine"
- Text="This is a read-only text box with text-wrapping disabled."
- ReadOnly="true"
- Wrap="false"/>
+Auto postback list box:<br/>
+<br/>
+<com:TListBox AutoPostBack="true" SelectionMode="Multiple" SelectedIndexChanged="multiSelectionChanged">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" Selected="true" />
+</com:TListBox>
+<br/>
+<com:TLabel ID="MultiSelectionResult" ForeColor="red" />
<br/>
-Auto postback text box:<br/>
-<com:TTextBox TextMode="MultiLine" Text="change me" AutoPostBack="true" TextChanged="textChanged" />
+List box's behavior upon postback:<br/>
+<com:TListBox ID="ListBox2" SelectionMode="Multiple">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" Selected="true" />
+</com:TListBox>
+<com:TButton Text="Submit" Click="buttonClicked2" />
<br/>
-</div>
+<com:TLabel ID="MultiSelectionResult2" ForeColor="red" />
+</div>
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php
index 5f812c9e..6b1d07e1 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php
@@ -1,15 +1,51 @@
<?php
-class Samples extends TPage
+class Home extends TPage
{
- public function textChanged($sender,$param)
+ public function selectionChanged($sender,$param)
{
- $sender->Text="text changed";
+ $index=$sender->SelectedIndex;
+ $value=$sender->SelectedValue;
+ $text=$sender->SelectedItem->Text;
+ $this->SelectionResult->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
}
- public function submitText($sender,$param)
+ public function buttonClicked($sender,$param)
{
- $this->TextBox1->Text="You just entered '".$this->TextBox1->Text."'.";
+ $index=$this->ListBox1->SelectedIndex;
+ $value=$this->ListBox1->SelectedValue;
+ $text=$this->ListBox1->SelectedItem->Text;
+ $this->SelectionResult2->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ }
+
+ public function multiSelectionChanged($sender,$param)
+ {
+ $indices=$sender->SelectedIndices;
+ $result='';
+ foreach($indices as $index)
+ {
+ $item=$sender->Items[$index];
+ $result.="(Index: $index, Value: $item->Value, Text: $item->Text)\n";
+ }
+ if($result==='')
+ $this->MultiSelectionResult->Text='Your selection is empty.';
+ else
+ $this->MultiSelectionResult->Text='Your selection is: '.$result;
+ }
+
+ public function buttonClicked2($sender,$param)
+ {
+ $indices=$this->ListBox2->SelectedIndices;
+ $result='';
+ foreach($indices as $index)
+ {
+ $item=$this->ListBox2->Items[$index];
+ $result.="(Index: $index, Value: $item->Value, Text: $item->Text)\n";
+ }
+ if($result==='')
+ $this->MultiSelectionResult2->Text='Your selection is empty.';
+ else
+ $this->MultiSelectionResult2->Text='Your selection is: '.$result;
}
}