GUIs may generate warnings while internal evaluations are processed. In this example I intentionally introduce a line that will generate a warning. Warnings are useful, so I don't want to quiet them nor I can ensure that a fairly complicated GUI (thousands of lines of code) will never generate one. The problem is that once I read the warning I would like to remove the pink background from the GUI without having to recreate it all.
The lines below will generate the problem when the Checkbox is clicked. I want to remove the pink background after I see it, or maybe I want to fix the code such that the pink background never appears but the warning messages remain printed to the console.
As a side note, this program doesn't work in Windows if I remove the brackets from or rename menuItems[] to menuItems.
CreateDocument[
Panel@
DynamicModule[{gui, opt = 1, dummyList = {3, 4}, changeTabQ = True,
menuItems},
menuItems[] := Block[{}, Rest@dummyList; {1, 2}];
Labeled[Checkbox[Dynamic[changeTabQ,
(dummyList = {}; changeTabQ = #;) &]]
,
Dynamic[Refresh[
Replace[changeTabQ,
{True -> Panel@
PopupMenu[Dynamic[opt, (opt = #;
) &]
, {1, 2}
]
, False -> PopupMenu[Dynamic[opt, (opt = #;) &], menuItems[]]
}
]
, TrackedSymbols :> {changeTabQ}
]
]
]
]
, WindowSize -> {Scaled@.3, Scaled@0.3}
, DockedCells -> Cell["Docked"]
, WindowMargins -> {{0, Scaled@1}, {Scaled@0.8, 0}}
, WindowElements -> {"VerticalScrollBar", "HorizontalScrollBar",
"StatusArea", "MagnificationPopUp"}
, Deployed -> True
, Editable -> False
, Selectable -> False
, WindowTitle -> "Test UI"
]