GetSelMarkupsOnly causes error
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
-
- User
- Posts: 8
- Joined: Fri Apr 12, 2013 5:56 am
GetSelMarkupsOnly causes error
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.
Code: ctrl.SetDocumentProperty(docID, "GetSelMarkupsOnly", "True", 0)
I also tried "true", """true""" and 1 instead of "True" without succes.
- Tracker Supp-Stefan
- Site Admin
- Posts: 17929
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: GetSelMarkupsOnly causes error
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
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
-
- User
- Posts: 8
- Joined: Fri Apr 12, 2013 5:56 am
Re: GetSelMarkupsOnly causes error
Hello Stefan,
Strange...
ctrl.SetDocumentProperty(docID, "GetSelMarkups", "true") still returns "Invalid argument"
Strange...
ctrl.SetDocumentProperty(docID, "GetSelMarkups", "true") still returns "Invalid argument"
- Tracker Supp-Stefan
- Site Admin
- Posts: 17929
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: GetSelMarkupsOnly causes error
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
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
-
- User
- Posts: 8
- Joined: Fri Apr 12, 2013 5:56 am
Re: GetSelMarkupsOnly causes error
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
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
- Tracker Supp-Stefan
- Site Admin
- Posts: 17929
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: GetSelMarkupsOnly causes error
Thanks Chris,
One of my colleagues will review this shortly and we will post back in this topic any advise we have.
Best,
Stefan
One of my colleagues will review this shortly and we will post back in this topic any advise we have.
Best,
Stefan
-
- User
- Posts: 205
- Joined: Fri May 18, 2012 8:41 pm
Re: GetSelMarkupsOnly causes error
Hi chrisbouwman,
Thank you for your post.
Please use the property "GetSelMarkupsOnly" and "GetSelectedAnnot" in the following way.
I verified the code above works.
Also, the property "GetSelMarkups" is not currently available
Thanks.
Sincerely,
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);
//...
}
}
}
Also, the property "GetSelMarkups" is not currently available
Thanks.
Sincerely,
-
- User
- Posts: 8
- Joined: Fri Apr 12, 2013 5:56 am
Re: GetSelMarkupsOnly causes error
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,
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,
- Tracker Supp-Stefan
- Site Admin
- Posts: 17929
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: GetSelMarkupsOnly causes error
Looking forward to the results of your tests chrisbouwman!
Best,
Stefan
Best,
Stefan
-
- User
- Posts: 205
- Joined: Fri May 18, 2012 8:41 pm
Re: GetSelMarkupsOnly causes error
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: https://www.pdf-xchange.com/product ... ctivex-sdk.
Thanks.
Sincerely,
Please make sure you are using the latest build which is 2.5.210.0.
You can download the latest build from here: https://www.pdf-xchange.com/product ... ctivex-sdk.
Thanks.
Sincerely,
-
- User
- Posts: 8
- Joined: Fri Apr 12, 2013 5:56 am
Re: GetSelMarkupsOnly causes error
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({...}".
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({...}".
-
- User
- Posts: 205
- Joined: Fri May 18, 2012 8:41 pm
Re: GetSelMarkupsOnly causes error
Hi chrisbouwman,
Thank you for your post.
Thanks.
Sincerely,
Thank you for your post.
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.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.
Thanks.
Sincerely,
-
- User
- Posts: 8
- Joined: Fri Apr 12, 2013 5:56 am
Re: GetSelMarkupsOnly causes error
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
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
- Paul - Tracker Supp
- Site Admin
- Posts: 6900
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
- Contact:
Re: GetSelMarkupsOnly causes error
That's great to hear Chris.
I'll make sure Nico hears.
I'll make sure Nico hears.
Best regards
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com