NS BASIC Tech Note                                        March 20, 1997

39. Proper use of SETVALUE
-----------------------------------------------------------------

The SETVALUE function can be a useful function when used properly. It's 
most common use is to update the viewBounds or text value of widget that 
is already displayed. It causes the widget to be redrawn with the new 
values.

1. Documentation for NS BASIC before Rev 3.0 showed SETVALUE usually 
being called as follows:

     unused=SETVALUE(U.widget.entryline,'text, newvalue)

With Rev 3.0 on, this can be coded more compactly

    SETVALUE(widget.entryline,'text, newvalue)
    
    
2. Cloning the 3rd argument

In almost all cases, you should enclose the third argument in a CLONE() 
function as follows:

    SETVALUE(widget.entryline,'text, clone(newvalue))
    
This is especially true when you are using "" as the third argument. 
Always code as follows:

    SETVALUE(widget.entryline,'text, clone(""))
    
The Newton uses a ":=" style assignment of the third argument to the 
second. Should the value of the second parameter change, the value of the 
third argument will also be changed, regardless of how the statement 
reads in the program. By CLONE()ing it, you assign a copy of the third 
argument, not the third argument itself.