Closed landroni closed 8 years ago
I have the opposite behaviour, when the mouse motion is detected the window should close. This means you can set the delay to be longer, and have the user dismiss with the mouse.
Changing to your expectations isn't hard. Something like this would work I suppose:
set time with default of 5 detect mouse motion (motion-notify-event) and stop timer if so detect mouse leave (leave-notify-event) and restart timer or destroy window (one of the two)
What would be more natural?
For me most intuitive would be:
Okay, this should be fixed iwth 8ac03a7 of gWidgets2RGtk2.
I tested latest GIT but I can't notice any change in behavior. With:
galert("Message", delay=5, parent=gwindow())
the message closes automatically even if the mouse is hovering the widget (or the OK button). Shouldn't it halt automatic closing until the mouse is detected to have been moved outside the widget area?
Did you update gwidgets2rgtk2? That's is where the changes are.
Yes, both packages:
install_github("jverzani/gWidgets2RGtk2")
install_github("jverzani/gWidgets2")
I'm not sure what's wrong...
Can you try the code that should be called to see if it works?
library(RGtk2)
options(guiToolkit="RGtk2")
library(gWidgets2)
w <- gtkWindow(show=FALSE)
w$setDefaultSize(300, 150)
evb <- gtkEventBox()
evb$SetVisibleWindow(FALSE)
evb$AddEvents(GdkEventMask["all-events-mask"])
l <- gtkLabel(msg)
evb$add(l); w$add(evb)
motion_notify_cb <- function(...) {
if(timer$started)
timer$stop_timer()
FALSE
}
gSignalConnect(evb, "motion-notify-event", f=motion_notify_cb)
leave_notify_cb <- function(...) {
timer$set_interval(2*1000)
timer$start_timer()
FALSE
}
gSignalConnect(evb, "leave-notify-event", f=leave_notify_cb)
w$show()
f <- function(...) {
timer$stop_timer()
if(!is(w, "<invalid>"))
w$destroy()
FALSE
}
timer <- gtimer(delay*1000, FUN=f, one.shot=TRUE)
I tested the code and indeed it works as expected: leaving the mouse outside the window makes it auto-close as per the delay
. Moving the mouse inside the window stops the counter, and the window doesn't close until mouse is moved outside.
Hmm, odd that was nearly a copy and paste. I'll have a look
On Monday, December 14, 2015, landroni notifications@github.com wrote:
I tested the code and indeed it works as expected: leaving the mouse outside the window makes it auto-close as per the delay. Moving the mouse inside the window stops the counter, and the window doesn't close until mouse is moved outside.
— Reply to this email directly or view it on GitHub https://github.com/jverzani/gWidgets2/issues/88#issuecomment-164580622.
John Verzani Chair, Department of Mathematics College of Staten Island, CUNY verzani@math.csi.cuny.edu
This is a minor gripe, but would make for useful UI-practice.
Currently
galert(..., delay = 5)
message will close after 5 second delay, no matter what. Often for users this may not be sufficient time to process and understand the message. It would help ifgalert()
could detect if user hovers the message widget with the mouse, and delay clearing up the message until the mouse is moved outside the widget area (i.e. mouse no longer hovers widget). This is intuitive once the user realizes that hovering the widget has this effect.There is precedent for such a UI approach in Opera 12.x when hovering the
galert
-similar "Do you want to save password?" widget.