Change Link annotation Action (Insert does not work how the help states)  SOLVED

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Change Link annotation Action (Insert does not work how the help states)

Post by zarkogajic »

Hi Support,

I have a Link type annotation with 3 actions: JavaScript (index 0), Launch (index 1) and Goto (index 2).

I need to change the Launch action to GoToR.

I see no way of changing the action type (is there?), so I thought to use:

Code: Select all

link's IPXC_ActionsList.AddGoToR -> this returns a new action and adds it as 4th action (index of action: 3)
link's IPXC_ActionsList.Remove (1) -> that is the position of the Launch action
link's IPXC_ActionsList.Insert (1, gotor action from [1]) -> so to insert/move GoToR to where Launch was
This ends up with 2 GotoR actions. Seems that Insert does not simply move the action to a new position but actually adds a cloned action. The help states that Insert: "Inserts an existing action..." (so not creates a new one).

Is this a bug or by design?


p.s.
To "fix" I'm adding a new action into a newly created IPXC_ActionsList (just to be a dummy container) and then Insert (above) works as expected (because Add is not used on the original list).

-žarko
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Change Link annotation Action (Insert does not work how the help states)

Post by zarkogajic »

Support?

ž
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Change Link annotation Action (Insert does not work how the help states)

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

The insert method simply does the insertion of the IPXC_Action into the needed position. The AddGoToR method adds new action into the end of the list. Thus, when you pass the action's object of the newly inserted gotoR action to the Insert method, it simply makes a copy of the data, without touching the original data.
Basically, to do what you want, you should remove the gotoR action from the last position - then it will be a pseudo move operation, not an insert one.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Change Link annotation Action (Insert does not work how the help states)  SOLVED

Post by zarkogajic »

Hi Alex,

Thanks for the info.

As said, I'm using a dummy IPXC_ActionsList as container for the Insert. Works as needed :)

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Change Link annotation Action (Insert does not work how the help states)

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply