Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: changing color of non-evaluatable cell

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85268] Re: [mg85247] Re: changing color of non-evaluatable cell
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Tue, 5 Feb 2008 05:57:31 -0500 (EST)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <fnuh12$9lr$1@smc.vnet.net> <200802020828.DAA16231@smc.vnet.net> <200802040811.DAA27814@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

Some years ago, Rolf Mertig created a palette CellProperties.nb that 
included toggle buttons for selected cells to be open/closed, 
evaluatable/non-evaluatable, active/inactive, 
initialization/non-initialiation; it includes a button to duplicate 
selected cells and two buttons for opening or closing all selected 
groups.  That palette is available at:

  http://www.mertig.com/mathdepot/

It's an easy thing to modify his palette so as to include setting 
Opacity->0.5 when cells are made non-evaluatable (and back to Opacity->1 
when evaluatable).

At least it's easy now that I know the forgotten "secret".  As Ingolf 
Dahl kindly reminded me, the Palettes menu has an item "Generate 
Notebook from Palette" along with an item "Generate Palette from 
Selection".  I have so much "palette creep" on my menu I didn't even see 
those, and I had quite forgotten about them -- which is unforgivable 
because it's easy to (re-)learn of their existence by looking up 
"palette" in the Documentation Center.

dflatin at rcn.com wrote:
> On Feb 2, 11:38 pm, Murray Eisenberg <mur... at math.umass.edu> wrote:
>> It's always nice to be able to save one mouse movement/click!  (An
>> instance of the Archimedean Ordering Property: if you add a very small
>> number to itself enough times, you can get an arbitrary large large
>> number.  Or, one-time U.S. Senator Everett M. Dirkson is alleged to have=
> 
>> said about government spending, "A billion here, a billion there, and
>> pretty soon you're talking about REAL money.")
>>
>> So I added the obvious thing to the buttons so now the palette also
>> offers the option to close or open the cell.
>>
>> When using CreatePalette upon a Grid with the four buttons, I evaluated:
>>
>>    Options[CreatePalette]
>>
>> It's an awesomely long list!
>>
>>
>>
>> dr DanW wrote:
>>> On Feb 1, 1:16 am, Makinator <luvly.jubbly.makina... at gmail.com> wrot=
> e:
>>>> Please could someone help me,
>>>> I would like to to set-up mathematica's notebook to automatically
>>>> change color to some custom color, when I set this cell as non-
>>>> evaluatable. And vice versa, when I set it to evaluatable to change
>>>> color to default.
>>>> THX
>>> I have created buttons that simultaneously change the Evaluatable
>>> option and a visible attribute of the cell and put the buttons in a
>>> palette that is always on my screen.  Of course, if you change
>>> Evaluatable from the menu, the cells appearance will change in sync,
>>> so you always have to use the buttons to turn it on or off.
>>> I have found that changing the Opacity of the cell to 50% works well
>>> when I set Evaluatable->False.  It lets me see the syntax highlighting=
> 
>>> and the dim appearance makes it clear that it does nothing (well, it
>>> looks dim on a Mac.  On Windows XP, it just looks a little foggy.)
>>> Here is the code for creating the two buttons:
>>> EvaluateButton = Button["Cell Evaluatable",
>>> SelectionMove[SelectedNotebook[], All,
>>>       Cell]; SetOptions[NotebookSelection[InputNotebook[]],
>>>       Evaluatable -> True, Opacity -> 1]; , Appearance -> "Palette=
> ",
>>>     ImageSize -> Small];
>>> NotEvaluateButton = Button["Cell Not Evaluatable",
>>> SelectionMove[SelectedNotebook[], All,
>>>       Cell]; SetOptions[NotebookSelection[InputNotebook[]],
>>>       Evaluatable -> False, Opacity -> 0.5]; , Appearance ->
>>> "Palette",
>>>     ImageSize -> Small];
>>> In both cases, the button function makes sure that the whole cell is
>>> selected, then sets Evaluatable and Opacity.
>>> Put these buttons in a Grid[] and use CreatePalette[], then save the
>>> resulting palette.
>> --
>> Murray Eisenberg 
> 
> I liked this idea so I made a palette with two toggle buttons, one for
> evaluatable and one for open/close
> 
> ToggleEvaluateButton = Button[
>    Style["Toggle Evaluatable", 9],
>    Module[{ns},
>     SelectionMove[SelectedNotebook[], All, Cell];
>     ns = NotebookSelection[InputNotebook[]];
>     If[Evaluatable /. Options[ns],
>      SetOptions[ns, Evaluatable -> False, Opacity -> 0.5],
>      SetOptions[ns, Evaluatable -> True, Opacity -> 1]
>      ]
>     ],
>    Appearance -> "Palette"
>    ];
> ToggleOpenCellButton = Button[
>    Style["Toggle Open/Close", 9],
>    Module[{ns},
>     SelectionMove[SelectedNotebook[], All, Cell];
>     ns = NotebookSelection[InputNotebook[]];
>     If[CellOpen /. Options[ns],
>      SetOptions[ns, CellOpen -> False],
>      SetOptions[ns, CellOpen -> True]
>      ]
>     ],
>    Appearance -> "Palette"
>    ];
> 
> CreatePalette[Column[{ToggleEvaluateButton, ToggleOpenCellButton}]]


-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: pattern matching against the Dt function?
  • Next by Date: Domains
  • Previous by thread: Re: changing color of non-evaluatable cell
  • Next by thread: Re: Legend option for ListPlot