1.5 Resize application window
|Written by kksou|
|Wednesday, 12 March 2008|
We will resize the application window to 400 x 200 in this example.
Resize widgets (including GtkWindow) is easy with a call to the method GtkWidget::set_size_request().
Note that if you specify only the width, e.g. $window->set_size_request(400,-1) you will get the following.
If you specify only the height, e.g. $window->set_size_request(-1,200), you will get:
The method GtkWidget::set_size_request(). is supposed to work with all GtkWidgets, including GtkWindow, GtkLabel and GtkButtons. However, easy as it might seem, this is one area that frustrates a lot of people new to php-gtk.
Of course, there are always two sides to a coin. Please take a look at this example. A user can choose the calculator button size he or she likes by resizing the application window. Php-gtk2 automatically rearranges and resizes the widgets to fit the new window - without the need of you to do any programming!
So, how do we set the size of the label and button in php-gtk?
This leads us to the first fundamental building block of php-gtk: Size and Positioning.
|< Prev||Next >|