Initialization cell and button
- To: mathgroup at smc.vnet.net
- Subject: [mg70067] Initialization cell and button
- From: Markus Huber <mhla at gmx.at>
- Date: Mon, 2 Oct 2006 00:33:31 -0400 (EDT)
I've got the following simplified problem with a button: Create an initialization cell which contains a=1; Create a button with Button["a", Active -> True, ButtonFunction :> (FrontEndExecute[ FrontEndToken["EvaluateInitialization"]]; Print@a), ButtonEvaluator -> Automatic] // DisplayForm but say no, if Mathematica asks if to evaluate the initialization cells in the NB. Now press the button . In my opinion the result should be the printout of 1. Instead M prints a. If you press the button again it prints correctly 1. Why is M not aware of the value of a when evaluating the Print function although the initialization cells should have been evaluated already? Regards, Markus Huber