Closed landroni closed 10 years ago
Okay, I added something. Let me know if it isn't working.
Thanks for looking into this! I installed latest GIT and with the following code:
w <- gwindow("Buttons")
g <- ggroup(cont=w, horizontal=FALSE)
b2 <- gbutton("ouvrir", cont=g)
b4 <- gbutton("click me", cont=g)
h4 <- function(h,...) {
if(svalue(b2) == "open")
svalue(b2) <- "ouvrir"
else
svalue(b2) <- "open"
}
addHandlerChanged(b4, h4)
h4bis <- function(h,...) {print("hello world on ctrl+click")}
addHandlerControlclick(b4, h4bis)
h4ter <- function(h,...) {print("hello world on shift+click")}
addHandlerShiftclick(b4, h4ter)
Whenever I click
, ctrl+click
or shift+click
on the click me
button, the h4
handler gets activated (but never the h4bis
or h4ter
). If I comment out # addHandlerChanged(b4, h4)
, then clicking on the button doesn't seem to trigger anything. Can you reproduce this?
The Control key isn't putting out the modifier type I'm trying to trap. Not sure if it is an Ubuntu thing or what. I just checked in a change to capture ctrl+shift+click for addHandlerControlclick.
However, it is still buggy. I find I can use either one or the other, but not both on the same widget. Curious if you see the same.
With latest GIT h4bis
handler never gets activated. With:
addHandlerChanged(b4, h4)
h4bis <- function(h,...) {print("hello world on ctrl+click")}
addHandlerControlclick(b4, h4bis)
Whether I do click
, ctrl+click
, ctrl+shift+click
or shift+click
on the click me
button, the h4
handler gets activated. In the console here are the debugging messages that I get.
For click
:
[[1]]
[1] 16
[[2]]
[1] 5
For ctrl+click
:
[[1]]
[1] 20
[[2]]
[1] 5
For ctrl+shift+click
:
[[1]]
[1] 21
[[2]]
[1] 5
For shift+click
:
[[1]]
[1] 17
[[2]]
[1] 5
However when I define only h4bis
:
#addHandlerChanged(b4, h4)
h4bis <- function(h,...) {print("hello world on ctrl+click")}
addHandlerControlclick(b4, h4bis)
Then it never gets activated, whichever combination of mouse clicks I try.
On the back of http://stackoverflow.com/questions/25046428/how-to-activate-button-handler-on-ctrlclick , I'm looking at
?addHandler
and I'm noticing:addHandlerRightclick
addHandlerDoubleclick
Would it be feasible to add the following two:
addHandlerControlclick
addHandlerShiftclick
To allow catching
ctrl + mouse click
andshift + mouse click
events?