GetSelMarkupsOnly causes error

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

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

Post Reply
chrisbouwman
User
Posts: 8
Joined: Fri Apr 12, 2013 5:56 am

GetSelMarkupsOnly causes error

Post by chrisbouwman » Tue Apr 23, 2013 11:07 am

When I try to set GetSelMarkupsOnly true, the control returns "Invalid argument".
Code: ctrl.SetDocumentProperty(docID, "GetSelMarkupsOnly", "True", 0)

I also tried "true", """true""" and 1 instead of "True" without succes.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 14037
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: GetSelMarkupsOnly causes error

Post by Tracker Supp-Stefan » Tue Apr 23, 2013 11:36 am

Hello chrisbouwman,

Can you try setting
ctrl.SetDocumentProperty(docID, "GetSelMarkups", "true");
Instead and see if that will work.

I noticed both in the Viewer Manual and am not sure if GetSelMarkupsOnly is not a deprecated name that has not been properly updated in the manual.

Best,
Stefan

chrisbouwman
User
Posts: 8
Joined: Fri Apr 12, 2013 5:56 am

Re: GetSelMarkupsOnly causes error

Post by chrisbouwman » Tue Apr 23, 2013 11:56 am

Hello Stefan,

Strange...
ctrl.SetDocumentProperty(docID, "GetSelMarkups", "true") still returns "Invalid argument"

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 14037
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: GetSelMarkupsOnly causes error

Post by Tracker Supp-Stefan » Tue Apr 23, 2013 12:05 pm

Hi chrisbouwman,

Thanks for trying that.
Can we get a bit bigger snippet of your code as I'd like to pass this to my colleagues in the dev team and the more info they have the easier it would be to fix your problem. Please also make sure no licensing info is visible!

Best,
Stefan

chrisbouwman
User
Posts: 8
Joined: Fri Apr 12, 2013 5:56 am

Re: GetSelMarkupsOnly causes error

Post by chrisbouwman » Tue Apr 23, 2013 1:07 pm

Hello Stefan,

This is the Sub that causes trouble:
Public Sub PDFXViewer_OnEvent(ByVal sender As System.Object, ByVal e As AxPDFXCviewAxLib._IPDFXCviewEvents_OnEventEvent)
If e.type = PDFXCviewAxLib.PXCVA_EventTypes.PXCVA_OnNamedNotify Then
Dim AnnotIsSelected As Boolean = False
Dim docID As Integer = 0
sender.getActiveDocument(docID)

If docID > 0 Then
sender.SetProperty("Notifications.Selection.Filter", -1, 0)
Dim selectedAnnotPageAndIndexOnPage As Object = Nothing
Try
sender.SetDocumentProperty(docID, "GetSelMarkups", "true")
sender.DoDocumentVerb(docID, "", "GetSelectedAnnot", "", selectedAnnotPageAndIndexOnPage, 0)
If selectedAnnotPageAndIndexOnPage.length > 0 And selectedAnnotPageAndIndexOnPage(0) >= 0 Then
AnnotIsSelected = True
End If
Catch ex As Exception
ShowErrorMessage(sender, ex)
End Try
End If
End If
End Sub

Kind regards,
Chris

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 14037
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: GetSelMarkupsOnly causes error

Post by Tracker Supp-Stefan » Tue Apr 23, 2013 1:40 pm

Thanks Chris,

One of my colleagues will review this shortly and we will post back in this topic any advise we have.

Best,
Stefan

Nico - Tracker Supp
User
Posts: 220
Joined: Fri May 18, 2012 8:41 pm

Re: GetSelMarkupsOnly causes error

Post by Nico - Tracker Supp » Fri Apr 26, 2013 5:21 am

Hi chrisbouwman,

Thank you for your post.
Please use the property "GetSelMarkupsOnly" and "GetSelectedAnnot" in the following way.

Code: Select all

//pseudo-code follows

//1. Register notifications
SetProperty("Notifications.Selection.Filter", "All", 0);

//2. Set behavior of GetSelectedAnnot 
SetDocumentProperty(docID, "GetSelMarkupsOnly", 1, 0);

