MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: Re: Linear regression, error on both vaules x and y
  • Next by Date: Re:ArcTan[-Infinity, y] always returning 0?
  • Previous by thread: Re:ArcTan[-Infinity, y] always returning 0?
  • Next by thread: RE: Initialization cell and button