Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to update a list every time a value in a Table Widget is changed.

My list has to be made from expressions and not strings since I am doing some symbolic calculations each time the table is changed.

The problem is that when I update the value of the list with the new value from the table converted from string to expression, I get something like this for example2:

{a, GUIKitPrivateScript7`d, c} - here b has been changed with d.

If I leave the value to be of type String everything works fine, but if I add ToExpression[] I always get a symbolic GUIKitPrivateScript` infront of the value.

Here is an example code that illustrates the problem.

example = {"a","b","c"}
 example2 = {a, b, c}
    Needs["GUIKit`"]
    ref = GUIRun[
      Widget["Panel", {Widget["Table", {

             "items" -> Script[{example}],
             PropertyValue["model", Name -> "myTableModel"]
             }, Name -> "myTable"],
             BindEvent[{"myTableModel", "tableChanged"},
             Script[


             example2[[PropertyValue[{"#", "column"}]+1]] =  ToExpression[
              InvokeMethod[{"myTableModel", "getValueAt"}, 
               PropertyValue[{"#", "firstRow"}], 
               PropertyValue[{"#", "column"}]]]
             ]
             ]
          }],IncludedScriptContexts -> {$Context}]
share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.