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: [mg85247] Re: changing color of non-evaluatable cell
  • From: dflatin at rcn.com
  • Date: Mon, 4 Feb 2008 03:11:18 -0500 (EST)
  • References: <fnuh12$9lr$1@smc.vnet.net> <200802020828.DAA16231@smc.vnet.net>

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                     mur... 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

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}]]



  • Prev by Date: Re: changing color of non-evaluatable cell
  • Next by Date: Re: Possible bug in ListAnimate[] or Manipulate[] v6.0
  • Previous by thread: Re: changing color of non-evaluatable cell
  • Next by thread: Re: Re: changing color of non-evaluatable cell