The Mathematica Journal
Current Issue
Tricks of the Trade
In and Out
Riemann Surfaces IIc
The Mathematica Programmer
New Products
New Publications
News Bulletins
Editor's Pick
Write Us
About the Journal
Staff and Contributors
Back Issues
Download This Issue

Pop-Up Window Button

Q: I am working with text cells that include parenthetical remarks. Instead of using parentheses, I would like to configure a button, embedded in the text cells, so that when you click on it, it opens up a small pop-up window containing the parenthetical remark. How can I do this?

A: P. J. Hinton ( writes: You can define a button style that can do this. Here is an example of text with a hidden parenthetical remark located here. Clicking here opens up a small pop-up window containing the parenthetical remark.

How does this work? A style named PopupButton has been added to the style sheet of this notebook:

If you unformat this cell, you will see that its ButtonFunction opens a new notebook, which itself contains a NotebookClose button.

Cell[ #2, "Text"],
ButtonBox[ "Dismiss",
ButtonFunction :> NotebookClose[
ButtonNotebook[ ],
Interactive -> False],
Active -> True]
], "Text"]},
ShowCellBracket -> False,
WindowFrame -> "Frameless",
WindowElements -> None,
WindowFrameElements -> None,
WindowTitle -> None,
WindowSize -> {90, 80}]

To add a new parenthetical remark:

1. Select the text that will be used to anchor the pop-up.
2. Click on the front end menu command sequence Input Create Button PopupButton. The text will turn red.
3. Now drag-select the text from left to right and then open the Option Inspector dialog (Format Option Inspector). Check that the scope is selection, and then locate the option ButtonData.
4. Enter the text you want displayed in the pop-up window as a string.
5. Close the Option Inspector dialog.

Copyright © 2002 Wolfram Media, Inc. All rights reserved.

[Article Index][Prev Page][Next Page]