drag-n-drop: Freezing accepted Drag-Element

Problem: I have a problem with drag and drop questions because I want to freeze drag items after acceptance. After the correct assignment, the user should no longer be able to drag the drag element back to the starting position. During the attempt it should automatically move back to the target position.

ActivePresenter version: 9.2.0

OS: macOS 15.3.2

Notes: I googled a lot, but haven’t found any solution, not even with Javascript.

Here is perhaps a way to achieve your result…

Create your own user variable to capture when the correct object is dropped to the target.
Then disable each of your drag sources once the correct condition exists by checking against the value of your variable.

Drop Target
OnAccept → Adjust Variable dragFlag = 1
If Drag Source is correct Drag Source
Execute JavaScript

if (prez.variable("dragFlag") == 1) {
    prez.object("dragSource1").disable();
    prez.object("dragSource2").disable();
}

Repeat for all drag sources

Hope this helps.

3 Likes

Thank you very much Greg! Your solution looks good! I will try it and give you feedback whether it works. Kind regards from Heidelberg, Anja

I just tried it although it already late here in Germany. But I wanted to know, if it works. And it does!!! Thank you very very much!
I tried to disable per javascript before, but forgot to write the brackets () at the end of …disable() ! That was my mistake. I’m not very familiar with JavaScript yet. You helped me a lot!

2 Likes