[R-gui] Example of validating entry contents

Paul Roebuck plroebuck at mdanderson.org
Fri Oct 10 20:44:07 CEST 2008


I have the basics of this down in Tcl/Tk, but fail to see
how to get tcltk package to pass the desired arguments
to the validation function.

I wish to know how to specify one or more of:
   %d, %i, %P, %s, %v, %V, %W


How do I translate the following Tcl script into R?

proc ValidInt {val} {
    return [ expr {[string is integer $val] ||
                   [string match {[-+]} $val]} ]
}

proc Upper {w validation action new} {
    if {$action == 1} {
        $w insert insert [string toupper $new]
        after idle [list $w configure -validate $validation]
    }
    return 1
}

label .ln -text "enter number"
entry .en -validate all -vcmd {ValidInt %P}
grid .ln .en
label .lu -text "enter text"
entry .eu -validate all -vcmd {Upper %W %v %d %S}
grid .lu .eu



----------------------------------------------------------
SIGSIG -- signature too long (core dumped)



More information about the R-SIG-GUI mailing list