1
$\begingroup$

Dear Mathematica users,

does anyone know how I can update my existing Gui window (made with GUIKit) by choosing different values of a ComboBox so that different and multiple TextFields etc appear depending on the current value of the ComboBox. The created TextFields should appear in the same window below the ComboBox and they should update once the value of the ComboBox is changed.

I appreciate any help

this is what I've tried so far

Widget["Frame",
 {Widget["ComboBox", {
"items" -> Script[{"Choice A", "Choice B", "Choice C",  "Choice D",  
   "Choice E"}], BindEvent["action", Script[updateSource[]]]}, Name -> "comboSource"] ,

Widget["Panel", list],

Widget["Label", {"text" -> "Distance from the source[m]"}], 
Widget["TextField", {"text" -> "0"}, Name -> "SourceTextField0"],
Widget["Label", {"text" -> "Sourcesize"}], 
Widget["TextField", {"text" -> "0"}, Name -> "SourceTextField1"],
Widget["Label", {"text" -> "b: "}], 
Widget["TextField", {"text" -> "1"}, Name -> "SourceTextField2"],
Widget["Label", {"text" -> "c: "}], 
Widget["TextField", {"text" -> "2"}, Name -> "SourceTextField3"],
Widget["Label", {"text" -> "d: "}], 
Widget["TextField", {"text" -> "3"}, Name -> "SourceTextField4"],
Widget["Button", {"text" -> "Done", 
BindEvent["action", 
 Script[InvokeMethod[{"FrameSource", "dispose"}]]]}],
Script[updateSource[] := Block[{}, list = widglist]; list = {}], 
"title" -> "Source"}, Name -> "FrameSource" ]

My hope was, that using a function called updateSource[] I can use Widget["Panel",list] and display a list where some predefined widgets are stored. Unfortunately, this doesn't work because Mathematica returns an error

Widget::deferr: Widget[Panel,list] is not valid GUI definition content. >>
GUIRun::nvalid: The GUI definition contains invalid content. >>

Is there a clever way of solving my problem?

Dennis

$\endgroup$
  • 1
    $\begingroup$ Dear Dennis, welcome to Mathematica.SE! It would help if you posted code showing what you have tried. $\endgroup$ – Verbeia Jan 19 '15 at 21:51

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.