Learn R Programming

gWidgets2 (version 1.0-9)

glabel: Basic label widget

Description

The basic label widget allows one to label areas of a GUI using text. The most common use would be to label fields in a form. For gWidgets2 labels may be editable or responsive to mouse clicks, although it is the author's experience that such uses are not expected by the end user.

The svalue methods refer to the main property of the label, its text.

Usage

glabel(
  text = "",
  markup = FALSE,
  editable = FALSE,
  handler = NULL,
  action = NULL,
  container = NULL,
  ...,
  toolkit = guiToolkit()
)

.glabel( toolkit, text, markup = FALSE, editable = FALSE, handler = NULL, action = NULL, container = NULL, ... )

# S3 method for GLabel svalue (obj, index=TRUE, ...) <- value

Arguments

text

character. Collapsed using a newline to a single string.

markup

logical. If toolkit supports markup, this indicates it will be used. It is suggested that the font<- method be used, though for gWidgets2Qt markup is more convenient.

editable

If TRUE, then clicking on label will enable user-editing of the text.

handler

optional handler. If given, added through addHandlerChanged. Overridden if editable=TRUE.

action

passed to handler through action component of first argument of handler. For buttons, this may also be a GAction instance.

container

parent container (Optional for some toolkits, but not all).

...

passed to add method of parent container

toolkit

toolkit instance

obj

object of method call

index

NULL or logical. If TRUE and widget supports it an index, instead of a value will be returned.

value

value to assign for selection or property

Value

a GLabel instance. While this object has its own (reference) methods, one primarily interacts with it through S3 methods defined within the package.

Examples

Run this code
# NOT RUN {
w <- gwindow("gformlayout", visible=FALSE)
g <- gvbox(container=w)
g$set_borderwidth(10)

l1 <- glabel("static label", container=g)
l2 <- glabel("bold label", container=g)
font(l2) <- list(weight="bold")
l3 <- glabel("editable label. Click me", editable=TRUE, container=g)

visible(w) <- TRUE

# }

Run the code above in your browser using DataLab