Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Gtk+/Gnome Application Development
Prev Home Next

Non-Homogeneous Box Packing Patterns

There are three interesting ways to pack a non-homogeneous box. First, you can pack all the widgets into the end of the box, with their natural size. This means setting the expand parameter to FALSE:


  gtk_box_pack_start(GTK_BOX(box),
                     child, 
                     FALSE, FALSE, 0);

The result is shown in Figure 6. The expand parameter is the only one that matters in this case; no children are receiving extra space, so they wouldn't be able to fill it even if fill were TRUE.

Figure 6. Non-homogeneous, with expand = FALSE

Second, you can spread widgets throughout the box, letting them keep their natural size as in Figure 7; this means setting the expand parameter to TRUE:


  gtk_box_pack_start(GTK_BOX(box),
                     child, 
                     TRUE, FALSE, 0);

Figure 7. Non-homogeneous, with expand = TRUE and fill = FALSE

Finally, you can fill the box with widgets (letting larger children have more space) by setting the fill parameter to TRUE as well:


  gtk_box_pack_start(GTK_BOX(box),
                     child, 
                     TRUE, TRUE, 0);

This configuration is shown in Figure 8

Figure 8. Non-homogeneous, with expand = TRUE and fill = TRUE

Gtk+/Gnome Application Development
Prev Home Next

 
 
  Published under free license. Design by Interspire