PHP-GTK ExplorerYour "secret weapon" for learning, exploring, understanding and mastering PHP-GTK2![Free Download Here] Table of Contents
General
|
Objective for this stepTo layout the widgets and produce the following:
The WidgetsFor a calculator, we will need the following widgets:
The Code
Use of ClassesNote that for this sample application, we start to use classes. For those who have not used classes before, don't worry too much. Just try to read the code, and I think you should be able to understand. The major difference is that the class variables and functions precede with '$this->'. It's absolutely possible to develop php-gtk2 applications without using classes, as we have seen in all the recipes. However, as you develop bigger and more complex php-gtk applications, you will find that classes help a lot in keeping the codes clean and neat. Most notably, you do not need to use any global variables, or pass along too many arguments between functions. Want a calculator with bigger buttons?
Don't like the small buttons? Want it bigger? No worry. Just resize the window to get this:
Notice how php-gtk2 automatically rearranges and resize the widgets to fit the bigger window - without the need of you to do any programming. This is a nice feature to have. But it also explains why most of the positioning of widgets in php-gtk is relative, and not absolute. When you design a php-gtk application, always test it with different window sizes and see if your widgets layout are still the way you want it to be. What's NextNow that we have the buttons in place, in the next step, we will put in the event handlers so that you can enter the numbers with mouse click or keyboard.Links |
Search This SiteSearch PHP-GTK2 ManualFull-text search on php-gtk2 manualMembers Login |
||||||||||||||||||||||||||||||||
|
|
|
|
||||||||||||||||||||||||||||||||