I'm using GUIKit in Mathematica 11.0, which throws an error message whenever a window or panel is shown. I know GUIKit is deprecated but I don't want to port a whole project to the newer controls.

Now I want to suppress the error messages coming from GUIKit but keep all other possible messages. Quiet sadly doesn't work. I thought I could change the setting User interface log messages to Ignore temporarily, switch to another panel and re-enable the messages again (see How to find out valid values for an option).

However it doesn't work and I can't see why. I used the following code snippet:


frm = Widget["Frame", {
  Widget["Panel", {
    "visible" -> False,
     Script[SetPropertyValue[{"frmHauptfenster", "title"}, 
        "Panel 1"];]],

    Widget["Label", {"text" -> "Panel 1"}],
    Widget["Button", {
      "text" -> "toggle1",
      BindEvent["action", Script[ToggleVisible[];]]}
    }, Name -> "p1"],
  Widget["Panel", {
    "visible" -> True, 
     Script[SetPropertyValue[{"frmHauptfenster", "title"}, 
        "Panel 2"];]],

    Widget["Label", {"text" -> "Panel 2"}],
    Widget["Button", {
      "text" -> "toggle2",
      BindEvent["action", Script[ToggleVisible[];]]}
    }, Name -> "p2"]
  }, WidgetLayout -> {"Border" -> 5, 
   "Stretching" -> {Maximize, Maximize}}]
, Script[
 ToggleVisible[] := Module[{},
    (* Turn off messages *)
     MessageOptions -> {"ConsoleMessageAction" -> {}}];
    p1visible = PropertyValue[{"p1", "Visible"}];
    SetPropertyValue[{"p1", "Visible"}, Not[p1visible]];
    SetPropertyValue[{"p2", "Visible"}, p1visible];
    (* Turn messages back on *)
     MessageOptions -> {"ConsoleMessageAction" -> 
}, Name -> "frmHauptfenster"];

ref = GUIRun[frm];

Why doesn't it work? Or is there even another workaround?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.