gslider: slider widget

Description Usage Arguments Value Methods Examples

View source: R/gslider.R

Description

Use slider to select from a sequence of values, specified as with seq. The sequence steps must be greater than 1

The GSlider implementation allows one to adjust the formating of the tooltip that indicates the current value of the widget. The tpl command uses an HTML snippet where the value {0} does the substitution.

Usage

1
2
3
gslider(from = 0, to = 100, by = 1, value = from, horizontal = TRUE,
  handler = NULL, action = NULL, container = NULL, ..., width = NULL,
  height = NULL, ext.args = NULL, tpl = "{0}")

Arguments

from

starting point. Unlike other implementations for gWidgets, this is not possibly a vector specifying a range of values to slide over.

to

ending point

by

step size. Must be larger than 1 and even then will round to integer value

value

initial value

horizontal

orientation

handler

optional means (to addHandlerChanged) to specify a handler for the default signal. A handler is a function with signature (h,...) where h is a list with components obj referring to the object emitting the signal, action containing values passed to the action argument, and possible other values.

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 parent argument in some circumstances). The parent specifies the widget heirarchy and the ... argument is used to pass along arguments to layout the child component in the parent container. Typically, these are passed to the add method of the parent container.

...

Used to pass along argument to the parent container's add method and possible other arguments to the underlying ference class constructors.

width

width in pixels of component. Sizing in gWidgetsWWW2 is sometimes necessary as the arguments expand and fill are not well implemented.

height

height in pixels of the component.

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 asJSObject.

tpl

Template for tooltip. Should have "{0}" to replace the value, but can have more formatting

Value

a GSlider reference class object

Methods

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

set_value(value, ...)

Set main property, invoke change handler on change

transport_fun()

javascript function for transport web -> R. Creates an object param. This is a string to be passed to the javascript queue withing the transport function call E.g. var param = value: this.getText()

Examples

1
2
3
4
5
6
w <- gwindow()
sb <- gstatusbar("Powered by gWidgetsWWW and Rook", cont=w)
sl <- gslider(from=0, to=100, by=1, value=50, cont=w, tpl="{0}percent")
addHandlerChanged(sl, handler=function(h,...) {
 galert(paste("You selected", svalue(h$obj)), parent=w)
})

jverzani/gWidgetsWWW2 documentation built on Feb. 9, 2020, 5:18 p.m.