Page 1 of 1

Change active tool

Posted: Wed Sep 05, 2018 12:31 pm
by MartinCS
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

Re: Change active tool

Posted: Wed Sep 05, 2018 12:35 pm
by Sasha - Tracker Dev Team
Hello Martin,

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

Cheers,
Alex

Re: Change active tool

Posted: Wed Sep 05, 2018 12:54 pm
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

Re: Change active tool

Posted: Wed Sep 05, 2018 1:13 pm
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

Re: Change active tool  SOLVED

Posted: Wed Sep 05, 2018 1:22 pm
by MartinCS
Hi Alex,

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

:)

Cheers
Martin

Re: Change active tool

Posted: Wed Sep 05, 2018 2:11 pm
by Sasha - Tracker Dev Team
:)