[R-gui] Tcl/Tk Binding % Substitutions.for Callbacks
Adrian Waddell
adrian at waddell.ch
Wed Feb 23 21:00:53 CET 2011
Paul:
On 02/23/2011 02:49 PM, Roebuck,Paul L wrote:
> <previously misfiled in r-devel...>
>
> How are % substitutions handled for callbacks in R?
> Is there an 'event' parameter that can be requested
> which would contain the rest of the information specific
> to the event type itself?
>
> How should we translate something like the following:
>
> Tcl> bind Frame <Enter> {%W config -bg red}
> Tcl> bind Frame <Leave> {%W config -bg white}
>
> such that the widget id (and other % substitutions) can be accessed
> in R callback? I'm trying to write callback handlers for dynamic
> bindtags.
>
> one <- tkframe(width=30, height=30)
> two <- tkframe(width=30, height=30)
> three <- tkframe(width=30, height=30)
> tkbind("Frame",
> "<Enter>",
> function(TBD} {
> ## How do I determine widget id (%W) here?
> })
I think you can just use the letter without % as a function argument, try
library(tcltk)
tt <- tktoplevel()
tkbind(tt,'<Enter>',function(W){
cat(paste('Toplevel',W,'\n'))
})
Greetings,
Adrian
>
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-gui
More information about the R-SIG-GUI
mailing list