Prev: grob.html Up Next: container.html

Practical Guide:
... to be done

A box is a rectangular graphical object (grob). It provides the following properties:
left    right  width   xcenter   // horizontal direction
bottom  top    height  ycenter   // vertical   direction

To obtain these properties, call the member function of box with the same name (for example box::width())

To set these dimensions, the same function with 1 argument can be used. However, in every dimension only two dimensions are independent, the other 2 depend on them. For example, if one sets left and right, then width and xcenter will be automatically calculated (always the last 2 operations will take effect) In the following example b is a box (any object derived from the box class), placed inside the current pad:

b.left(2*CM).right(10*CM);   // width and xcenter are calculated automatically

// place a label to the bottom of the box, centered to the
// center of the box in the horizontal direction

label::pdraw("some text", b.xcenter(), b.bottom())
            .align(sym::center, sym::top); 

b.width(3*CM);   // the last 2 operations are now 'right' and 'width', so
                 // the other 2 dimensions are calculated automatically:
                 // left    = right - width
                 // xcenter = right - 0.5*width

Source files:

Prev: grob.html Up Next: container.html