I am looking for a concrete code example where EvaluationNotebook[] and ButtonNotebook[] will return different results.
The docs for ButtonNotebook say:
If a button in a palette initiates evaluation in another notebook, then
ButtonNotebook[]will be the palette, butEvaluationNotebook[]will be the other notebook.
How can a palette button initiate an evaluation in a different notebook?
A basic test where they return the same (the palette):
CreatePalette[
Button["press", Print@{EvaluationNotebook[], ButtonNotebook[]}]]
I am looking for an example where EvaluationNotebook and ButtonNotebook return different results when invoked from the same button. Of course ButtonNotebook will return $Failed when not invoked from a button.
Addendum
I'd like to point out that this question is not merely of theoretical interest. The fact that ButtonNotebook exists at all suggests that it must be different from EvaluationNotebook in some non-trivial way. Understanding the behaviour of EvaluationNotebook/ButtonNotebook is important to create robust code that will work correctly in edge cases too. I can not see their difference, so there must be some edge case I have not thought of.

ButtonNotebook[]returns$Failedin a fresh notebook andEvaluationNotebook[]doesn't – Rojo Jun 27 '12 at 16:26EvaluationNotebookdocs of your point where they useEvaluationNotebookto refer to the button notebook:pal = CreatePalette[{Button["Test", NotebookWrite[InputNotebook[], "Done"]; NotebookClose[ EvaluationNotebook[]]]}];– Rojo Jun 27 '12 at 16:30