InputBox and Button to change a graph
1. Can you explain what I've done wrong in the following?
2. Can you provide a better solution for my issue?
I want a user to be able to type an expression into an InputBox, and then click a Button in order to make a graph. I don't want the InputBox linked to the graph (or something on which the graph depends), but I want the button to control the change.
I tried making a free graph h(x) = -5 (so it is off screen). In the Button's OnClick script, I wrote: SetValue[h, %0]
This returns an error when the button is clicked, whether I've typed a number or an expression into the InputBox.
I'm not sure how I've misused the value of %0 here.
[I then tried a variation where I create a free object val = -5, make h(x) = val, and then use the button to change the value of val. This also doesn't work. Clearly I'm misusing %0 or SetValue in some way.]
Thank you all for your help!