Description Usage Arguments Value Methods Note Examples
gedit widget
For the GEdit
class, the change signal is "blur" or a
focus-out event. Use the reference class method
add_handler_enter
for "enter" key press and
add_handler_change
for a mix of change events (browser
dependent, but for most includes ['change', 'input',
'textInput', 'keyup', 'dragdrop']
.
1 2 3 |
text |
initial text |
width |
width in characters. Converted to pixels by multiplying by 8. |
coerce.with |
Function to call for coercion from text. If no coercion be careful when using the values, as the user can potentialy type in malicious things. |
initial.msg |
initial message to user, in greyed out text |
handler |
optional means (to |
action |
Passed to handler to parameterize a call |
container |
A parent container. In gWidgetsWWW2 a
parent container is not optional (though it can be substituted
with the |
... |
Used to pass along argument to the parent container's
|
ext.args |
The contructors of gWidgetsWWW2 ultimately
call an Ext constructor. The options passed to the Ext constructor
may be added to or overridden by use of this argument. Values are
passed in as named list components and with values converted into JavaScript
objects by |
validate.type |
pre-defined validation type:
|
validate.regexp |
optional regular expression to validate against. If the argument has a names argument, this is used to notify the user why the type is invalid. |
a GEdit
referece class object
add_handler_enter(handler, action = NULL, ...)
add handler key for enter event. No addHandlerEnter method, call this directly
before_handler(signal, params)
Hook that can be called prior to observer call. Might be useful to set value without relying on transport call to arrive first. Return value – a named list – is passed to observers as components of h
process_transport(value, ...)
R Function to process the transport. Typically just sets 'value', but may do more. In the above example, where var param = value: this.getText() was from transport_fun we would get the text for value
The 'change' event varies from browser to browser. To catch
just an enter key, the add_handler_enter
reference class method
is available. There is no [<- method to add typeahead
(autocomplete) values. This feature can be done with a combobox though.
1 2 3 4 5 6 7 8 9 10 11 | w <- gwindow()
sb <- gstatusbar("Powered by gWidgetsWWW2 and Rook", cont=w)
g <- ggroup(cont=w, horizontal=FALSE)
e <- gedit("initial text", cont=g)
addHandlerChanged(e, handler=function(h,...) {
galert(paste("You entered", svalue(h$obj)), parent=w)
})
## initial message
e1 <- gedit(initial.msg="type a value here ...", cont=g)
## validation
e2 <- gedit(cont=g, validate.regexp=setNames("^[a-z]*$", "Lower case only"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.