MathGroup Archive 2000

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

Search the Archive

Re: ButtonBox, styles, GraphicsGenerator.nb

  • To: mathgroup at
  • Subject: [mg25026] Re: ButtonBox, styles, GraphicsGenerator.nb
  • From: "P.J. Hinton" <paulh at>
  • Date: Fri, 1 Sep 2000 21:57:32 -0400 (EDT)
  • Organization: Wolfram Research, Inc.
  • References: <8hfgjn$> <8onegm$>
  • Sender: owner-wri-mathgroup at

On 1 Sep 2000, Peter Dickof wrote:

> In the GraphicsGenerator notebook available on MathSource, an example
> is given of  button which generates a plot in a standalone notebook
> window. The notebook then says
> "Earlier in this notebook, we took some pains in separating
> task-specific material from things that might be reusable.  Gathering
> the set of reusable ButtonBox objects together, we can place them in a
> StyleData cell in a style sheet so that you can speed the creation of
> similar buttons.  Here is an example of what a cell style might look
> like
> Cell[StyleData["PutGraphicInWindow"], StyleMenuListing -> None, 
>     ButtonStyleMenuListing -> Automatic, 
>     ButtonBoxOptions -> {ButtonEvaluator -> "Automatic", 
>         ButtonFunction :> (NotebookPut[
>                 Notebook[{Cell[GraphicsData["PostScript",
> DisplayString[#2]], 
>                       ShowCellBracket -> False]}, WindowSize -> {300,
> 250},  
>                   WindowElements -> {}, WindowTitle -> "Graphics"]] &
> ), 
>         Active -> True}] // CellPrint
> The sample notebook never actually resuses thuis, and I can't figure
> it out. 
> I copied this to a notebook which I put in the /
> ../configuration/FrontEnds/StyleSheets directory. It still does not
> appear in the Input/Create Button or Input/Edit button menu. Isn't it
> supposed to?

Did you make sure that your working notebook was configured to use the
style sheet that contains the "PutGraphicInWindow" style prototype?  The
front end's Edit -> Create Button menu lists only those button styles
which are found in the notebook's current style sheet.  It does not search
other style sheet notebooks.

> Also I try to include it directly in a notebook and then use it in
> command
>    ButtonBox[ToExpression["Plot3D[Sin[x] Cos[y],{x,0,2Pi}, {y,0,2Pi}, 
> 		DisplayFunction->Identity],
> 	ButtonStyle->PutGraphicInWindow]
> and nothing happens
> What am I doing wrong?

You have complicated the problem here in three ways:

1) You have specified the button's contents to be something that will
evaluate to something else.  You should use an inert label instead.

2) Your ToExpression[] is not completely terminated.  You need to close
off the string argument and supply a closing square bracket.

3) The value of ButtonStyle should be a string, not a symbol.

Here is how you might reformulate your button structure.

      "Plot3D[Sin[x] Cos[y],{x,0,2Pi}, {y,0,2Pi}]",
        "Plot3D[Sin[x] Cos[y],{x,0,2Pi}, {y,0,2Pi}, DisplayFunction -> \

P.J. Hinton
User Interface Programmer                         paulh at
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.

  • Prev by Date: Re: functions, packages, and contexts
  • Next by Date: Re: More troubles coming from indexed variables
  • Previous by thread: ButtonBox, styles, GraphicsGenerator.nb
  • Next by thread: Re: Re: opening files