Learn R Programming

gWidgets2 (version 1.0-9)

gedit: Single line text edit constructor

Description

The default change handler is called when the return key is pressed. It can be useful to also call a handler when the widget loses focus. For that, the addHandlerBlur method is of use. (This was the default, but is now not, as it was hard to decouple the two when that was desirable.)

The default change handler call is when the user activates the entry by pressing the enter key. Other possible events to consider are covered by: addhandlerBlur (when the widget loses focuses) and addHandlerKeystroke (called after each keystroke). For the latter, if the toolkit supports it, the handler's first argument has a component key passing back the keystroke information.

The svalue method for a edit object refers to its main property, the text in the box.

Usage

gedit(
  text = "",
  width = 25,
  coerce.with = NULL,
  initial.msg = "",
  handler = NULL,
  action = NULL,
  container = NULL,
  ...,
  toolkit = guiToolkit()
)

.gedit( toolkit, text = "", width = 25, coerce.with = NULL, initial.msg = "", handler = NULL, action = NULL, container = NULL, ... )

# S3 method for GEdit addHandlerChanged(obj, handler, action = NULL, ...)

# S3 method for GEdit svalue(obj, index = NULL, drop = NULL, ...)

Arguments

text

initial text

width

number of characters

coerce.with

A function or name of function to coerce value with before returning by svalue

initial.msg

If no initial text is given but an initial message is, then this message is displayed until the widget receives the focus

handler

Change handler. Called when return key is hit. Use addHandleBlur to add a handler when the widget loses focus, such as through tab-key navigation.

action

passed to handler

container

parent container

...

passed to add method of parent

toolkit

toolkit

obj

object receiving event and emitting a signal to the handler

index

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

drop

NULL or logical. If widget supports it, drop will work as it does in a data frame or perhaps someother means.

Value

An object of class GEdit. This has sub-classed methods:

  1. svalue to retrieve the text

  2. svalue<- to set the text

  3. [ to get the autocomplete values

  4. [<- Character. To set autocomplete values

  5. visible<- to specify a character to display instead of text (for passwords)