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)
: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.
visible(obj ...)
enabled(obj,...)
or
enabled<-(obj,..., value)
focus(obj,...)
or focus<-(obj,...,value)
:
tooltip<-(obj,value)
defaultWidget(obj,...)
or defaultWidget<-(obj,...,value)
font(obj, ...)
or font<-(obj,...,value)
:
family
with a value of "normal","sans","serif",or "monospace";
style
with a value of "normal","oblique", or "italic";
weight
with a value of
"ultra-light","light","normal","bold","ultra-bold", or "heavy";
and
color
which for gWidgetsRGtk is any of the values returned by
colors
.
[Prior to version 0.0-22 the weight and style were switched. Old
code can be run as before.]
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,...)
:
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:
label
override.closebutton
For the text buffer widget (gtext
) insert
(origally
called add
which still works but is deprecated) is used to
insert text into the buffer. In this case, extra arguments are
available:
font.attr
delete(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 top-level windows it destroys the window.
For notebooks, it removes the current page.
In RGtk2, for other objects it will destroy the top-level window.
addSpace(obj, value, horizontal=TRUE,...)
:
addSpring(obj, ...)
:
See package vignette for more examples
gWidgets-handlers
for methods related to handlers.