Page 1 of 1

prevent annot box

Posted: Tue Sep 18, 2018 10:17 am
by jusWest
Hello!

Is there a way, event or otherwise, to disable the opening of a annotation window when we use the "cmd.tool.annot.highlight" tool?

Which event needs to be used to prevent this?

Tried this:

Code: Select all

            
            else if (e.nEventID == nIDS[(int)IDS.e_annots_inserted])
            {
               e.pEvent.Handled = true;
               e.pEvent.Result = 1;
            }
But it did not work

Re: prevent annot box

Posted: Tue Sep 18, 2018 11:29 am
by Sasha - Tracker Dev Team
Hello jusWest,

Well, you can disable the command itself by using the IUIX_CmdManager that you can get from the IUIX_Inst:
https://sdkhelp.pdf-xchange.com/vi ... CmdManager
Or you can catch the https://sdkhelp.pdf-xchange.com/vi ... oreExecute operation, check if it's an op.annots.addNew operation and then break it if it's the input has IPXC_Annotation of the Highlight type.

Cheers,
Alex

Re: prevent annot box

Posted: Tue Sep 18, 2018 12:14 pm
by jusWest
Thanks!

If i do this:

Code: Select all


            if (e.nEventID == nIDS[(int)IDS.e_operBeforeExecute])
            {
                IOperation oper = (IOperation)e.pFrom;
                opModifyFields = pdfCtl.Inst.Str2ID("op.annots.addNew", false);
                if (opModifyFields == oper.ID)
                {
                    e.pEvent.Handled = true;
                    e.pEvent.Result = 1;
                }

            }
It also disables the higlighting of the text in the pdf document, but i only want to prevent the double click on the highlightet text so that we do not get this window:

Re: prevent annot box

Posted: Wed Sep 19, 2018 6:52 am
by jusWest
Anything I can do to just disable the opening of the higlight editor window, and still be able to highlight text in the document?

Re: prevent annot box

Posted: Wed Sep 19, 2018 9:16 am
by Sasha - Tracker Dev Team
Hello jusWest,

That is called the popup note - I thought you needed to disable the highlight itself.
In this case, you will have to check two operations - add annotation and modify annotation. If first case, you will have to check the operation input for the StrToAtom("Popup") typed annotations and break if such are in the input. In the second case, the modify annotations operation will have a OpModifyAnnot_Opened flag in it's "Mask" option and the "Opened" will be set to true. In this case, you will also have to break.

Cheers,
Alex

Re: prevent annot box

Posted: Thu Sep 20, 2018 12:19 pm
by jusWest
thanks, the terminilogy is sometimes lost on me :O, that is also why it is somethimes difficult to get hits on search, because I use the wrong word for things...

I can catch the addnew operation in the e_operBeforeExecute event,
but after that I'm not sure how to do what you describe in you latest reply.

Can you help?

Re: prevent annot box

Posted: Thu Sep 20, 2018 12:50 pm
by Sasha - Tracker Dev Team
Hello justWest,

You will have to extract the input from it. For that, you will have to get the "Input" CabNode (https://sdkhelp.pdf-xchange.com/vi ... ots_addNew) and then (as it's an array) get every element and cast it to the IPXC_Annotation interface:

Code: Select all

PDFXEdit.ICabNode input = oper.Params.Root["Input"];
PDFXEdit.IPXC_Annotation annot = input[0].v as PDFXEdit.IPXC_Annotation;
Cheers,
Alex