Change active tool  SOLVED

PDF-XChange Editor SDK for Developers

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

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: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Change active tool

Post by MartinCS » Wed Sep 05, 2018 12:31 pm

Hello Tracker Team,

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

https://sdkhelp.tracker-software.com/vi ... ActiveTool
https://sdkhelp.tracker-software.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

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

Re: Change active tool

Post by Sasha - Tracker Dev Team » Wed Sep 05, 2018 12:35 pm

Hello Martin,

Hope this helps:
https://sdkhelp.tracker-software.com/vi ... st_GetTool

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Change active tool

Post by MartinCS » Wed Sep 05, 2018 12:54 pm

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

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

Re: Change active tool

Post by Sasha - Tracker Dev Team » Wed Sep 05, 2018 1:13 pm

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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
MartinCS
User
Posts: 152
Joined: Thu Apr 07, 2011 10:01 am
Contact:

Re: Change active tool  SOLVED

Post by MartinCS » Wed Sep 05, 2018 1:22 pm

Hi Alex,

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

:)

Cheers
Martin

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

Re: Change active tool

Post by Sasha - Tracker Dev Team » Wed Sep 05, 2018 2:11 pm

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply