Re: How to find which variable caused the trigger in Manipulate[]
- To: mathgroup at smc.vnet.net
- Subject: [mg103824] Re: How to find which variable caused the trigger in Manipulate[]
- From: "Nasser Abbasi" <nma at 12000.org>
- Date: Thu, 8 Oct 2009 07:50:18 -0400 (EDT)
"Nasser Abbasi" <nma at 12000.org> wrote in message news:... > > Here is what I tried so far, and this fail: > > Manipulate[ > Which[ > > x != oldx, > {oldx = x; Text[StringJoin["you moved the ", "x ", " slider"]]}, > > y != oldy, > {oldy = y; Text[StringJoin["you moved the ", "y ", " slider"]]}, > > True, Text["why Ami here??"] > ], > > {x, 0, 1}, > {y, 0, 1}, > {oldx, -999, ControlType -> None}, > {oldy, -999, ControlType -> None} > ] > As always seem to happen, after I posted the above, I find a solution. All what I have to do is track the correct symbols. Here is the solution Manipulate[ Which[ x != oldx, {oldx = x; Text[StringJoin["you moved the ", "x ", " slider"]]}, y != oldy, {oldy = y; Text[StringJoin["you moved the ", "y ", " slider"]]}, True, Text["why Ami here??"] ], {x, 0, 1}, {y, 0, 1}, {oldx, -999, ControlType -> None}, {oldy, -999, ControlType -> None}, TrackedSymbols -> {x, y} (*this is the trick*) ] By telling Mathematica to only track x and y and not oldx and oldy, I get what I want ! --Nasser