Palettes are like extensions of your keyboard. They can be used to perform many actions in the Wolfram System, including entering typesetting characters, styling notebooks, and performing evaluations. As with any notebook, creating palettes can be done with a menu item or programmatically.
an in-cell representation of a palette notebook that can be manipulated by the front end
Palette creation tools.
Palette notebooks have a unique property. They can be a currently selected notebook but cannot normally be an InputNotebook. This allows the palette to perform operations on the notebook into which keyboard input in the front end is directed. See "Manipulating Notebooks from the Kernel" for further information.
Generating a Palette Programmatically
CreatePalette[expr] creates an unsaved palette notebook containing expr and opens it in a separate window. To save the palette, close the window and save the file when the save dialog appears or save the palette notebook programmatically using NotebookSave.
Below is a palette that uses PasteButton to paste characters into the input notebook. PasteButton is specifically designed to work with palettes. It pastes its contents directly into the input notebook at the insertion point. When used in conjunction with RawBoxes, PasteButton will paste uninterpreted boxes into the input notebook.
Alternatively, use PaletteNotebook to create an in-cell representation of a palette notebook. A separate window containing the notebook can be opened in the front end by clicking the button or wrapping CreatePalette around the PaletteNotebook expression.
Since RawBoxes[boxes] inserts boxes verbatim without further interpretation, the characters can be used as part of an input expression or textual cell.
If the box structure for "π" is interpreted as a string in the palette, then regardless of the cell style, the front end will always treat "π" as a string.
This next palette inserts styled cells into the active notebook using front end tokens. Front end tokens perform front end commands from within the kernel that would normally be done using the menus. For a complete listing of front end tokens, see "Front End Tokens".
The palette below links to the Wolfram Language Documentation Center, allows the deletion of all output cells in the input notebook, and can also quit the kernel.
CreatePalette was used to create several Wolfram System palettes, including the Basic Math Assistant palette.
Note: Setting DynamicUpdating->True should only be done when the palette functionality has been completely debugged and is in a ready-to-use state, as this prevents the front end from aborting a dynamic evaluation that may or may not contain bugs.
2. To set these options using the Option Inspector, select the palette and open the Option Inspector:
In Notebook Options▶Display Options, explicitly set Magnification to avoid inheriting the global setting.
In Cell Options▶Evaluation Options, explicitly set DynamicUpdating->True to enable Dynamic even if dynamic updating is disabled in the user's front end.
To save the palette, click the close button in the palette window and you will be prompted to save the palette or save the palette notebook programmatically using NotebookSave.
Installing the Palette into the Wolfram System
A palette must be installed on the PalettePath for it to appear in the main Palettes menu.
The simplest way install a palette is to choose Palettes▶Install Palette, provide the source file, palette name, and installation directory to the Install Wolfram System Item dialog, and click Finish.
Palettes can also be installed as part of a Wolfram System application. To add a palette to your application, create a FrontEnd\Palettes\ directory within the application folder and save the palette to this location. For example, the palette MyPalette.nb would be placed in MyApplication\FrontEnd\Palettes\.
Dependent Opener Views
The second argument of Dynamic can be used to control the state of an opposite opener view so that only one remains open at any given time.
Palette states can also be tracked and controlled using TaggingRules. Unlike dynamic variables, TaggingRules are automatically cached by the front end so that installed palettes can remember their control object states across multiple front end sessions, even if they cannot be saved. This topic is beyond the scope of this document, but a detailed discussion and set of examples can be found in "Storing and Tracking Palette States".
Applying and Evaluating Functions
Palettes can run evaluations and return the results to a notebook.
Consider the following polynomial. Highlight the expression and choose Expand from the palette above. The Wolfram Language will apply the function to the selection and evaluate the resulting expression in place.