Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Coordinates in EventHandler

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116761] Coordinates in EventHandler
  • From: Fred Simons <f.h.simons at tue.nl>
  • Date: Sat, 26 Feb 2011 06:08:34 -0500 (EST)

The following command gives an event handler which assigns the mouse 
position to a variable res when the mouse is clicked :

eh=EventHandler[Framed[Graphics[PlotRange->1, Axes->True, 
Background->Yellow]], "MouseClicked":> (res=MousePosition["Graphics"])]

Dynamic[res]

Now I place this event handler in another graphics:

Framed[Graphics[Inset[eh, {1.5, 0.7}, {0, 0}], PlotRange -> 4,   Axes -> 
True]]

Clicking in the yellow event handler shows that the mouse position in 
the outer graph is assigned to res, instead of the mouse position in the 
event handler. Does someone know how, in this situation, can we assign 
the mouse position in the event handler to res? (Of course without using 
coordinate transformations)

Many thanks in advance,

-- 
Fred Simons
Eindhoven University of Technology



  • Prev by Date: Re: FinancialData Function Not Working for Property "Members"
  • Next by Date: Re: How to local files on ParallelKernels
  • Previous by thread: problem with"Re" syntax
  • Next by thread: NIntegrate and speed