MathGroup Archive 2011

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

Search the Archive

Re: about the use of button

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115241] Re: about the use of button
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 4 Jan 2011 18:51:54 -0500 (EST)

Clicking the button gives an error message:

carWeight == tareWeight;
personNumber == 0;

Row[{Button["A person enters", {carWeight += 60, personNumber++}],
   Dynamic[{carWeight, personNumber}]}]

AddTo::rvalue: carWeight is not a variable with a value, so its value  
cannot be changed. >>

Increment::rvalue: personNumber is not a variable with a value, so its  
value cannot be changed. >>

Bobby

On Tue, 04 Jan 2011 03:26:40 -0600, W. Craig Carter <ccarter at mit.edu>  
wrote:

> Hello Yang,
> Try this:
>
> ----
>
> carWeight == tareWeight;
> personNumber == 0;
>
> Row[{Button["A person enters", {carWeight +== 60, personNumber++}],
>   Dynamic[{carWeight, personNumber}]}]
>
> -----
>
> You must avoid underscores "_" in variable names. It is a good habit to  
> use an lower case letter to begin each variable name. Notice that  
> Dynamic sits outside the button--that is the only place you need to see  
> the current (i.  e., dynamic) values.
>
> Craig
>
>
> On 28 Dec,   2010, at 6:51 AM, yang wrote:
>
>> Button["A person enters",
>> {Dynamic[car_weight+==60],Dynamic[person_number++}]]
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: quadp
  • Next by Date: Re: NDSolve, three 2-d order ODE, 6 initial conditions
  • Previous by thread: Re: about the use of button
  • Next by thread: Re: about the use of button