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.

  DynamicModule[{gui, opt = 1, dummyList = {3, 4}, changeTabQ = True, 
   menuItems[] := Block[{}, Rest@dummyList; {1, 2}];
      (dummyList = {}; changeTabQ = #;) &]]
       {True -> Panel@
          PopupMenu[Dynamic[opt, (opt = #;
              ) &]
           , {1, 2}
        , False -> PopupMenu[Dynamic[opt, (opt = #;) &], menuItems[]]
      , TrackedSymbols :> {changeTabQ}
 , WindowSize -> {[email protected], [email protected]}
 , DockedCells -> Cell["Docked"]
 , WindowMargins -> {{0, Scaled@1}, {[email protected], 0}}
 , WindowElements -> {"VerticalScrollBar", "HorizontalScrollBar", 
   "StatusArea", "MagnificationPopUp"}
 , Deployed -> True
 , Editable -> False
 , Selectable -> False
 , WindowTitle -> "Test UI"
  • 1
    $\begingroup$ I should emphasize that the code in this example has been written with the purpose of triggering the problem, so using PaneSelector or other funcitons to "improve" the code may hide the problem I'm trying to highlight. $\endgroup$ Commented May 18, 2015 at 18:05
  • $\begingroup$ Comments under this question should explain your side question: 66767 $\endgroup$
    – Kuba
    Commented May 18, 2015 at 18:08
  • $\begingroup$ I've often found that Dynamic[Refresh[code, TrackedSymbols->{symbols}]] often doesn't work as expected unless the symbols tracked have DownValues (i.e. end with a square bracket). In this example I had such behavior, so to make it work I added the [] at the end of the variable changeTabQ. Additionally, alternating the use or Rule[TrackedSymbols,{symbols}] and RuleDelayed[TrackedSymbols, {symbols}] may also make a difference at the time of "making things work" as expected. $\endgroup$ Commented May 18, 2015 at 18:16
  • 1
    $\begingroup$ Is Preferences -> Messages -> Formatting error indications--> None the answer? $\endgroup$
    – Kuba
    Commented May 20, 2015 at 17:48
  • 1
    $\begingroup$ It seems like those options partially solve the problem as the pink background is gone. The Cell Bracket still contains the evidence of the warning message which I would also like to remove somehow. I assume that those preferences can also also be set in a programmatic way. That would be the best such that the user doesn't have to deal with that, but the programmer can handle that for all potential users. $\endgroup$ Commented May 22, 2015 at 13:00

1 Answer 1


Suppress formatting errors by setting the necessary options for the actual notebook or for the front-end:

SetOptions[EvaluationNotebook[], AutoStyleOptions -> {
     "FormattingErrorStyle" -> {FontColor -> RGBColor[1., 0.33, 0.33], 
             Background -> RGBColor[1., 0.33, 0.33, 0.15]},
     "FormattingErrorTooltips" -> False,
     "HighlightFormattingErrors" -> False
  • $\begingroup$ @Kuba Yes, thanks, I copied it from another answer directly, forgot to modify. However, I have no clue how to suppress the bracket-indication. $\endgroup$ Commented Jun 20, 2016 at 7:09
  • $\begingroup$ OP needs that gone too but at least first part is shown in programmatical way. $\endgroup$
    – Kuba
    Commented Jun 20, 2016 at 7:19
  • $\begingroup$ @Kuba Well, I'm aware of that, but for now, this is my half-answer. Though one can always turn off cell brackets entirely via "ShowCellBracket". $\endgroup$ Commented Jun 20, 2016 at 9:39
  • $\begingroup$ Yes, sorry, I thought so but future readers are not aware of that from the answer content only. Don't want to be picky either but after several months, future reader may wonder why the bracket is still orange. Maybe I'm overreacting :) $\endgroup$
    – Kuba
    Commented Jun 20, 2016 at 9:52

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.