A ggroup is the primary container for packing in
subsequent widgets, either from left to right or top to
bottom. Widgets are packed in using the add method and
can be removed with the delete method.
The gframe container adds a decorative border and
optional label to the box container.
The gexpandgroup containers has an optional label and a
trigger to click on which toggles the display of the the child widgets.
By default, the child widgets are not shown. Using the visible<- method to adjust.
The containers pack in child widgets from either left to right
(when horizontal=TRUE) or from top to bottom (when
horizontal=FALSE).
Child widgets are added to box containers through their
add method or through the containers use as the parent
container when a widget is constructed. This is done by using
the container argument of the widget. The
container argument is not optional for
gWidgetstcltk. It is suggested that it always be included
for portability. When it is not included, widgets are added to
the new group object through its add method. Otherwise, when a
widget is created, the group is specified as the container and
the add method is then called implicitly, with the constructor's
... argument used to pass arguments to add.
When the parent allocates space to a child widget it
be possible to allocate more space than is requested by the
child widget. The child may then be
positioned in the available space by specifying the
anchor=c(a,b) argument to add where a
and b are values in -1,0,1 and specify the position using
Cartesian coordinates.
If the argument expand=TRUE to add is given, then the space
available to the child expands. The child widget can be
instructed to grow to fill the space. The add method's argument fill,
with values "both", "x", "y" or "",
instructs the child as to which direction to grow in. (The
"" value says none.)
The implementation of expand, anchor, fill
varies with the underlying toolkit. The basic language comes
from tcltk and an attempt -- not entirely successful -- is
made to implement it in the gWidgetsRGtk2 and
gWidgetsQt packages.
A child component may be deleted using delete(parent,
child). TYpically the child may be replaced in the GUI, using add.
The spacing argument determines the number of pixels of
padding between each widget when packed in. This can be set when
the group is constructed, or later using svalue<-.
The argument use.scrollwindow = TRUE
will add scrollbars around the box container. When the child
components require more size than is given to the container, the
scroll bars allow one to position the viewable area over the
child of interest. Again, not all toolkits do this equally well.
To put space between two adjoining widgets, the
addSpace(obj, value, ...) method may be used where
value is the number of pixels of padding between the just
packed widget, and the next one to be packed.
The addSpring(obj,...) method will push the just packed
widget and the next-to-be packed widget as far apart as possible.
For ggroup, in gWidgetsRGtk2 a few arguments add
to the container. The argument raise.on.dragmotion =
TRUE will cause the group to jump to the foreground when a drag
action crosses it.
For gframe and gexpandgroup the label name can be
retrieved or adjusted with the names method.
For gframe and gexpandgroup the label can be
adjusted through the names<- method.
For gexpandgroup the visible method can be used
to toggle the display programmatically.