Google Classroom
GeoGebraGeoGebra Classroom

Buttons

Introduction

With the scripting commands of a button you can increase or decrease the value of a number or a slider. You can set te value of any number. Following applets groups some examples. While clicking on the buttons different things happen:
  • increase s1: the value of slider s1 is increased by 1, regardless the value of s1.
  • decrease s2: the value of slider s2 is decreased by 1, regardless the value of s2.
  • reset s3: the value of slider s3 is set back to 0.
  • move A: the x-coordinate of A is increased by 1, regardless the equation of f.
  • reset A: the x-coordinate of A is set back to 0, regardless the equation of f.

How do you do this?

  • sliders: Create: sliders s1, s2 and s3 from -5 to 5 with increment 1.
  • buttons: Create: - button with Caption increase s1 and scripting command OnClick SetValue(s1,s1+1). - button with Caption decrease s2 and scripting command OnClick SetValue(s2,s2-1). - button with Caption reset s3 and scripting command OnClick SetValue(s3,0).
  • function: Create f(x) = x
  • point: Create A = Point(f) and set the trace on.
  • buttons: Create: - button with Caption move A and scripting command OnClick SetValue((x(A)+1,f(x(A)+1))). - button with Caption reset A and scripting commands OnClick SetValue(A,(0,f(0))) to set back the x-coordinate of A to 0. ZoomIn(1) to remove the trace of A.