Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Locator + EventHandler

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128299] Locator + EventHandler
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Fri, 5 Oct 2012 02:51:47 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Dear Community,

There is a nice example at Help/EventHandler/Applications that enables one to set points on demand, that are interpolated on the spot. Here is the code:

interpolationCurve[p_, n_] :=
  Module[{x, f = Interpolation[p, InterpolationOrder -> n ]},
   First@Plot[Evaluate@f[x], {x, Min[p[[All, 1]]], Max[p[[All, 1]]]}]];

DynamicModule[{n = 2, p = {}, c = {}},
 EventHandler[
  Dynamic@Graphics[{Point[p], c}, PlotRange -> 1, Frame -> True],
  "MouseDown" :>
   (p = Union[Sort@Append[p, MousePosition["Graphics"]],
      SameTest -> (First[#1] == First[#2] &)];
    If[Length[p] >= n + 1, c = interpolationCurve[p, n]])]]

I am looking for a way to make there locators instead of the points. Technically, it is a combination of Locator, or LocatorPane with the EventHandler.  The idea behind is to be able to not only to set, but also to adjust each point. I tried, but if I succeeded to set locators, they have been motionless.
Have you ideas of how to make this?

Thank you, Alexei


Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at iee.lu







  • Prev by Date: Trouble Loading Packages...
  • Next by Date: pattern matching
  • Previous by thread: Re: Trouble Loading Packages...
  • Next by thread: Re: Locator + EventHandler