//3. Event Handler
function OnEvent(Type, Name, ....)
{
      if (Type == PXCVA_OnNamedNotify)
	{		
		if(Name == "Notifications.Selection")
		{		
                        //...
			DoDocumentVerb(docID, NULL,"GetSelectedAnnot", NULL, &vDataOut, 0);
                        //...			
		}
	}
}
I verified the code above works.
Also, the property "GetSelMarkups" is not currently available
Thanks.

Sincerely,

chrisbouwman
User
Posts: 8
Joined: Fri Apr 12, 2013 5:56 am

Re: GetSelMarkupsOnly causes error

Post by chrisbouwman » Fri Apr 26, 2013 1:18 pm

Hi Nico,

This code still generates an error. I'll set up a new VB project with just the necessary code and see if it works there.

When I have result I'll post them here.

Kind regards,

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 14037
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: GetSelMarkupsOnly causes error

Post by Tracker Supp-Stefan » Fri Apr 26, 2013 1:35 pm

Looking forward to the results of your tests chrisbouwman!

Best,
Stefan

Nico - Tracker Supp
User
Posts: 220
Joined: Fri May 18, 2012 8:41 pm

Re: GetSelMarkupsOnly causes error

Post by Nico - Tracker Supp » Fri Apr 26, 2013 8:41 pm

Hi chrisbouwman,

Please make sure you are using the latest build which is 2.5.210.0.
You can download the latest build from here: http://www.tracker-software.com/product ... ctivex-sdk.
Thanks.
Sincerely,

chrisbouwman
User
Posts: 8
Joined: Fri Apr 12, 2013 5:56 am

Re: GetSelMarkupsOnly causes error

Post by chrisbouwman » Mon Apr 29, 2013 7:38 am

Hello Nico, Stefan,

Latest build did the trick. Thanks for the tip.

Still, there is one strange behaviour. Often when I select an annotation, the name of the event fired is "Global::FocusGained" instead of "Notifications.Selection". When I remove the condition "If e.name = "Notifications.Selection"" my code works fine, but its not the nicest way.

The annotations are shown using JavaScripts "this.importAnFDF" and "var annot = this.addAnnot({...}".

Nico - Tracker Supp
User
Posts: 220
Joined: Fri May 18, 2012 8:41 pm

Re: GetSelMarkupsOnly causes error

Post by Nico - Tracker Supp » Mon Apr 29, 2013 4:30 pm

Hi chrisbouwman,

Thank you for your post.
Often when I select an annotation, the name of the event fired is "Global::FocusGained" instead of "Notifications.Selection". When I remove the condition "If e.name = "Notifications.Selection"" my code works fine, but its not the nicest way.
The "Global::FocusGained" event is triggered when a control or any window from a control gains focus or already has the input focus (see Viewer ActiveX Manual, section 2.2.4.1), therefore anytime when you select an annotation, this event will be fired before "Notifications.Selection". In addition, if you remove the condition "If e.name = "Notifications.Selection"", you cannot detect when the "Notifications.Selection" event happens, which was your goal (I believe), therefore you don't have to remove it. If you print all the events that are detected at the event handler function, you will be able to see this behavior.
Thanks.

Sincerely,

chrisbouwman
User
Posts: 8
Joined: Fri Apr 12, 2013 5:56 am

Re: GetSelMarkupsOnly causes error

Post by chrisbouwman » Wed May 01, 2013 5:55 am

Hello Nico,

Thanks for your answer. It's the behaviour I expected but that did not occur. Now I've put the line SetProperty("Notifications.Selection.Filter", "All", 0) after other SetProperty lines in my code and it works.

Thank you for you're support!

Kind regards,
Chris

User avatar
Paul - Tracker Supp
Site Admin
Posts: 4999
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: GetSelMarkupsOnly causes error

Post by Paul - Tracker Supp » Wed May 01, 2013 5:59 am

That's great to hear Chris.

I'll make sure Nico hears.

:-)
_________________
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com

Post Reply