Learn R Programming

gWidgets (version 0.0-25)

glabel: Constructors for widgets that show text or images

Description

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.

Usage

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())

Arguments

Details

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.

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.

Examples

Run this code
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