0
$\begingroup$

I have been working in a plotter using "manipulate", I let the code below. However, I would like change between different kind of "options" that I will add them after, the problem is when I change to a different option, the equation is changed, after when I return to the first option selected, the equation is cleared. There is a way to save this "equation" variable?

I tried saving the equation into another variable but I continue with issues when I change the option.

kappaX[ghXX_, x_, xmin_, xmax_, xlabel_] :=   Plot[ghXX, {x, xmin, xmax}, PlotLabel -> HoldForm[ghXX]];


Panel[Manipulate[Dynamic[If[AllTrue[{uMin, uMax}, NumericQ], 
Switch[tabNumber, tab1,DynamicModule[{Vbb = Null}, Column[{Style["Equation"], InputField[Dynamic[Vbb], String], 
    KappaFigE = 
     Dynamic[kappaX[ToExpression[Vbb, TraditionalForm], xvarI, 
       uMin, uMax, variablenameI]]}]], tab2, 
 DynamicModule[{Vbb = 10 (xpar1 xvar1) - 2  xvar1}, 
  Column[{Style["Equation"], InputField[Dynamic[Vbb]], 
    KappaFigE = 
     Dynamic[kappaX[Vbb, xvar1, uMin, uMax, variablenameI]]}]], 
 tab3, DynamicModule[{Vbb = 10 (xpar1 xvar1) + 10  xvar1 + xpar2},
   Column[{Style["Equation"], InputField[Dynamic[Vbb]], 
    KappaFigE = 
     Dynamic[kappaX[Vbb, xvar1, uMin, uMax, variablenameI]]}]]], 
Graphics[{}]]],   Grid[{{Style["Input Data", "Title"], SpanFromLeft, 
 SpanFromLeft}, {TabView[{            
   "Option 1" -> 
    Column[tabNumber = 
      tab1; {Row[{"This is the option 1"}]}],            
   "Option 2" -> 
    Column[tabNumber = 
      tab2; {Row[{"This is the option 2"}]}],            
   "Option 3" -> 
    Column[tabNumber = tab3; {Row[{"This is the option 3"}]}]}, 
  Dynamic@tabNumber]}, {Control@{{variablename, Null, 
    Style["Parameter name 1"]}, InputField[#, String] &}, 
 Control@{{xpar1, Null, Style["Value"]}, InputField[#, Number] &},
  Button[Style["Save", Bold, 12], 
  ToExpression[variablename, StandardForm, 
   Function[name, name = xpar1, 
    HoldFirst]]]}, {Control@{{variablename2, Null, 
    Style["Parameter name 2"]}, InputField[#, String] &}, 
 Control@{{xpar2, Null, Style["Value"]}, InputField[#, Number] &},
  Button[Style["Save", Bold, 12], 
  ToExpression[variablename2, StandardForm, 
   Function[name2, name2 = xpar2, HoldFirst]]]}, {Style[
  "Input Variable Name"], 
 Control@{{variablenameI, Null, Style["Variable name I"]}, 
   InputField[#, String] &}, 
 Button[Style["Save", Bold, 12], 
  ToExpression[variablenameI, StandardForm, 
   Function[nameI, nameI = xvarI, HoldFirst]]]}, {Control@{{uMin, 
    10, Style["uMin"]}, InputField[#, Number] &}, 
 Control@{{uMax, 100, Style["uMax"]}, 
   InputField[#, Number] &}}}], {{tabNumber, 1},    None}, {{tab1, 1}, None}, {{tab2, 2}, None}, {{tab3, 3}, None},   ControlPlacement -> Left, SaveDefinitions -> True]]

enter image description here enter image description here enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.