rp.pos {rpanel} | R Documentation |
This function provides demonstrations of the use of the pos
argument in functions to create controls.
rp.pos(layout = "default")
layout |
the type of panel layout to be demonstrated. Valid options are "default", "pack", "place" and "grid". |
The various functions to create controls accept a parameter called pos
which can be used to specify the layout of the controls. It has various modes of operation and the mode is determined from the type of information provided in the pos
argument. The different modes are outlined below.
pos
is not specified, controls are arranged in a column with the most recent
added to the bottom. Each control is aligned to the left hand side.
pos
is set to "left"
, "right"
, "top"
or "bottom"
then the control is aligned to the left/right/top/bottom edge of the window. If there is
already a control in that position, the new control is placed beside that control, closer
to the centre. (This uses Tk's "pack" layout manager.)
pos
is set to a vector of four integer values, these are interpreted as
c(x, y, width, height)
where all dimensions are in pixels. x
and y
define the coordinates in from the left-hand side and down from the top respectively.
When using this mode of laying out objects, it usually helps to specify the size of the
panel in rp.control
. (This uses Tk's "place" layout manager.)
pos
in any of the function calls to create controls.
Alternatively, pos
can be passed a list which has these named components.
(This uses Tk's "grid" layout manager.)
The "grid" mode of layout should not be mixed with the other modes.
The example below illustrates the use of pos
. Try resizing the windows to explore the behaviour.
Nothing is returned.
This may not work properly on the command line (as opposed to R-GUI) under Mac OS X due to the rp.block
function.
rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.
if (interactive()) { # example function with different parameters for "pos" documentation. rp.pos("default") rp.pos("pack") rp.pos("place") rp.pos("grid") }