Description Usage Arguments Details Examples
The gedit
widget is used to enter single lines of text.
1 2 |
text |
Initial text in widget |
width |
Width of widget. For gedit, this means the number of characters. |
coerce.with |
For gedit, when the value is retrieved this function is applied to the result. (The stored value is always a character, this can be used to make it numerc, to quote it, ... |
initial.msg |
If |
handler |
Handler called when text is changed. For gedit, this means the enter key is pressed. |
action |
Passed to handler |
container |
Optional container to attach widget to |
... |
Passed to add method of container |
toolkit |
Which GUI toolkit to use |
The gedit
widget has the following methods:
The svalue
method retrieves the value. If a function is
given to the argument coerce.with
it is applied before
the value is returned. This can be used to coerce the text
value (always of class character) to a numeric, or to a date,
or to be quoted, ...
The svalue<-
method is used to set the value.
The "["
and "[<-"
methods refer to the widgets
"type-ahead" values. A familiar usage is when a url is typed
into a web browser, matches appear from a users history that
could possibly complete the typed url.
The visible<-
method is used to toggle whether
characters are visible, or are replaced with a "*", such as is
done with password entry.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
gedit("type here", container=gwindow())
## change handler
obj <- gedit(container=gwindow())
addhandlerchanged(obj, handler=function(h,...)
cat("You typed", svalue(h$obj),"\n"))
## coerce to numeric
obj <- gedit("7", container=gwindow(), coerce.with=as.numeric)
svalue(obj)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.