Disable Delete, but without fixing the Object

caribou-contests shared this question 6 years ago
Answered

Is it possible to allow an object to be allowed to be moved, but not be allowed to be deleted?


Thanks.

Comments (4)

photo
1

Yes


See here for example

http://tube.geogebra.org/m/1339417

photo
1

Yes


See here for example

http://tube.geogebra.org/m/1339417


The problem is once I introduce the delete tool from the toolbar I can still delete that object in the worksheet.


http://tube.geogebra.org/b/...


For example for this worksheet I still want the user to have a delete button in case they mess up, but I don't want them to be able to delete 'S', but I still need it to be moved up and down the line.

photo
1

So... don't put the delete tool...

They have do/undo buttons... It is enough !!!

2f41489f27e127b1eb0fd9677cc70c35

photo
1

Sometimes you need the delete tool. Particularly now with Geogebra Classroom, because student applets are automatically saved. If they go to another applet and then come back to it, they won't be able to use "undo" go get rid of anything.

Below is a solution that you can copy into Global Javascript that will solve the problem. Just replace the name of the object inside the quotation marks where it says "nameOfObject". Anytime someone tries to delete the object, it will automatically undo so they can't delete it.


function ggbOnInit() {

ggbApplet.registerRemoveListener("undoDelete");

}

function undoDelete(obj) {

if (obj == "nameOfObject") {

ggbApplet.undo();

}

}

© 2021 International GeoGebra Institute