[R] tcltk table "validateCommand"
ddalthorp at usgs.gov
Fri Jan 22 21:25:49 CET 2016
I'd like to allow users to edit data in tcltk tables and to use vcmd to
validate data entry, e.g., not allowing non-numbers to be entered in
numeric cells and not allowing '\n' to be entered in text cells.
The problem is that I can't figure out how to "see" their data entry before
it is entered, although it looks like %S can be somehow used in vcmd to get
Example: to disallow '\n' to be entered into a cell in an editable table:
tt<-tktoplevel(); tfr<-tkframe(tt); tkgrid(tfr)
## http://www.tcl.tk/community/hobbs/tcl/capp/tkTable/tkTable.html says:
## *%S* For *ValidateCommand*, it is the potential new value of the cell
## which is exactly what I want, but I can't figure out how to do that.
## The following allows one bad character and then disallows further edits
if (length(grep("\n",testval))>0) return(tcl("expr", FALSE)) else
tcl(table1,"tag","configure", "active", fg='black',bg=colors())
How can I get the %S value rather than the tcl(table1,"curvalue")?
Much thanks for any help.
[[alternative HTML version deleted]]
More information about the R-help