Group Abstract Group Abstract

Message Boards Message Boards

Make UI using mathematica GUIKit, and need to call a .m/.nb/.xml file?

I am writing GUI code using GUIKit and in script i need to import/load/call a file(.nb/.m.xml) containing set of expressions and then output after evaluation of these expressions. I have tried (Import / Get / NotebookOpen) but i think i am making mistake somewhere due to which expression is loading and evaluating. here is my code:

GUIRunModal[Widget["Frame", {
     "title" -> "Calc with Mathematica",

{Widget["Label", {
      "text" -> "First argument:"}], 
  WidgetAlign[],
  Widget["TextField", {
      "columns" -> "20", 
      "horizontalAlignment" -> PropertyValue["RIGHT"],
      BindEvent["action", 
         Script[calculateResults[]]]
      }, Name -> "FirstArgumentField"] }, 

{Widget["Label", {
      "text" -> "Second argument:"}], 
  WidgetAlign[],
  Widget["TextField", {
      "horizontalAlignment" -> PropertyValue["RIGHT"],
      BindEvent["action", 
         Script[calculateResults[]]]
      }, Name -> "SecondArgumentField"]}, 

{WidgetFill[],
  Widget["Button", {"text" -> "Compute",
      BindEvent["action", 
         Script[calculateResults[]]]
      }]},

 Widget["Label", {"text" -> "Results: "}], 

{Widget["Label", {"text" -> "Sum: "}], 
  WidgetAlign[],
  Widget["TextField", {
      "horizontalAlignment" -> PropertyValue["RIGHT"],
      "editable" -> "false"
      }, Name -> "SumField"]}, 

 BindEvent["endModal", 
 Null
    ], 

 Script[
    calculateResults[] := Module[{x, y}, 
         {x, y} = 
    ToExpression /@ 
     PropertyValue[{{"FirstArgumentField", 
        "SecondArgumentField"}, "text"}];

   (* tis contains a having expression in terms of x,y*)
   Import["E:\\iiscnew\\PROJECT\\call.xml", "GUIKitXML"];


   l = a;



   SetPropertyValue[{"SumField", "text"}, ToString[l, InputForm]]; 

         ];
    ]

 }

]]

Attachments:
POSTED BY: Dileep Kumar
3 Replies

The UI you show can be made in a variety of ways, including the web/cloud deployed forms -- see the documentation in Mathematica 11. There are no compatibility issues with importing a version 9 notebook in version 11, if that is what you mean.

http://reference.wolfram.com/language/guide/CreatingFormsAndApps.html

POSTED BY: Dileep Kumar

GUIKit is obsolete. According to the documentation, its functionality is now in the main Wolfram Language. You may want to rewrite your code without GUIKit and see if there are any remaining issues.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard