PHP WinBinder: Text input: Difference between revisions

Jump to navigation Jump to search
Proofreading and grammatical changes; some minor reformatting
(New page: {{Nav PHP WinBinder}} '''''Text and numeric input''''' Previous page covered very basic I/O this page looks at obtaining data (numeric and text) from a user. In addition I have thrown in ...)
 
(Proofreading and grammatical changes; some minor reformatting)
Line 2: Line 2:
'''''Text and numeric input'''''
'''''Text and numeric input'''''


Previous page covered very basic I/O this page looks at obtaining data (numeric and text) from a user. In addition I have thrown in a little extra user output feedback.
The previous page covered very basic I/O. This page looks at obtaining data (numeric and text) from a user. In addition, I have thrown in a little extra user feedback.


Example 3 uses Example 2 as a template in reality there are only small changes.
Example 3 uses Example 2 as a template. In reality there are only small changes.


== Cotrol Creation ==
== Control Creation ==
Again we use this this function to create controls:
Again we use this this function to create controls:
{|
{|
Line 15: Line 15:
</pre>
</pre>
|}
|}
I have have reduced it however there is an extra parameter '''style''' that we will be using :
I have reduced it, however there is an extra parameter, '''style''', that we will be using:
{|
{|
|-
|-
Line 23: Line 23:
|}
|}


Style changes either the look of a control for example WBC_BORDER will produce a sunken looks on a label.
Style changes the look of a control. For example, WBC_BORDER will produce a 3-D look on a label.


Changes label3 as follows:
Changes label3 as follows:
<pre>
<pre>
$text  = " This is test 3 on two lines\n Sunken Label";
$text  = " This is test 3 on two lines\n Sunken Label";
$label3 = wb_create_control($mainwin, Label, $text,   5, 60, 140, 40, 103, WBC_BORDER);
$label3 = wb_create_control($mainwin, Label, $text, 5, 60, 140, 40, 103, WBC_BORDER);
</pre>
</pre>


or it can change a controls functionality see edit box below..
or it can change a control's functionality as in the edit box below.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
Line 52: Line 52:
* Each EditBox has a unique ID 301,302
* Each EditBox has a unique ID 301,302
* handles are captured in variables $editbox1 and $editbox2 these are optional
* handles are captured in variables $editbox1 and $editbox2 these are optional
* You can find a components handle using it's ID for example '''wb_get_control($window, 301)'''
* You can find a component's handle using its ID. For example, '''wb_get_control($window, 301)'''
|}
|}


Line 66: Line 66:
|'''xpos,'''|| '''ypos''', '''width''' and '''height''' Tweak the values to position and size EditBox.  
|'''xpos,'''|| '''ypos''', '''width''' and '''height''' Tweak the values to position and size EditBox.  
|-
|-
|'''id'''|| A unique integer identifies a control. Start from 100 to avoid clashes. Say labels will be 100 push buttons 200 and edit boxes start at 300 etc
|'''id'''|| A unique integer identifies a control. Start from 100 to avoid clashes. Say labels will be 100, push buttons 200, and edit boxes start at 300, etc.
|-
|-
|'''style'''|| Optional if not provided the window will accept all characters. Setting style to WBC_NUMBER only characters 0 to 9 are excepted.
|'''style'''|| Optional if not provided the window will accept all characters. Setting style to WBC_NUMBER only characters 0 to 9 are excepted.
|}
|}


Place the above in section two of the template. Once the main window is created the two controls are created
Place the above in section two of the template. Once the main window is created the two controls are created.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
Line 99: Line 99:
|-valign="top"
|-valign="top"
|
|
At this stage running the script will produce a window as shown on the right.
At this stage, running the script will produce a window as shown on the right.


The pushbuttons will perform what was specified for Example 2.
The pushbuttons will perform what was specified for Example 2.


Lets specify new functionality for the buttons.  
Let's specify new functionality for the buttons.  
   
   
'''''Button Specification'''''
'''''Button Specification'''''
* '''Apache''' When clicked changes label1 to display “Apache Port = 80” and display a grren square to right of edit box 1.  
* '''Apache''' When clicked changes label1 to display “Apache Port = 80” and displays a green square to right of edit box 1.  
* '''MySQL''' When clicked changes label2 to display “MySQL Port = 3306”
* '''MySQL''' When clicked changes label2 to display “MySQL Port = 3306”
* '''Alert''' When clicked changes both labels to what was entered in the text boxes. Adds or replaces green square with a red one.
* '''Alert''' When clicked changes both labels to what was entered in the text boxes. Adds or replaces green square with a red one.
Line 154: Line 154:
|}
|}


'''''[[#top | Top]]'''''
==== MySQL Button ====
==== MySQL Button ====
Handler code for MySQL button:
Handler code for MySQL button:
Line 172: Line 171:
* break exits switch
* break exits switch
|}
|}
'''''[[#top | Top]]'''''


==== Alert Button ====
==== Alert Button ====

Navigation menu