PHP WinBinder: Tab Control 2: Difference between revisions

Jump to navigation Jump to search
Proofreading and grammatical changes; some minor reformatting
(New page: {{Nav PHP WinBinder}} '''''Tab Control 2''''' On the previous page a tabbed application was built and we finished with a working script. There were two issues highlighted which this page ...)
 
(Proofreading and grammatical changes; some minor reformatting)
 
Line 2: Line 2:
'''''Tab Control 2'''''
'''''Tab Control 2'''''


On the previous page a tabbed application was built and we finished with a working script. There were two issues highlighted which this page addresses.
On the previous page, we built a tabbed application and finished with a working script. There were two issues highlighted which we will address on this page. These issues are more about coding style than functionality.
 
These issues are more about coding style than functionality.


== Handles and ID’s ==
== Handles and ID’s ==
As an application grows certain coding styles can lead to problems. Generally to circumvent these requires a little more work up front covered in this section.
As an application grows certain coding styles can lead to problems. Generally to circumvent these requires a little more work up front covered in this section.


=== ID's ===
=== IDs ===
A method I proposed on the previous page for generating unique ID remains applicable.
A method I proposed on the previous page for generating unique ID remains applicable.
{|
{|
Line 20: Line 18:
* A Tab page starts at 1000 next page 2000 etc
* A Tab page starts at 1000 next page 2000 etc
|}
|}
Hence to create first label on tab page 2 would give an ID of (2000+100) '''2100'''
To create the first label on tab page 2 would give an ID of (2000+100) '''2100'''


Raw ID's will be assigned to a constant for example
Raw IDs will be assigned to a constant, for example


define("ID_L1101", 1101); // Defines the ID for Label on tab page 1 (tab indexes start from 0)
define("ID_L1101", 1101); // Defines the ID for Label on tab page 1 (tab indexes start from 0)


'''''Note'':''' You can use a more realistic name for an ID for example ID_L1101 could be replaced with ID_Apache_Port
'''''Note'':''' You can use a more realistic name for an ID, for example ID_L1101 could be replaced with ID_Apache_Port


=== Handles ===
=== Handles ===
Line 121: Line 119:
The far right digit assigns a control to that tab number (remember tabs are indexed starting at 0)
The far right digit assigns a control to that tab number (remember tabs are indexed starting at 0)


 
Fourth number (constant) from right is a controls ID. This must be unique. It follows the convention outlined above.
Fourth number (constant) from right is a controls ID this must be unique. It follows the convention outlined above.


|}
|}
Line 131: Line 128:


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
== Interaction ==
== Interaction ==
{|
{|
Line 208: Line 204:
</pre>
</pre>
|
|
<br />
 
 
'''''Functionality'''''
'''''Functionality'''''


Line 220: Line 217:
'''Page 1''' buttons directly run code. Individual segments of code can become long and difficult to read. Page 2 button processing is a possible solution to this.
'''Page 1''' buttons directly run code. Individual segments of code can become long and difficult to read. Page 2 button processing is a possible solution to this.


'''''Note'':''' Global variables are no longer required we are using function wb_get_control to obtain a Handle  
'''''Note'':''' Global variables are no longer required because we are using function wb_get_control to obtain a Handle  




'''Page 2''' buttons call a function to perform the processing. This reduces size of the handler function making it easier to read.
'''Page 2''' buttons call a function to perform the processing. This reduces the size of the handler function making it easier to read.


'''''Note'':''' The window variable needs to be passed to the function
'''''Note'':''' The window variable needs to be passed to the function.




Line 405: Line 402:


== Summary ==
== Summary ==
The above script can be used as a working template. You can delete and add controls as required. To complete a working windows application throw in a bit of cosmetics and functionality.
The above script can be used as a working template. You can delete and add controls as required. To complete a working Windows application, throw in a bit of cosmetics and functionality.


[[PHP WinBinder: Tab Control 3 | '''Next page''']] covers adding cosmetics (static controls) a logo (icon) and some additional functionality to produce a specific application template.
[[PHP WinBinder: Tab Control 3 | '''Next page''']] covers adding cosmetics (static controls), a logo (icon) and some additional functionality to produce a specific application template.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''

Navigation menu