Jump to navigation Jump to search

PHP WinBinder: Tab Control 2

13 bytes added, 15:41, 29 January 2010
Proofreading and grammatical changes; some minor reformatting
'''''Tab Control 2'''''
On the previous page , we built a tabbed application was built and we finished with a working script. There were two issues highlighted which we will address on this page addresses These issues are more about coding style than functionality.
== 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.
=== ID's IDs ===
A method I proposed on the previous page for generating unique ID remains applicable.
* A Tab page starts at 1000 next page 2000 etc
Hence to To create the first label on tab page 2 would give an ID of (2000+100) '''2100'''
Raw ID's 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)
'''''Note'':''' You can use a more realistic name for an ID , for example ID_L1101 could be replaced with ID_Apache_Port
=== Handles ===
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 . This must be unique. It follows the convention outlined above.
'''''[[#top | Top]]'''''
== Interaction ==
<br /> 
'''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 because we are using function wb_get_control to obtain a Handle
'''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.
== Summary ==
The above script can be used as a working template. You can delete and add controls as required. To complete a working windows 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.
'''''[[#top | Top]]'''''

Navigation menu