Next Previous Up Top Contents Index

7.3 A tour of layouts

7.3.3 Pinboard layouts and fixed layouts

A pinboard layout is a framework that serves as a place to locate any number of child gadgets. It has no built in layout information, so, unless you specify coordinates explicitly, any object placed in a pinboard layout is placed at the coordinates 0,0 (top left), with the most recently created object on top.

In normal use, you should supply coordinate information for each child to determine its position in the layout. You have complete flexibility in positioning objects in a pinboard layout by giving each object coordinates, as shown in the following example:

contain
  (make
    (<pinboard-layout>, 
     children: 
       vector (make(<push-button>, label: "One", x: 0, y: 0),
               make(<push-button>, label: "Two", x: 50,y: 50),
               make(<push-button>, label: "Three", 
                    x: 50, y: 100)))); 

Figure 7.25 Three buttons arranged in a pinboard layout

Any child in a pinboard layout obeys any size constraints that may apply to it, whether those constraints have been specified by you, or calculated by DUIM. For instance, any button you place on a pinboard layout will always be large enough to display all the text in its label, as shown in Figure 7.25. The <fixed-layout> class takes generalization of layouts a step further, by requiring that you specify not only the position of every child, but also its size, so that DUIM performs no constraint calculation at all.This class of layout should only be used if you know exactly what size and position every child in the layout should have. It might be useful, for instance, if you were setting up a resource database in which the sizes and positions of a number of sheets were specified, and were to be read directly into your application code from this database. For most situations, however, you will not need to use the <fixed-layout> class.


Building Applications Using DUIM - 26 May 1999

Next Previous Up Top Contents Index