Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Cancel the creation and deletion of pageItems

Participant ,
May 28, 2010 May 28, 2010

I´m trying to avoid the creation and deletion of pageItems, observing protocol IID_IHIERARCHY_DOCUMENT and kNewPageItemCmdBoss and kDeletePageItemCmdBoss commands, aborting with the PMSetGlobalErrorCode function.

The problem is with the kNewPageItemCmdBoss:

     When I cancel the creation, automatically launches a new deletion, also intercepted, and InDesign crashes.

Is there any way to do this without the deadlock?

Regards

TOPICS
SDK
995
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 28, 2010 May 28, 2010

Is there any way to cancel the creation in the very early phase, avoiding the launch of the deleting command?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 28, 2010 May 28, 2010

This is one of the questions I had submitted for the developer summit, and the only one answered: in short - no.

All those notifications are only meant that you can schedule or perform followup activities. Setting the global error code is not expected in most of the cases, and as soon the next command is executed without that check and runs into a stuck error code, the command processor will perform its protective shutdown. It would be an enormous effort to clean up everything, and that is very unlikely.

There are plenty gestures / activities that can all lead to a new page item. You can try to intercept them with many approaches, and keep the UI consistent this way (disabled cursor rather than drag-create, and so forth). For the remainder, you'd implement an ICommandInterceptor (a potential heavyweight performance drain, so be careful!) and knock out the command there. Even then, some commands are processed as part of a larger sequence (place a text frame is maybe 10 commands) and suppressing such a command may also have implications.

Some other bottlenecks exist to support assignments, or you could eventually lock layers. It all depends on your specific intentions whether that is sufficient. Be prepared for much try and error.

Dirk

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 31, 2010 May 31, 2010

Hi Dirk

Thank you for the help.

I will try as you said.

Regards

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 30, 2010 Sep 30, 2010

I´m trying as Dirk said: with a command interceptor for kNewPageItemCmdBoss commands, but they cann´t be aborted by setting the global error code -a protective application shutdown occurs-.

If InterceptProcessCommand function returns kCmdHandled, aborts image boxes creation, lines creation, etc., but not text frames creation -InDesign hungs-. How can I abort a text frame creation command?

Regards

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 01, 2010 Oct 01, 2010
LATEST

I finally solved the problem. Textframe creation involves many commands, and can´t be aborted in the kNewPageItemCmdBoss phase. I used kNewFrameCmdBoss, and setting global error within this change works, without needing the command interceptor.

Regards

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines