Message Boards Message Boards

3
|
6532 Views
|
2 Replies
|
9 Total Likes
View groups...
Share
Share this post:

How are EvaluationNotebook and ButtonNotebook different?

Posted 12 years ago
I have already asked this question on the Mathematica StackExchange (but haven't received a satsfactory asnwer), so please see there as well.

Is there a situation where EvaluationNotebook[] and ButtonNotebook[] would return different results when called in the same context (other than when ButtonNotebook[] returns $Failed because it was not run from a button)?  The documentation states:
If a button in a palette initiates evaluation in another notebook, then ButtonNotebook[] will be the palette, but EvaluationNotebook[] will be the other notebook. 
So in other words, the question is: how can a palette button initiate an evaluation in another notebook?  Here's a small test example:
CreatePalette[Button["press", Print@{EvaluationNotebook[], ButtonNotebook[]}]]
Notice that both return the palette, even if the focus is in another notebook (SelectedNotebook[] or InputNotebook[] would return that one). Is it possible to run Print@{EvaluationNotebook[], ButtonNotebook[]} in a context where they'd return different results? If not, then what is the purpose of ButtonNotebook[]?
POSTED BY: Szabolcs Horvát
2 Replies
Posted 8 years ago

So the second statement under "Details" section of Documentation page for ButtonNotebook is wrong:

If a button in a palette initiates evaluation in another notebook, then ButtonNotebook[] will be the palette, but EvaluationNotebook[] will be the other notebook.

Shouldn't it be corrected then?

Expanded question.

POSTED BY: Alexey Popkov
They're identical.  ButtonNotebook was the original name and is kept around for legacy purposes, but EvaluationNotebook is a better name because the concept is appropriate for use in many places other than buttons.
POSTED BY: John Fultz
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract