MathGroup Archive 2008

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

Search the Archive

RE: Creating Palettes

  • To: mathgroup at
  • Subject: [mg86014] RE: [mg85967] Creating Palettes
  • From: jose.luis.gomez at
  • Date: Sat, 1 Mar 2008 04:49:07 -0500 (EST)

This code does the trick:

   PasteButton[DisplayForm[RowBox[{"(",  RowBox[{"1", "-", "a"}], ")"}]]],
   PasteButton[(1 - a)^2]}];

Now, RowBox is really low-level programming (by low-level I mean not friendly
for end-users), so how can you know what is the correct Box structure for
an expression?
There is an easy way: in a Mathematica notebook write an expression, select
its corresponding cell, and selecet in the Mathematica menu called "Cell"
the option "Show Expression", from there you can "steal" the box structure
that you can use inside DisplayForm and inside PasteButton.

Notice that, in this example, if you give a value to the variable a before
creating the palette, then when you create the palette the button with a^2
will not show a^2, it will show the result of the calculation, while the
button with RowBox will show (1-a), exactly the same if "a" has or has not
a value.

Hope it helps


  • Prev by Date: Re: what corresponds to work folder in mathematica
  • Next by Date: 6.0.2 Standard Palettes in Windows Vista
  • Previous by thread: Re: Labeling axes in VectorFieldPlot3D?
  • Next by thread: RE: Creating Palettes