Description Usage Arguments Details Examples
A button widget is used to present a widget that a user can press to initiate some action.
Buttons show text and/or images in a clickable object whose shading indicates that the button is to clicked on.
1 2 |
text |
Text to show in the button. For buttons, if this text matches a stock icon name, an icon is shown as well. |
border |
If |
handler |
Handler called on a click event |
action |
Either a |
container |
Optional container to attach widget to. |
... |
Passed to |
toolkit |
Which GUI toolkit to use |
As buttons are intended to show the user how to initiate some action,
they are often labeled as commands. Additionally, if the action is not
currently possible given the state of the GUI, a button is typically
disabled. This can be done through the enabled
method.
The svalue()
method returns the value of the
widget. For a button, this is the text as a single string
(which may not include a "\n" for newlines if not supported by
the toolkit).
The svalue<-
method can be used to set the text of
the widget. For buttons, values with length greater
than one are pasted together collapsed with "\n".
The addHandlerChanged
method is aliased to the
addHandlerClicked
method which can be used to set a
handler to respond to click events.
When the action
argument is a gaction
instance, then
the button label and handler will be derived from the gaction
instance. The enabled<-
method of the gaction
instance
should be used to set the sensitivity to user input, not the
enabled<-
method of the gbutton
instance.
1 2 3 4 5 6 7 8 9 10 11 | ## Not run:
## button group example
w <- gwindow("Button examples")
g <- ggroup(container = w)
addSpring(g) ## push to right of widget
gbutton("help", container = g)
addSpace(g, 20) ## some breathing room
gbutton("cancel", container = g)
gbutton("ok", container = g, handler = function(h, ...) cat("do it\n"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.