Change active tool  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, 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
User avatar
MartinCS
User
Posts: 153
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Change active tool

Post by MartinCS »

Hello Tracker Team,

I know there is an objected for the active tool of an opened pdf document (IPXV_Document):

https://sdkhelp.pdf-xchange.com/vi ... ActiveTool
https://sdkhelp.pdf-xchange.com/view/PXV:IPXV_Tool

I would like to change the current/active tool to the tool "cmd.zoomIn". Could you provide a short code snippet on how to that programmatically?

Thank you for your help!

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

Re: Change active tool

Post by Sasha - Tracker Dev Team »

Hello Martin,

Hope this helps:
https://sdkhelp.pdf-xchange.com/vi ... st_GetTool

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
MartinCS
User
Posts: 153
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Change active tool

Post by MartinCS »

Hi Alex,

I'm closer to the solution. Using the line of code:

Code: Select all

var tool = PxvInst.GetTool(PxvInst.Str2ID("cmd.zoomIn"));
I'm not able to get the desired tool and the object is null.

Code: Select all

PxvInst.Str2ID("cmd.zoomIn")
gives me the id value 3864.

Am I using the wrong string value for the desired tool to set "cmd.zoomIn"?

I also tried this solution viewtopic.php?f=66&t=29809&p=119377&hil ... ol#p119377.

Code: Select all

pdfCtl.Doc.ActivateTool(PxvInst.Str2ID("cmd.zoomIn"));
But it gives me a value out of expected bounds exception.

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

Re: Change active tool

Post by Sasha - Tracker Dev Team »

Hello Martin,

You are specifying the name of the command, not the name of the tool.
Here's an old topic of yours, where you were also working with tools:
viewtopic.php?f=66&t=24223
As for this topic, the ID would be "tool.zoom"

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
MartinCS
User
Posts: 153
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Change active tool  SOLVED

Post by MartinCS »

Hi Alex,

thank you for the link and the correct string Id value. It's working now.

:)

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

Re: Change active tool

Post by Sasha - Tracker Dev Team »

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