Message Boards Message Boards

2 Replies
4 Total Likes
View groups...
Share this post:

Locator appearance

Posted 12 years ago
Even though Locators are used in Graphics, it seems that the appearance of a locator has to be text!
Is there any way to provide a graphic instead, so one could do precise positioning of the locator?
POSTED BY: Luc Barthelet
2 Replies
You are correct. I was confused by the construct Locator[ Dynamic, "x"] for example. I assumed that the graphics code was using the display of the element inside locator to know if the user was clicking on the locator or not. I was trying to put the Dynamic[Point] inside the Locator parameters. Obviously from your example it is not the way to do it. 

This was very useful, it helped me fix my code.

Thank you,
POSTED BY: Luc Barthelet
I'm afraid I don't understand what exactly you mean. A Locator doesn't has to have an appearance at all and you can use of course graphical primitives to display them. What about this here? It uses a small point and shows you the exact location in the graphics:

With[{lines = {Line[#], Line[Transpose[#]]} &@
    Table[{x, y}, {y, 0, 1, .1}, {x, 0, 1, .1}]},
 Deploy[DynamicModule[{p = {.5, .5}},
   Graphics[{lines, PointSize[.015], Red, Dynamic[Point[p]],
     Locator[Dynamic[p], None], Dynamic[Text[p, {.5, 1.1}]]}
    , Axes -> True

POSTED BY: Patrick Scheibe
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract