4
$\begingroup$

I have some code, similar to that from this question (not sure where I modified it from, don't think it was actually that question) to open a simple dynamically refreshing palette showing the currently defined variables.

openVariableTracker[] := CreateWindow[ PaletteNotebook[ Dynamic[Grid[ Prepend[Select[ With[{expr = ToExpression@#}, {#, Head[expr], expr}] & /@ Names["Global`*"], (#[[2]] =!= Symbol) &], {"Variable", "Type", "Value"}], ItemStyle -> Directive[FontSize -> 28], Spacings -> {2, 2}, Dividers -> "|", Alignment -> Center], UpdateInterval -> 0.1, TrackedSymbols -> {}], WindowTitle -> "Currently Defined Variables"]] 

This works fine for my purposes, but often (although not always!) when I close the palette window, a dialog box pops up to ask if I want to "Save Changes" to the notebook.

Is there a way to prevent this? I'm using the code in a lecture explaining the basics of Mathematica, so it would be nice to not be asked when I close the palette.

$\endgroup$

1 Answer 1

4
$\begingroup$

Simply add the option Saveable -> False:

 openVariableTracker[] := CreateWindow[ PaletteNotebook[ Dynamic[Grid[ Prepend[Select[ With[{expr = ToExpression@#}, {#, Head[expr], expr}] & /@ Names["Global`*"], (#[[2]] =!= Symbol) &], {"Variable", "Type", "Value"}], ItemStyle -> Directive[FontSize -> 28], Spacings -> {2, 2}, Dividers -> "|", Alignment -> Center], UpdateInterval -> 0.1, TrackedSymbols -> {}], WindowTitle -> "Currently Defined Variables", Saveable -> False]] 
$\endgroup$
1
  • $\begingroup$ I thought there would be something like that, but couldn't find it in the documentation. One of those unhelpful undocumented functions. $\endgroup$ Commented Feb 14, 2017 at 16:06

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.