Tag Info

Hot answers tagged

4

Something, that more or less does what you asked for, can be achieved by creating a hidden InitializationCell using a DynamicWrapper DynamicWrapper["xxx", If[foo == 23, MessageDialog["You guessed it!"], MessageDialog["You've guessed the right variable name, but not the right value yet."]]]


2

One can localize the scope of variables to Manipulate by adding them as arguments to Manipulate with ControlType None. For your case Manipulate[Refresh[lower = distPlotRange[distribution, -1, 4]; upper = distPlotRange[distribution, 1, 4]; fillRange = {Max[#[[1]]], Min[#[[2]]]} &[ Transpose[{fillRange, {lower, upper}}]];, TrackedSymbols :> ...


2

One can use $Pre to check if an input expression defines the correct variable and is doing so using the correct value. SetAttributes[check, HoldAll] check[new_Set] := (Print["You guessed it!"]; new) /; HoldForm@new == HoldForm@Set[foo, 23] check[new_Set] := (Print[ "You've guessed the right variable name, but not the right value yet."]; new) /; ...


2

Implementation 1 This should produce the desired GUI. askUser[matrix_] := DialogInput[ Column[{ Grid[{ToString@#1, InputField[Dynamic[#1], FieldSize -> Tiny], ToString@#2, InputField[Dynamic[#2], FieldSize -> Tiny]} & @@@ matrix, Alignment -> Left], Row[{CancelButton[], DefaultButton[DialogReturn[matrix]]}] }]] ...


1

You can insert your Manipulate[...] in a DynamicModule[{lower,upper},...]: DynamicModule[{lower, upper}, Manipulate[ Refresh[ lower = distPlotRange[distribution, -1, 4]; upper = distPlotRange[distribution, 1, 4]; fillRange = {Max[#[[1]]], Min[#[[2]]]} &[ Transpose[{fillRange, {lower, upper}}]];, TrackedSymbols :> {distribution} ...



Only top voted, non community-wiki answers of a minimum length are eligible