1
$\begingroup$

My problem is rather simple, I need that the TextField widget named Sumfield updates its value during a function evaluation, in this cased called Hola[].

The problem is it is not updating information during, just at the end. Is there a way for this to work?

Needs["GUIKit`"];

Hola[] := While[
    a < 5
  , ref @ GUIKit`SetPropertyValue[{"SumField", "text"}, ToString[ a, InputForm]]
  ; Print[a]
  ; Pause[1]
  ; a++;
]

ref = GUIRun[ Widget[ "Panel"
  , { Widget[ "Button"
        , { "text" -> "Print"
          , BindEvent["action", Script[Hola[]]]
          , BindEvent["action", Script[PaPa[]]]
          }
      ]
    , Widget["Label", {"text" -> "Sum: "}]
    , WidgetAlign[]
    , Widget[ "TextField"
        , { "horizontalAlignment" -> PropertyValue["RIGHT"]
          , "editable" -> "false"
          }
        , Name -> "SumField"
      ]
    }]
  , IncludedScriptContexts -> {$Context}
]
$\endgroup$
  • $\begingroup$ What version are you using? Is GUIKit a must? It is rather outdated and Dynamic framework is used these days. $\endgroup$ – Kuba Feb 15 '17 at 19:21
  • $\begingroup$ Mathematica 10, And yes gui kit is a must, the example im posting here is simple but i want to aply it to a much larger program. $\endgroup$ – Paul Feb 15 '17 at 19:44
  • $\begingroup$ I answered my own question in the section called threads $\endgroup$ – Paul Feb 17 '17 at 17:10
  • $\begingroup$ I answered my own question in the section called threads, there it explains how the widget can run at the same time as the loop. $\endgroup$ – Paul Feb 17 '17 at 17:11
  • $\begingroup$ ? You mean you've found the answer in a specific section of GUIKit tutorial or something? Please make that clear and provide a link / code sample / a quote. $\endgroup$ – Kuba Mar 19 '17 at 17:48

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.