| gWidgets-methods {gWidgets} | R Documentation |
Methods introduced by the gWidgets API.
The base class for this gWidgets implentation are
gWidget and its subclass gComponent and
gContainer. However, it is expected that the toolkit
implementations have several classes of their own. The following
methods defined in gWidgets simply dispatch to a similarly named
widget in the toolkit. For instance, the method svalue is defined
like
svalue(obj,...) = .svalue(obj@widget, obj@toolkit, ...) where
.svalue() and obj@widget are in toolkit, and
obj@toolkit is used for dispatching in the appropriate toolkit.
The gComponent methods are:
svalue(obj, index=NULL, drop=NULL, ...):index=TRUE will return the
index of the selected value, not the value. For some widget, the
argument drop is given to either prevent or encourage
dropping of information.
svalue<-(obj, index=NULL, ... ,value):index argument is used when the value
is set by index.
[(x,i,j,...,drop=TRUE):
For widgets where selection is a choice from a collection of items,
the svalue method refers to the choice and the square bracket
notation refers to the items. For instance, in a radio button
(gradio) the svalue method returns the selected value, the
"[" method refers to the vector of possible values. Whereas in
a notebook (gnotebook), the svalue method refers to
the currently opened page and the "[" refers to all the pages.
"[<-"(x, i, j, ..., value) :size(obj, ...) or
size<-(obj, ..., value):visible(obj ...) or
visible<-(obj,..., value):value should be a logical. "Visibility"
differs from widget to widget. For gwindow it refers
to whether the base container is shown or not. For the
dataframe-like widgets gdf and gtable
visibility refers to which rows are shown.
enabled(obj,...) or
enabled<-(obj,..., value)
focus(obj,...) or focus<-(obj,...,value): font(obj, ...) or
font<-(obj,...,value):gtext.
tag(obj,i, drop=TRUE, ...) or
tag<-(obj,i, replace=TRUE, ...,value):attr function – they
set values within an object. In RGtk, these are carried with
the pointer which is passed into functions – not a
copy. This allows values to be set without worrying about the
scope of the assignment.
When setting a tag, the argument replace can be
set to FALSE so that the value appends.
The tags are stored internally in a list. Calling
tag(obj) will return this list.
id(obj,...) or
id<-(obj,..., value):update(object,...):Some classes use this method to update the state of the widget
add(obj, value, ...):
For this method, there are several different arguments that can be
passed in via the "..." argument. When the API is cleaned up
this should change.
For the containers (gwindow, ggroup, ...) adding
adds a widget to be packed in. For the parent container
produced by gwindow only one item can be added. For
groups, this is not the case. For ggroup, gframe
and gexpandgroup the extra argument expand=TRUE
will cause the widget to take up all possible space within the
container.
For the components, add has different meanings. For
notebooks (gnotebook, ...) add is used to add
pages. In this case the extra arguments are:
description{
labeloverride.closebutton
For the text buffer widget (gtext) add is used
to append text to the buffer. In this case, extra
arguments available:
description{
font.attrdelete(obj, widget,...):add. In RGtk, the widget is actually detached and can
be added at a later time. Any handler assigned by
addhandlerunrealize is called when the widget is
detached
For notebooks, the delete method removes a page in the notebook.
dispose(obj,...):For notebooks, it removes the current page.
addSpace(obj, value, horizontal=TRUE,...):addSpring(obj, ...):See package vignette for more examples
gWidgets-handlers for methods related to handlers.