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

MathGroup Archive 2013

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

Search the Archive

Re: LocatorPane and tooltips for the locators

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132108] Re: LocatorPane and tooltips for the locators
  • From: "E. Martin-Serrano" <eMartinSerrano at telefonica.net>
  • Date: Sun, 8 Dec 2013 04:33:38 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20131130072504.F31CE69F2@smc.vnet.net> <20131206071525.CCC076A2D@smc.vnet.net>

Itai,

Many thanks, again.

Very useful tip, mainly the part on
**CurrentValue["CurrentLocatorPaneThumb"]**


-----Mensaje original-----
De: Itai Seggev [mailto:itais at wolfram.com] 
Enviado el: viernes, 6 de diciembre de 2013 8:15
Para: mathgroup at smc.vnet.net
Asunto: Re: LocatorPane and tooltips for the locators

I was going to suggest esstially the same solution.  

pts = {{0, 0}, {1, 0}, {0, 1}};
LocatorPane[Dynamic[pts],
 Graphics[{Line[Dynamic[pts]], AbsolutePointSize[10],
   Dynamic[Tooltip[Point[#], #] & /@ pts]}, PlotRange -> 2],  Appearance ->
None]

Also, there is an undocumented CurrentValue token which lets you know which
of m ultiple LocatorPane thumbs you've grabbed.  So an alternate solution is
to display the coordinates of the grabbed local elsewhere in the graphics,
like so (I got this tip from Lou D'Andria, our Manipulate guru):

pts={{0,0},{1,0},{0,1}};
i=1;
LocatorPane[
 Dynamic[pts, (i = CurrentValue["CurrentLocatorPaneThumb"]; pts = #) &],
Graphics[{Line[Dynamic[pts]]}, PlotRange -> 2,
  PlotLabel -> Dynamic[pts[[i]]]]]

On Thu, Dec 05, 2013 at 03:05:50AM -0500, E. Martin-Serrano wrote:
> Dear Dr. Kragler,
> 
> Many thanks for your kind response. It has been useful in solving 
> partially the problem I had.
> 
> 
> 
> Kind regards
> 
> 
> 
> E. Martin-Serrano
> 
> 
> 
> 
> 
> 
> 
> De: Dr. Robert Kragler [mailto:kragler at hs-weingarten.de] Enviado el: 
> s=E1bado, 30 de noviembre de 2013 12:08
> Para: E. Martin-Serrano
> Asunto: Re: LocatorPane and tooltips for the locators
> 
> Dear Dr. Martin-Serrano,
> 
> reading your question about LocatorPane and Tooltip I am not quite 
> sure whether my reply partly answers your problem with Tooltip.
> Recently, I had a problem where I wanted to display points x_k + y_k I 
> in the complex plane with Graphics but at the same time show the 
> coordinates with Tooltip. The essential tip came from Michael 
> Trott/WRI which is an extension not given in the documentation for 
> Tooltip. I just show some snippets of code which could be perhaps
illuminating for you :
> 
> pts={ x1+y1 I, ..., xn+yn I } ;
> 
> ttip=Tooltip[#, #1[[1]] . {1,I} //TraditionalForm, TooltipStyle -> 
> {Red,Bold}] &;
> 
> Show[ ContourPlot[...],
>             Graphics[{ ....,
>                              Table[ {Red,PointSize[Medium], Point @ 
> {Re[#],Im[#]}&  @ pts[[i]] // ttip}, {i,pts//Length}],
>                              ....
>                             }],
>             AspectRatio-> Automatic, opts]
> 
> This shows the points Point @ {xi,yi} as red dots and at the same time 
> Tooltip displays with pts[[i]] // ttip  the corresponding value (xi + 
> yi \[ImaginaryI] ) in traditional form.
> 
> Best regards,
> Robert Kragler
> 
> Am 30.11.2013 08:25, schrieb E. Martin-Serrano:
> 
> Hi,
> 
> I have the below sketchy  *LocatorPane* piece of code  with dynamic 
> locators,  defined over  the set of points pts . I use this device to 
> deal with multiple 2D Bezier curves, which involve several sets of  
> grouped locators  for the controls of each curve. *LocatorPane* 
> imposes some restrictions on dynamic programs. **Locator** itself is 
> (should be) much more flexible but it does not work for me yet. When 
> the dynamic stuff gets just a bit complex (not very much) *Locator* 
> does not work (definitively) and *LocatorPane* seems to be much more 
> agile and handy, by far. But it imposes other restrictions not to be 
> mentioned here, except for the one about *Tooltip* on the locators (as far
as I am aware of it).
> 
> Now, it follows  the *LocatorPane* piece of pseudo code  with dynamic 
> locators
> 
> ----------------------------------------
> 
> pts = *list of  {xi, yi}  locator coordinates*
> 
> calcAll[pts_,stuff_]:=  (* calcAllBody to treat secondary dynamic 
> items*)
> 
> LocatorPane[Dynamic[pts, (pts = #; calcAll[pts, suff]) &], 
> *LocatorPaneBody*]
> 
> -----------------------------
> 
> This generates a LocatorPane with the set ts of dynamic  locators 
> partitioned according it is needed. But, I  need the locators to be 
> wrapped by *Tooltip*,  so that the current position of each  pts[[i]] 
> could be displayed  at will, however I can't  find how this can be 
> done within the
> *LocatorPane* construct, since the locators themselves are defined in 
> the heading part of the construct, namely: *Dynamic[pts, (pts = #; 
> calcAll[pts,
> suff]) &]*,  in no other place of the *LocatorPane* construct are the 
> locators mentioned.
> 
> 
> 
> Currently I have this working with inset labels on every locator, but 
> it is not the proper solution at all.
> 
> 
> 
> By the way, my previous post on Intersecting Bezier is just about 2D
curves.
> 
> 
> 
> Any help will be appreciated.
> 
> 
> 
> Cheers.
> 
> 
> 
> E. Martin-Serrano
> 
> 
> 
> 
> 
> 
> --
> Prof. Dr. Robert Kragler
> Hasenweg 5
> D-88090 Immenstaad, Germany
> Phone : +49 (7545) 2833 or 3500
> Email : kragler at hs-weingarten.de <mailto:kragler at hs-weingarten.de>
> URL :   http://portal.hs-weingarten.de/web/kragler
> 
> 
> 
--
Itai Seggev
Mathematica Algorithms R&D
217-398-0700 





  • Prev by Date: Re: LocatorPane and tooltips for the locators
  • Next by Date: Re: gives 919.8359999999999?`
  • Previous by thread: Re: LocatorPane and tooltips for the locators
  • Next by thread: Re: LocatorPane and tooltips for the locators