Mark Heckmann <mark.heckmann <at> gmx.de> writes: > > Hi all, > > I have a gtable and a ggraphic widget. > I want to drag an element from the table onto the graphic. > When the drag object is released over the ggraphic widget, I want the > mouse coordinates inside the ggraphic to be returned. > Right now I do not know how to get the mouse ccordinates of the > ggraphic widget at any given time. > How can I access the ggraphics mouse coordinates? >
The handler has h$x and h$y components to do this. In your code (which I clipped to save space) you might look at: defHandlerTarget = function(h, ...){ theArgs <- list(...) w <- theArgs[[1]] allocation = w$GetAllocation() ## h$x, h$y give x,y coords for g x = h$x/allocation$width y = 1 - (allocation$height - h$y)/allocation$height print(c(x,y)) } If that doesn't help, let me know. > Below you find my sample code (windows only due to ggraphics). > (The ggraphics widget works with linux and mac too, although the mac can have issues with some installations.) > TIA, > Mark > ..snip.. > ––––––––––––––––––––––––––––––––––––––– > Mark Heckmann > Dipl. Wirt.-Ing. cand. Psych. > Vorstraße 93 B01 > 28359 Bremen > Blog: www.markheckmann.de > R-Blog: http://ryouready.wordpress.com > > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.