diff options
author | xue <> | 2006-01-02 20:59:17 +0000 |
---|---|---|
committer | xue <> | 2006-01-02 20:59:17 +0000 |
commit | 4d8ed423f7b4a8eae2898cc5552829595717a581 (patch) | |
tree | 69d23707abe6eedf9eda943fe029004aad39ccc8 /demos/quickstart/protected/pages/Controls/Samples | |
parent | 2df9a40f504933e28ddb9974b97ae4b2bb893f86 (diff) |
TCheckBoxList and TRadioButtonList completed.
Diffstat (limited to 'demos/quickstart/protected/pages/Controls/Samples')
6 files changed, 287 insertions, 46 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page index 7f8772c8..ac9de17e 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page @@ -6,10 +6,10 @@ <tr>
<td class="samplenote">
-Check box list with initial items:
+Check box list with default settings:
</td>
<td class="sampleaction">
-<com:TCheckBoxList AutoPostBack="true" BorderWidth="1px" BorderStyle="solid" BorderColor="black" GridLines="Both" RepeatLayout="Table" RepeatDirection="Horizontal" RepeatColumns="2">
+<com:TCheckBoxList>
<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" />
@@ -20,15 +20,110 @@ Check box list with initial items: <tr>
<td class="samplenote">
-Check box list with initial items:
+Check box list with customized cellpadding, cellspacing, color and text alignment:
</td>
<td class="sampleaction">
-<com:TRadioButtonList AutoPostBack="true" BorderWidth="1px" BorderStyle="solid" BorderColor="black" GridLines="Both" RepeatLayout="Table" RepeatDirection="Horizontal" RepeatColumns="2">
+<com:TCheckBoxList
+ CellPadding="5"
+ CellSpacing="1"
+ BackColor="silver"
+ TextAlign="Left">
<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:TRadioButtonList>
+</com:TCheckBoxList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Check box list with vertical (default) repeat direction:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList RepeatColumns="3">
+ <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:TCheckBoxList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Check box list with horizontal repeat direction:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList RepeatDirection="Horizontal" RepeatColumns="3">
+ <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:TCheckBoxList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Check box list with flow layout and vertical (default) repeat direction:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList RepeatLayout="Flow" RepeatColumns="3">
+ <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:TCheckBoxList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Check box list with flow layout and horizontal repeat direction:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList
+ RepeatLayout="Flow"
+ RepeatDirection="Horizontal"
+ RepeatColumns="3">
+ <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:TCheckBoxList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Check box list's behavior upon postback:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList ID="CheckBoxList">
+ <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:TCheckBoxList>
+<com:TButton Text="Submit" Click="buttonClicked" />
+<br/>
+<com:TLabel ID="SelectionResult" ForeColor="red" />
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Auto postback check box list:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList 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" Selected="true" />
+</com:TCheckBoxList>
+<com:TLabel ID="SelectionResult2" ForeColor="red" />
</td>
</tr>
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php index 6b1d07e1..3873ca30 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php @@ -2,50 +2,34 @@ class Home extends TPage
{
- public function selectionChanged($sender,$param)
- {
- $index=$sender->SelectedIndex;
- $value=$sender->SelectedValue;
- $text=$sender->SelectedItem->Text;
- $this->SelectionResult->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
- }
-
public function buttonClicked($sender,$param)
{
- $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;
+ $indices=$this->CheckBoxList->SelectedIndices;
$result='';
foreach($indices as $index)
{
- $item=$sender->Items[$index];
+ $item=$this->CheckBoxList->Items[$index];
$result.="(Index: $index, Value: $item->Value, Text: $item->Text)\n";
}
if($result==='')
- $this->MultiSelectionResult->Text='Your selection is empty.';
+ $this->SelectionResult->Text='Your selection is empty.';
else
- $this->MultiSelectionResult->Text='Your selection is: '.$result;
+ $this->SelectionResult->Text='Your selection is: '.$result;
}
- public function buttonClicked2($sender,$param)
+ public function selectionChanged($sender,$param)
{
- $indices=$this->ListBox2->SelectedIndices;
+ $indices=$sender->SelectedIndices;
$result='';
foreach($indices as $index)
{
- $item=$this->ListBox2->Items[$index];
+ $item=$sender->Items[$index];
$result.="(Index: $index, Value: $item->Value, Text: $item->Text)\n";
}
if($result==='')
- $this->MultiSelectionResult2->Text='Your selection is empty.';
+ $this->SelectionResult2->Text='Your selection is empty.';
else
- $this->MultiSelectionResult2->Text='Your selection is: '.$result;
+ $this->SelectionResult2->Text='Your selection is: '.$result;
}
}
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php index 3835d3c3..5dfa3bba 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php @@ -4,18 +4,26 @@ class Home extends TPage {
public function selectionChanged($sender,$param)
{
- $index=$sender->SelectedIndex;
- $value=$sender->SelectedValue;
- $text=$sender->SelectedItem->Text;
- $this->SelectionResult->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ if(($index=$sender->SelectedIndex)>=0)
+ {
+ $value=$sender->SelectedValue;
+ $text=$sender->SelectedItem->Text;
+ $this->SelectionResult->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ }
+ else
+ $this->SelectionResult->Text="Your selection is empty.";
}
public function buttonClicked($sender,$param)
{
- $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).";
+ if(($index=$this->ListBox1->SelectedIndex)>=0)
+ {
+ $value=$this->ListBox1->SelectedValue;
+ $text=$this->ListBox1->SelectedItem->Text;
+ $this->SelectionResult2->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ }
+ else
+ $this->SelectionResult2->Text="Your selection is empty.";
}
}
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page index 28d0dc1a..f6640879 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page @@ -122,33 +122,33 @@ List box with initial items: <tr>
<td class="samplenote">
-Auto postback list box:
+List box's behavior upon postback:
</td>
<td class="sampleaction">
-<com:TListBox AutoPostBack="true" SelectionMode="Multiple" SelectedIndexChanged="multiSelectionChanged">
+<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:TLabel ID="MultiSelectionResult" ForeColor="red" />
+<com:TButton Text="Submit" Click="buttonClicked2" />
+<br/>
+<com:TLabel ID="MultiSelectionResult2" ForeColor="red" />
</td>
</tr>
<tr>
<td class="samplenote">
-List box's behavior upon postback:
+Auto postback list box:
</td>
<td class="sampleaction">
-<com:TListBox ID="ListBox2" SelectionMode="Multiple">
+<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>
-<com:TButton Text="Submit" Click="buttonClicked2" />
-<br/>
-<com:TLabel ID="MultiSelectionResult2" ForeColor="red" />
+<com:TLabel ID="MultiSelectionResult" ForeColor="red" />
</td>
</tr>
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page new file mode 100644 index 00000000..95fea89b --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page @@ -0,0 +1,132 @@ +<com:TContent ID="body">
+
+<h1>TRadioButtonList Samples</h1>
+
+<table class="sampletable">
+
+<tr>
+<td class="samplenote">
+Radio button list with default settings:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList>
+ <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:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list with customized cellpadding, cellspacing, color and text alignment:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList
+ CellPadding="5"
+ CellSpacing="1"
+ BackColor="silver"
+ TextAlign="Left">
+ <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:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list with vertical (default) repeat direction:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList RepeatColumns="3">
+ <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:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list with horizontal repeat direction:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList RepeatDirection="Horizontal" RepeatColumns="3">
+ <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:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list with flow layout and vertical (default) repeat direction:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList RepeatLayout="Flow" RepeatColumns="3">
+ <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:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list with flow layout and horizontal repeat direction:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList
+ RepeatLayout="Flow"
+ RepeatDirection="Horizontal"
+ RepeatColumns="3">
+ <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:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list's behavior upon postback:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList ID="RadioButtonList">
+ <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:TRadioButtonList>
+<com:TButton Text="Submit" Click="buttonClicked" />
+<br/>
+<com:TLabel ID="SelectionResult" ForeColor="red" />
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Auto postback radio button list:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList 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:TRadioButtonList>
+<com:TLabel ID="SelectionResult2" ForeColor="red" />
+</td>
+</tr>
+
+</table>
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php new file mode 100644 index 00000000..47d9b23b --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php @@ -0,0 +1,22 @@ +<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ $index=$this->RadioButtonList->SelectedIndex;
+ $value=$this->RadioButtonList->SelectedValue;
+ $text=$this->RadioButtonList->SelectedItem->Text;
+ $this->SelectionResult->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ }
+
+ public function selectionChanged($sender,$param)
+ {
+ $index=$sender->SelectedIndex;
+ $value=$sender->SelectedValue;
+ $text=$sender->SelectedItem->Text;
+ $this->SelectionResult2->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ }
+}
+
+?>
\ No newline at end of file |