setWidgetState {PBSmodelling} | R Documentation |
Update the read-only state of a widget.
setWidgetState( varname, state, radiovalue, winname )
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. |
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.
Alex Couture-Beil
## 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)