Message Board for Rorohiko Workflow Resources
https://www.rorohiko.com/cgi-bin/yabb2/YaBB.pl
General Category >> General Board >> APID - Prevent user from ungrouping or deleting
https://www.rorohiko.com/cgi-bin/yabb2/YaBB.pl?num=1223808930

Message started by weller on 10/12/08 at 22:55:30

Title: APID - Prevent user from ungrouping or deleting
Post by weller on 10/12/08 at 22:55:30
Hi
I'm trying to "disable" delete or ungroup command on certain InDesign objects. I thought that all that needs to be done is to set the observer to subjectDeleted and the attached script to
Code (]alert("Don't even try this");[/code):
The event makes the script run but the delete or ungroup operation happens.
My second attempt was to add [code]app.undo()
at the end of attached script. This might work (it didn't in my case, but that's probably an issue of my poor ExtendScript knowledge) but I hope there is more elegant solution.

So my question in a nutshell is:
How to cancel the effect of action that sent an event to the observer?


Thank you
weller

Title: Re: APID - Prevent user from ungrouping or deleting
Post by Harbs on 10/12/08 at 23:32:45
For most objects a simple duplicate() should do what you want. If there's threaded text frames, it'll be a bit more complicated (you'll have to rethread the story, etc.). For ungrouping you'll probably going to want to set an idle event and regroup on idle. (although, if the user is very quick, that might not work...)

Title: Re: APID - Prevent user from ungrouping or deleting
Post by Kris Coppieters on 10/13/08 at 06:14:47
Hi Weller,

Main thing about APID - it has NO facilities stop stop events from happening; it's all about notification, not about control. Internally, APID watches InDesign as the user works with it, and it keeps track of what is being done, and it sends events to your event handlers accordingly.

But it cannot stop the events from happening - in that respect it's a spectator, not a controller.

Maybe you can do something with 'locking' - i.e. you can lock objects against being modified. You could have a 'subjectModified' event handler that reinstates the lock each time the user unlocks the object - so deleting or ungrouping becomes impossible until your script allows the lock to be removed?


Message Board for Rorohiko Workflow Resources » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2024. All Rights Reserved.