Changes

Jump to navigation Jump to search

PHP WinBinder: Text input

48 bytes removed, 14:12, 29 January 2010
Proofreading and grammatical changes; some minor reformatting
'''''Text and numeric input'''''
Previous The previous page covered very basic I/O this . This page looks at obtaining data (numeric and text) from a user. In addition , I have thrown in a little extra user output feedback.
Example 3 uses Example 2 as a template in . In reality there are only small changes.
== Cotrol Control Creation ==
Again we use this this function to create controls:
{|
</pre>
|}
I have have reduced it , however there is an extra parameter , '''style''' , that we will be using :
{|
|-
|}
Style changes either the look of a control for . For example , WBC_BORDER will produce a sunken looks 3-D look on a label.
Changes label3 as follows:
<pre>
$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);
</pre>
or it can change a controls control's functionality see as in the edit box below..
'''''[[#top | Top]]'''''
* Each EditBox has a unique ID 301,302
* handles are captured in variables $editbox1 and $editbox2 these are optional
* You can find a components component's handle using it's its ID for . For example , '''wb_get_control($window, 301)'''
|}
|'''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.
|-
|'''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.
'''''[[#top | Top]]'''''
|-valign="top"
|
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.
Lets Let's specify new functionality for the buttons.
'''''Button Specification'''''
* '''Apache''' When clicked changes label1 to display “Apache Port = 80” and display displays a grren green square to right of edit box 1.
* '''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.
|}
'''''[[#top | Top]]'''''
==== MySQL Button ====
Handler code for MySQL button:
* break exits switch
|}
 
'''''[[#top | Top]]'''''
==== Alert Button ====

Navigation menu