Skip to main content
deleted 1 character in body
Source Link
Anton Petrunin
  • 45k
  • 14
  • 135
  • 299

Yin Bon Ku created an assignment that solves my problem in GeoGebra. It uses the Global JavaScript; see Event Listeners.

One has to create an activity with the boolean value welldone = false. Add a text Well done!, and write welldone in its Settings > Advanced > Condition to Show Object. Use the following code in Scripting > Global JavaScript:

function ggbOnInit() {
ggbApplet.registerAddListener("newObjectListener");
}

function newObjectListener (obj) {
if (obj != "finished") {
  var cmd = "finished = ("+obj+"== target)";
  ggbApplet.debug(cmd);
  ggbApplet.evalCommand(cmd);
  finished = ggbApplet.getValueString("finished");
  if (finished.indexOf("true") > -1) {
    ggbApplet.setValue("welldone",1);
  }
}
}

Then, one may create a construction assignment. Hide the intermediate steps, label the result as target, and uncheck Selection Allowed in, its Settings > Advanced tab. And everything works!

Yin Bon Ku created an assignment that solves my problem in GeoGebra. It uses the Global JavaScript; see Event Listeners.

One has to create an activity with the boolean value welldone = false. Add a text Well done!, and write welldone in its Settings > Advanced > Condition to Show Object. Use the following code in Scripting > Global JavaScript:

function ggbOnInit() {
ggbApplet.registerAddListener("newObjectListener");
}

function newObjectListener (obj) {
if (obj != "finished") {
  var cmd = "finished = ("+obj+"== target)";
  ggbApplet.debug(cmd);
  ggbApplet.evalCommand(cmd);
  finished = ggbApplet.getValueString("finished");
  if (finished.indexOf("true") > -1) {
    ggbApplet.setValue("welldone",1);
  }
}
}

Then, one may create a construction assignment. Hide the intermediate steps, label the result as target, and uncheck Selection Allowed in, its Settings > Advanced tab. And everything works!

Yin Bon Ku created an assignment that solves my problem in GeoGebra. It uses the Global JavaScript; see Event Listeners.

One has to create an activity with the boolean value welldone = false. Add a text Well done!, and write welldone in its Settings > Advanced > Condition to Show Object. Use the following code in Scripting > Global JavaScript:

function ggbOnInit() {
ggbApplet.registerAddListener("newObjectListener");
}

function newObjectListener (obj) {
if (obj != "finished") {
  var cmd = "finished = ("+obj+"== target)";
  ggbApplet.debug(cmd);
  ggbApplet.evalCommand(cmd);
  finished = ggbApplet.getValueString("finished");
  if (finished.indexOf("true") > -1) {
    ggbApplet.setValue("welldone",1);
  }
}
}

Then, one may create a construction assignment. Hide the intermediate steps, label the result as target, and uncheck Selection Allowed in its Settings > Advanced tab. And everything works!

Source Link
Anton Petrunin
  • 45k
  • 14
  • 135
  • 299

Yin Bon Ku created an assignment that solves my problem in GeoGebra. It uses the Global JavaScript; see Event Listeners.

One has to create an activity with the boolean value welldone = false. Add a text Well done!, and write welldone in its Settings > Advanced > Condition to Show Object. Use the following code in Scripting > Global JavaScript:

function ggbOnInit() {
ggbApplet.registerAddListener("newObjectListener");
}

function newObjectListener (obj) {
if (obj != "finished") {
  var cmd = "finished = ("+obj+"== target)";
  ggbApplet.debug(cmd);
  ggbApplet.evalCommand(cmd);
  finished = ggbApplet.getValueString("finished");
  if (finished.indexOf("true") > -1) {
    ggbApplet.setValue("welldone",1);
  }
}
}

Then, one may create a construction assignment. Hide the intermediate steps, label the result as target, and uncheck Selection Allowed in, its Settings > Advanced tab. And everything works!