Changes

Jump to navigation Jump to search

PHP WinBinder: Tab Control

109 bytes removed, 15:29, 29 January 2010
Proofreading and grammatical changes; some minor reformatting
'''''Tab Control'''''
When applications become too visually large its , it's better to split the functionality into logical sections and use a tab control to access each section.
This page covers creating a windows Windows application based only on the tab control and controls placed on the tabbed pages. The techniques used are applicable to larger applications where a tab control is part of a larger application.
== Cotrol Control Creation ==
Creating a tab control and adding controls to each tab requires the use of all parameters that can be passed to the create control function.
For reference , the parameters are shown below:
{|
|-
|'''ntab'''|| is the index of the tab page that the control is to be inserted on, if any.
|}
 
'''''[[#top | Top]]'''''
 
== Tabs ==
To create a tab application, start with a blank canvas (use example1 as a template) and follow this sequence:
'''''Note'':''' Individual tabs have a numerical index, first tab starts at 0.
'''''[[#top | Top]]'''''
=== Main Tab Area ===
{|
[[Image:WinBinder_4.gif]]
|}
'''''[[#top | Top]]'''''
=== Add individual tabs ===
'''''[[#top | Top]]'''''
== Handles and ID’s IDs ==
Everyone has his or her own personal preference regarding programming style. I like to define handles to variables with a name that reflects the tab page and allocate ID’s to match tab page and control type.
{|
 
|
'''''ID'sIDs'':'''
* Labels start at 100
* Push buttons start at 200
Handle variable '''$label_p2_1''' with an ID (2000+100) '''2100'''
'''''Note 1'':''' The above is just a guide however . However what is written in stone is that all variables and ID’s IDs '''must be unique'''.
'''''Note 2'':''' Although assigning handles to variables appears a logical way to proceed , code becomes difficult to maintain. Similarly using pure ID’s IDs makes it difficult to change code. Both We'll address these issues are resolved on the next page [[PHP WinBinder: Tab Control 2 | '''Tab Control 2''']] a bit later.
'''''[[#top | Top]]'''''
== Adding controls to tabs ==
We currently have three tabs to . To each of these we will add two labels, three buttons and a EditBox. This will allow you to easily see the differences.
{|
|-
 
|
The far right digit assigns a control to that tab number (remember , tabs are indexed starting at 0)  Fourth number from right is a controls ID this must be unique. It follows the convention outlined above.
Fourth number from right is a controls ID. This must be unique. It follows the convention outlined above.
For labels and edit boxes , their handle is captured in a variable these follow following the convention outlined above.
|}
The above produces the following:
[[Image:WinBinder_6.gif]]
Currently there is no functionality , hence pressing a button has no effect.
'''''[[#top | Top]]'''''
</pre>
|
<br /> 
'''''Functionality'''''
Navigate to folder
 
UniServer\plugins\winbinder\'''examples'''
I mentioned above code maintainabilityabove.
Each use of a handle variable in a function requires that it be declared as a global. This just adds to the bloat and makes code a little more difficult to read and is to be avoided.
Using raw ID numbers means if you decided decide to change the numbering order , you need to change all occurrences. On a single script this is probably not to difficult however , but if this is over several scripts , it can be a pain.
The above problems are resolved on the next page.
For In this example what is important is , the structure of the scriptis the important part. It’s a working script that we can change into a working template.
|}
'''''[[#top | Top]]'''''
== Summary ==
The tab control is an excellent choice for producing windows applications. It allows you to have separate functionality on individual pages (tabs). Using the tab control , although a little more complex to configure configurem is well worth the effort.
Although the above Even though this is a working script , we want to modify it to a working template for a real applicationsapplication. The [[PHP WinBinder: Tab Control 2 | '''next page''']] shows how to resolves resolve the issues that were highlighted.
'''''[[#top | Top]]'''''

Navigation menu