glabel {gWidgets} | R Documentation |
A label, button or graphic show basic bits of text or images in a widget. Each of these can have a handler assigned for when the widget is clicked.
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())
text |
Text to show in the label or button. For buttons, if this text matches a stock icon name, an icon is shown as well |
border |
If 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. |
markup |
Logical indicating if text for a label uses markup |
editable |
Logical. If TRUE, then the label's text can be set by clicking on the label and filling in the edit box. |
filename |
Specifies location of image. May be a stock icon name or filename. |
dirname |
Directory of file. If "stock", then a stock icon is used. |
size |
Size of image when stock image is used. Values are in
c("menu", "small_toolbar","large_toolbar","button","dialog") |
handler |
Handler called on a click event |
action |
Passed to handler |
container |
Optional container to attach widget to. |
... |
Passed to add method of container |
toolkit |
Which GUI toolkit to use |
The svalue()
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.
## Not run: 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")}) ## End(Not run)