1: <?php
2: require_once('../qcubed.inc.php');
3:
4: class RefreshForm extends QForm {
5: protected $panel1;
6: protected $txt1;
7:
8: protected $panel2;
9: protected $txt2;
10:
11:
12: protected $btnServer1;
13: protected $btnServer2;
14:
15: protected $btnAjax1;
16: protected $btnAjax2;
17:
18: protected function Form_Create() {
19: $this->txt1 = new QTextBox($this, 'txtNoWrap');
20: $this->txt1->Name = "Wrapperless";
21: $this->txt1->Text = "Text without wrapper";
22: $this->txt1->UseWrapper = false;
23:
24: $this->panel1 = new QPanel($this, 'pnlNoWrap');
25: $this->panel1->Text = 'Stuff in the panel without a wrapper';
26: $this->panel1->BorderStyle = QBorderStyle::Solid;
27: $this->panel1->BorderColor = 'red';
28: $this->panel1->BorderWidth = 1;
29: $this->panel1->UseWrapper = false;
30:
31: $this->txt2 = new QTextBox($this, 'txtWrap');
32: $this->txt2->Name = "With Wrapper";
33: $this->txt2->Text = "Some stuff with wrapper";
34: $this->txt2->UseWrapper = true;
35: $this->txt2->Display = false;
36:
37: $this->panel2 = new QPanel($this, 'pnlWrap');
38: $this->panel2->Text = 'Other stuff in the panel with a wrapper';
39: $this->panel2->BorderStyle = QBorderStyle::Dashed;
40: $this->panel2->BorderColor = 'blue';
41: $this->panel2->BorderWidth = 1;
42: $this->panel2->UseWrapper = true;
43: $this->panel2->Display = false;
44:
45: $this->btnServer1 = new QButton ($this, 'btnServerToggle');
46: $this->btnServer1->Text = 'Server Display Toggle';
47: $this->btnServer1->AddAction(new QClickEvent(), new QServerAction('display_toggle'));
48:
49: $this->btnAjax1 = new QButton ($this, 'btnAjaxToggle');
50: $this->btnAjax1->Text = 'Ajax Display Toggle';
51: $this->btnAjax1->AddAction(new QClickEvent(), new QAjaxAction('display_toggle'));
52:
53: $this->btnServer2 = new QButton ($this, 'btnServerChange');
54: $this->btnServer2->Text = 'Server Change Item';
55: $this->btnServer2->AddAction(new QClickEvent(), new QServerAction('change_item'));
56:
57: $this->btnAjax2 = new QButton ($this, 'btnAjaxChange');
58: $this->btnAjax2->Text = 'Ajax Change Item';
59: $this->btnAjax2->AddAction(new QClickEvent(), new QAjaxAction('change_item'));
60: }
61:
62: protected function display_toggle($strFormId, $strControlId, $strParameter) {
63: $this->panel1->Display = !$this->panel1->Display;
64: $this->panel2->Display = !$this->panel2->Display;
65: $this->txt1->Display = !$this->txt1->Display;
66: $this->txt2->Display = !$this->txt2->Display;
67: }
68:
69: public function change_item($strFormId, $strControlId, $term) {
70: $col = $this->txt1->Columns;
71: $this->txt1->Columns = $this->txt1->Columns > 20 ? 10 : 30;
72: $this->txt1->Name = $this->txt1->Name . '-';
73: $this->txt2->Columns = $this->txt2->Columns > 20 ? 10 : 30;
74: $this->txt2->Name = $this->txt2->Name . '-';
75:
76: $this->panel1->BorderWidth = $this->panel1->BorderWidth == 1 ? 5 : 1;
77: $this->panel2->BorderWidth = $this->panel2->BorderWidth == 1 ? 5 : 1;
78: }
79:
80: }
81: RefreshForm::Run('RefreshForm');
82: ?>