MathGroup Archive 2011

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

Search the Archive

Re: PopupWindow vs EventHandler

  • To: mathgroup at
  • Subject: [mg117511] Re: PopupWindow vs EventHandler
  • From: John Fultz <jfultz at>
  • Date: Mon, 21 Mar 2011 06:15:36 -0500 (EST)

To copy/paste plots out of a PopupWindow, you need to add the following options
to PopupWindow:

       WindowFrame -> "Normal", WindowFloating -> False

The problem you're having with EventHandler can be solved in two different ways. 
One way is to store the data in a DynamicModule, which will always refresh the

event[point_] :=
 DynamicModule[{mydata = data},
  EventHandler[Tooltip[Point[point], "EventHandler"],
   "MouseClicked" :>
    CreateDocument[ListPlot[mydata], WindowSize -> All]]]

The other possibility is to consider it an issue of evaluation order. 
RuleDelayed is preventing 'data' from evaluating immediately, thereby preserving
the dependency upon the named symbol "data".  You can use With[] to punch a hole
through RuleDelayed and get the fully evaluated version of "data" in there.

event[point_] :=
 With[{data = data},
  EventHandler[Tooltip[Point[point], "EventHandler"],
   "MouseClicked" :>
    CreateDocument[ListPlot[data], WindowSize -> All]]]


John Fultz
jfultz at
User Interface Group
Wolfram Research, Inc.

On Sun, 20 Mar 2011 04:53:22 -0500 (EST), Thomas M=FCnch wrote:
> Dear Group,
> Below is a simplified version to illustrate my problem. The code below
> will create a simple graph with a red and blue point. When you click on
> the points, a popup-window will open to present a plot of the "data".
> The red dot does this with an EventHandler[], and the blue dot with a
> PopupWindow[].
> data == Table[Sin[x], {x, 0, 10}];
> event[point_] :==
> EventHandler[Tooltip[Point[point], "EventHandler"],
> "MouseClicked" :>
> CreateDocument[ListPlot[data], WindowSize -> All]];
> pop[point_] :==
> PopupWindow[Tooltip[Point[point], "Popup"], ListPlot[data],
> WindowSize -> All];
> Graphics[{PointSize[Large], Red, event[{0, 1}], Blue, pop[{1, 1}]},
> AspectRatio -> Full, ImageSize -> {50, 20}]
> There is the following problem: The plot in the PopupWindow can be
> selected, but cannot copied-and-pasted somewhere else. This is something
> that I would like to be able to do.
> With the Plot in the other window (EventHandler), this is possible.
> However, if you now Quit[] the kernel (i.e. Mathematica forgets about
> the definition of data), the EventHandler does not produce the plot
> anymore, while the PopupWindow still works.
> I'd like to be able to do one of the following:
> - copy-and-paste plots out of the PopupWindow,
> or:
> - have the EventHandler remember the data in a fresh Mathematica session.
> Some background: I analyze data, where the points represent some
> condensed properties of data. Clicking the points should show the
> original data, with the possibility to extract the original-data plot
> (copy-and-paste) for further inspection.
> Thank you!
> thomas

  • Prev by Date: Re: Wolfram, meet Stefan and Boltzmann
  • Next by Date: Re: Wolfram, meet Stefan and Boltzmann
  • Previous by thread: Re: PopupWindow vs EventHandler
  • Next by thread: Re: PopupWindow vs EventHandler