how can I make a button redefine an object with a condition?
Answered
I want to program this:
If I press button +1 AND the new value of n is greater than e, then redefine e as e+1. On the other side: if I press button -1 AND the new value of n is less than a, then refefine a as a-1.
The button works well BUT... I don't know how to make the button keep working as it works now AND make this redefinition at the same time. My doubt is about the "if" condition, I don't know how to include it in the code. I've used if conditions in other contexts but I don't get the "grammar" for this one.
I provide a dropbox link in case you cannot open my attachment: https://www.dropbox.com/s/h...
Files:
recta num&eacut...
There's the syntax SetValue(n, If(n>e, n+1)) as well as If( n>e, SetValue(n, n+1)).
Both work ad it depends on the situation whether alternative suits you best.
chris
There's the syntax SetValue(n, If(n>e, n+1)) as well as If( n>e, SetValue(n, n+1)).
Both work ad it depends on the situation whether alternative suits you best.
chris
Thanks! It works.
I would like to make another change: If certain point goes beyond graphic view, automatically change graphic view to show that part.
I made the button "Desplaza vista gráfica", I want that command to be executed with the other buttons (+1 or -1) when necessary (I also need kind of a "if condition" for that... don't know how to refer to x end within a command).
You could use a variable for the settings of the Graphics, let's say xmax as the maximum value of x in the Graphics. Then you could use a similar command e.g. when the number gets greater the xmax (or perhaps xmax -1) to redefine xmax.
Something like If(n>xmax-1,SetValue(xmax,xmax+1)) and linkewise for xmin.
Comments have been locked on this page!