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

MathGroup Archive 2012

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

Search the Archive

Clear variable on Locator point change

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125957] Clear variable on Locator point change
  • From: Scott Colwell <scolwell at uoguelph.ca>
  • Date: Mon, 9 Apr 2012 05:35:40 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Hi Folks,

Can anyone help me out with this problem.  I am plotting locator points on 
a graph and then having x and y listed on a table. Then some mathematical calculations are done on x and y. Give there are 15 points, having the calculations update on each move makes it too slow, so I've added a button that will be used to update the calculations after the locator points have been moved.

What I would like to do is clear the variables of the calculations on the next movement of the locator point.  Here is the idea below. Once the locator is moved, you click update to get the xy calculation. What I'm looking for is for xy to clear in the table on the next move of that locator. Then the update button can be selected again.  Then repeated.

Thank you for your help.

Manipulate[
 x1 = Extract[Flatten[SetPrecision[p1, 4]], 1];
 y1 = Extract[Flatten[SetPrecision[p1, 4]], 2];
 pts = List[p1];
 plotpoints =
  ListPlot[pts, PlotRange -> {{69, 88}, {68, 82}},
   PlotRangeClipping -> False, ImageSize -> 550 ,
   Frame -> {True, True, False, False} ];

 Column[{Row[{Show[plotpoints, AxesOrigin -> {69, 67},
      PlotRange -> {{69, 88}, {67, 82}}]}]}],
 Column[{
   Pane[
    Grid[{{"", "", "",
       Button["Update All", {xy = SetPrecision[x1*y1, 6]},
        ImageSize -> 200], SpanFromLeft},
      {Style["Participant", Bold], Style["x", Bold], Style["y", Bold],
        Style["xy", Bold], Style["x sq", Bold],
       Style["ysq", Bold] },(*First Row of Table Titles*)
     
      {"1", Dynamic[x1], Dynamic[y1], Dynamic[xy], "", ""}
      }, Frame -> All, ItemSize -> {{8, 9, 9, 10, 9, 9}, 1.2},
     Alignment -> {{Center, Center, Center, Center, Center,
        Center}, {Center, Center, {Bottom}}},
     BaseStyle -> FontFamily -> {"Ariel", 12},
     Background -> {None,
       None, {{{1, 2}, {1, 6}} -> Lighter[LightGray]}},
     Dividers -> {False, {True, False, True, {False}, True, False,
        False, True}}]
    ]
   }],
 {{p1, {84.56, 79.21}}, Locator, ControlType -> None}, {{xy, 6698},
  ControlType -> None}
 ]



  • Prev by Date: Re: Evaluating Exponential functions
  • Next by Date: Intersection problem
  • Previous by thread: Re: reverses order of terms producing the string: 1.2 x=
  • Next by thread: Intersection problem