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

MathGroup Archive 2008

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

Search the Archive

Re: changing color of non-evaluatable cell

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85215] Re: changing color of non-evaluatable cell
  • From: dr DanW <dmaxwarren at gmail.com>
  • Date: Sat, 2 Feb 2008 03:28:47 -0500 (EST)
  • References: <fnuh12$9lr$1@smc.vnet.net>

On Feb 1, 1:16=A0am, Makinator <luvly.jubbly.makina... at gmail.com> wrote:
> 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.


  • Prev by Date: Re: Don't understand behavior of ClearAttributes[Plus,
  • Next by Date: Re: front end commands
  • Previous by thread: Re: changing color of non-evaluatable cell
  • Next by thread: Re: Re: changing color of non-evaluatable cell