Labels show text. The text can be marked up. An option is available so that the displayed text can be edited.
Buttons show text and/or images in a clickable object whose shading indicates that the button is to clicked on.
Images can be shown.
glabel(text = "", markup = FALSE, editable = FALSE, handler = NULL,
action = NULL, container = NULL, ..., toolkit = guiToolkit())
gbutton(text = "", border=TRUE, handler = NULL, action = NULL, container = NULL,
..., toolkit = guiToolkit()) gimage(filename = "", dirname = "", size = "",
handler = NULL, action = NULL, container = NULL, ..., toolkit = guiToolkit())
TRUE
a border is drawn to make a button look like a
button. If FALSE
, the no border so the button looks like a label.c("menu", "small_toolbar","large_toolbar","button","dialog")
add
method of containersvalue()
method returns the value of the widget. For
a label, this is the text. For a button, the same. For an image,
it is the filename of the figure or the stock icon name, if the
icon was set from a stock icon.
The svalue<-()
method can be used to set the value of
the widget. For an image, the value is a filename containing the
image to display. The addhandlerclicked
method is called on click
events.
Although in some toolkits, labels are meant to hold static text
gWidgets treats widgets like other widgets allowing the user to
bind handlers to mouse clicks. For labels, if
editable=TRUE
is specified, clicking on the text allows
one to edit the label's value overriding the click handler in
the process. However, the addhandlerchanged
handler can
be given to respond to the text after it has been chnaged.
glabel("a label", container=TRUE)
glabel("Click me to edit label", editable=TRUE, container=TRUE)
glabel("Click me for a message", container=TRUE,
handler=function(h,...) {cat("Hi\n")})
Run the code above in your browser using DataLab