2
$\begingroup$

I have created a palette in Mathematica v10.0.2, and used the Menu-->Palettes-->Install Palette functionality to successfully install it.

When I choose my palette (from the dropdown menu), rather than automatically running the code, Mathematica simply opens the notebook that contains the palette code. Then I have to perform a Shift-Enter to actually get the palette created.

Question 1: How does WRI get its palettes to auto-evaluate?

Question 2: Does the solution have something to do with this question? How do I automatically evaluate a cell when a notebook is opened?

Question3: Just to have something to work with, how could I get the code below to automatically evaluate after it is installed as a palette?

CreatePalette[OpenerView[{"Open here", "Hello world!"}], 
  WindowSize -> {200, 200}]
$\endgroup$
2
  • 2
    $\begingroup$ Most palettes I have seen are based on buttons or other controls created by notebooks. Then, the palette of controls is installed, not the original notebook. See Creating Palettes. $\endgroup$
    – bbgodfrey
    Mar 14, 2015 at 20:15
  • $\begingroup$ See @Silvia 's answer to 1137 for a practical example. And, if you use Internet Explorer, you may find this palette handy besides. Certainly, I do. $\endgroup$
    – bbgodfrey
    Mar 14, 2015 at 20:33

1 Answer 1

3
$\begingroup$

Perhaps you are installing the wrong notebook as your palette. Installing a palette involves two notebooks and the palette installation dialog.

First, the source notebook which contains the code that generates the palette notebook. Note that I have given the palette window a name. This is important when come to install it.

source-nb

Second, the palette notebook that is created by evaluating the CreatePalette expression in the source notebook.

palette

Finally, the installation dialog.

install

Note that I have chosen the palette notebook, not the source notebook in the installation dialog and given it a name that will appear in in the Palettes menu the next time Mathematica is restarted.

$\endgroup$
1
  • $\begingroup$ You have explained exactly what I was doing wrong! I was confusing the source notebook used to construct the palette with the palette notebook that is actually created upon executing the source notebook. Thank you for the kindness of your reply! That takes care of "gotcha" number 4,387,203. ;) $\endgroup$
    – Todd Allen
    Mar 15, 2015 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.