Sending a javascript command when a step is displayed.

15 views
Skip to first unread message

William Haynes

unread,
May 22, 2022, 5:58:03 PM5/22/22
to Numbas Users
Christian,

A while back you showed me how to send javascript commands to geogebra when the advice is opened:  https://numbas.mathcentre.ac.uk/question/65285/do-something-in-javascript-when-the-advice-is-displayed/

I would like to do the same thing when a student "shows steps" . Is there a signal for that, or another way to achieve the same result?

Thanks,
Will

Christian Lawson-Perfect

unread,
May 26, 2022, 5:12:28 AM5/26/22
to numbas...@googlegroups.com
There isn't a signal for it at the moment - I'll add one.
Can you tell me what you're trying to do? Rather than implement this and never thinking about it again, I wonder if there could be something built-in to do what you want.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/c6bcfdfd-da18-44f5-a4d1-f04cd5ad2932n%40googlegroups.com.

William Haynes

unread,
May 26, 2022, 7:06:49 PM5/26/22
to 'guillaume theo' via Numbas Users

Hi Christian,

I would like to make some objects in a geogebra diagram visible when a step is shown.  I can do it when the advice is shown with something like this in the preamble, where applet is a jme variable created with geogebra_applet():


question.signals.on('adviceDisplayed',function() {
  try{
    app.setVisible("showV", true);
  }
  catch(err){}  
})

I can’t work out how to do the same when a step is shown however.

Will

Christian Lawson-Perfect

unread,
Jun 6, 2022, 5:54:00 AM6/6/22
to numbas...@googlegroups.com
OK, I think just having an event you can hook into is the right thing to do.
I've added two events, "openSteps" and "hideSteps", to the part object.
Here's a question showing how to use them: https://numbas.mathcentre.ac.uk/question/123410/opensteps-and-hidesteps-events/. The "when the part is created" script contains some code to show an alert box when steps are shown or hidden.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages