How to detect if Ruler is showed?

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

How to detect if Ruler is showed?

Post by Dorwol »

Hi,

short question.

For example with "36522" I can show Rulers, with "36520" I can show grid... adn so on...

But how can I get the state? I mean how can I detect, if the ruler is showed?

Is there any GetState(...) function available?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to detect if Ruler is showed?

Post by Vasyl - PDF-XChange »

Hi, Dorwol.

Use:

Code: Select all

int showRulers = 0;
pdfViewer.GetProperty("Measurement.Rulers.Visible", out showRulers, 0);
HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to detect if Ruler is showed?

Post by Dorwol »

THX! :mrgreen:
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: How to detect if Ruler is showed?

Post by Stefan - PDF-XChange »

:)
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to detect if Ruler is showed?

Post by Dorwol »

Sorry, but is there any documentation about this available?

In the Help-PDF I can not find something about this and it look like a little "BlackBox" for me.

Now I have the same problem with HighlightTextTool, CrossOutTextTool, ...

I have already try out "Commenting.Underline.visible" and also "Tools.Underline.visible"...

...but all without any success! :|
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: How to detect if Ruler is showed?

Post by Stefan - PDF-XChange »

Hello Dorwol,

The rulers could be visible or not, but the HighlightTextTool and CrossOutTextTool can be selected (and active) or not. They can't be "visible" in the same way as the rulers.

Have you tried the Tools.Active - which should return the ID of the currently selected tool - you can find the IDs in the table under section 2.2.3.63 Tools in the Viewer AX Manual.

Best,
Stefan
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to detect if Ruler is showed?

Post by Dorwol »

Tracker Supp-Stefan wrote:Have you tried the Tools.Active - which should return the ID of the currently selected tool - you can find the IDs in the table under section 2.2.3.63 Tools in the Viewer AX Manual.
Yes, I know "Tools.Active".

But the result is a number and not a String value.

The problem is, for "KeepSelect" I need a name (like "Tools.Highlight" or "Tool.StrikeOut") of the tool, for "ExecuteCommand" I need a different name (like "HighlightTextTool" or "CrossOutTextTool") and now, I need also a number value for checking?

That's really hard and not well good :|
This szenario makes my source good bad for reading/understanding...!

So my question is now, is there a way to KeepSelect and ExecuteCommand with the same number like for Tools.Active?

For example, something like this (pseudo-code):
SetProperty "Tools.[33222].KeepSelected", 1
DoVerb , "", "ExecuteCommand", 33222

? GetProperty("Tools.Active") ...result is... = 33222


---------> That would be a uniform code!
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: How to detect if Ruler is showed?

Post by Stefan - PDF-XChange »

Hello Dorwool,

I haven't tried that myself, but it shouldn't be a problem to use the tool ID all the time

//pseudocode
SetProperty("Tools.Active", 33222, 0);
SetProperty("Tools.[33222].KeepSelected", 1, 0);

And then calling
GetProperty ("Tools.Active") should also return to you the expected result -> 33222

Best,
Stefan
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to detect if Ruler is showed?

Post by Dorwol »

> SetProperty("Tools.Active", 33222, 0);
Works wonderful!!!

> SetProperty("Tools.[33222].KeepSelected", 1, 0);
Doesn't work. I've also tried ...Tools.[#33222].KeepSelected....
Any hint? We are short before the goal!
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: How to detect if Ruler is showed?

Post by Stefan - PDF-XChange »

Hello Dorwool,

I am afraid that you will need to use the tool name when you want it to be kept selected.

Best,
Stefan
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to detect if Ruler is showed?

Post by Dorwol »

Tracker Supp-Stefan wrote:I am afraid that you will need to use the tool name when you want it to be kept selected.
Oh, that's bad.

Is there a function to get the "Tool Name" from an ID?

Like...

? GiveToolNameFromID(33222) ...result is... = "Underline"

If yes, I have all what I do need.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to detect if Ruler is showed?

Post by Vasyl - PDF-XChange »

Hi, Dorwol.

You have:

Code: Select all

pdfViewer.SetProperty("Tools.Active", 33222, 0); // 33222 - is "UnderlineTextTool" UI-command
some equivalents for this:

Code: Select all

pdfViewer.SetProperty("Tools.Active", "Underline", 0);
pdfViewer.SetProperty("Tools.Active", "UnderlineText", 0);
pdfViewer.SetProperty("Tools.Active", "UnderlineTextTool", 0);
and for get active tool ID:

Code: Select all

int activeToolID = 0;
pdfViewer.SetProperty("Tools.Active", out activeToolID, 0);
or:
string activeToolName; 
pdfViewer.SetProperty("Tools.Active", out activeToolName, PXCVA_GetNamed); // will return the "Underline" string in case above
And your:
"Tools.[33222].KeepSelected"
"Tools.[#33222].KeepSelected"
- are somewhat wrong. The correct one is:
"Tools.Underline.KeepSelected"

HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to detect if Ruler is showed?

Post by Dorwol »

Vasyl-Tracker Dev Team wrote:- are some wrong. The correct:
"Tools[#33222].KeepSelected"
Thank you, but believe me. It doesn't work! :? :?:
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: How to detect if Ruler is showed?

Post by Stefan - PDF-XChange »

Hello Dorwool,

Vasyl corrected this in his post - you were just too fast to read the initial version. :)
Unfortunately Tools is not an array object - so yes Tools[#33222] is indeed incorrect and will not work.

The only proper way is to use Tools.Underline.KeepSelected in this particular case and change the tool name accordingly for other tools.

The consistent solution would be what Vasyl offered - with using the actual tool names and not the IDs.

Best,
Stefan
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to detect if Ruler is showed?

Post by Dorwol »

> Vasyl corrected this in his post - you were just too fast to read the initial version
Oh yes, I see.

Thank you!
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7362
Joined: Wed Mar 25, 2009 10:37 pm

Re: How to detect if Ruler is showed?

Post by Paul - PDF-XChange »

:)
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com