setWidgetState {PBSmodelling}R Documentation

Update Widget State

Description

Update the read-only state of a widget.

Usage

setWidgetState( varname, state, radiovalue, winname )

Arguments

varname the name of the widget
state "normal" or "disabled"; entry and text widgets also support "readonly"
radiovalue if specified, disable a particular radio option, as identified by the value, rather than the complete set (identified by the common name)
winname window from which to select the GUI widget. The default takes the window that has most recently received new user input.

Details

The varname argument expects a name which corresponds to some widget with the same corresponding name value. Alternatively, any element can be updated by appending its index in square brackets to the end of the name. The data widget is indexed differently than the matrix widget by adding "d" after the brackets. This tweak is necessary for the internal coding (bookkeeping) of PBS Modelling. Example: "foo[1,1]d".

The state can either be "normal" which allows the user to edit values, or "disabled" which restricts the user from editing the values. Entry widgets also support "readonly" which will allow the user to copy and paste data.

Author(s)

Alex Couture-Beil

Examples

## Not run: 
winDesc <- c('vector length=3 name=vec labels="normal disabled readonly" values="1 2 3"',
             "matrix nrow=2 ncol=2 name=mat", "button name=but_name" );
createWin(winDesc, astext=TRUE)

setWidgetState( "vec[1]", "normal" )
setWidgetState( "vec[2]", "disabled" )
setWidgetState( "vec[3]", "readonly" )

setWidgetState( "mat", "readonly" )
setWinVal( list( mat = matrix( 1:4, 2, 2 ) ) )

#works for buttons too
setWidgetState( "but_name", "disabled" )
## End(Not run)

[Package PBSmodelling version 2.55.175 Index]