Displaying 3 results from an estimated 3 matches for "tkevent".
Did you mean:
kevent
2005 Jul 12
1
help: how to use tkevent.generate(...)
Hello,
I use package "tcltk" to do some GUI programming, and want to find a
function which can do the operation "click a button", just like using
a mouse to click. If tkevent.generate can do that? I tried it as
below, but failed. Please give me a hint!
tt <- tktoplevel()
tkwm.title(tt,"Simple Dialog")
onOK <- function(){print("OK")}
onCancel <- function(){print("Cancel")}
OK.but <- tkbutton(tt, text=" OK ", command...
2025 Jan 20
1
[tcltk] binding two functions to one event
....Tcl.callback(evresp2),'}'))
.Tcl('bind all <<EVENT>> "+evresp2 %d"')
### end R code
The .Tcl() calls are necessary (as far as I can tell) to get the
effect of 'bind all <<EVENT>> "+evresp2 %d"' ,i.e. appending evresp2
Now paste
tkevent.generate(wtop,'<<EVENT>>',data='abcdef')
I see output
evresp1 abcdef
evresp2 %d
Both evresp1 and evresp2 got called but only evresp1 got the data right.
How can I fix this?
> sessionInfo
R version 4.3.0 (2023-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running u...
2025 Jan 21
1
[tcltk] binding two functions to one event
...p2, you just need to get a "+" into whatever the evresp2 gets converted to.
And...
> tkbind('all','<<EVENT>>',evresp1)
<Tcl>
> tkbind('all','<<EVENT>>',paste0("+", .Tcl.callback(evresp2)))
<Tcl>
> tkevent.generate(wtop,'<<EVENT>>',data='abcdef')
evresp1 abcdef
evresp2 abcdef
<Tcl>
> tkbind('all','<<EVENT>>')
<Tcl> R_call 0x7f9769c764b0 %d
R_call 0x7f9769c79978 %d
-pd
PS. To answer my own question: yes, the "+" i...