Moderators:TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
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.
I want to hide the "General" properties of all annotation element from the properties pane. I have got the code that works, as shown below, however what I want is for this code to be run automatically when a new annotation element is placed, selected etc. Obviously I would need to put this in an event to fire my code, however I am unsure of the event to use??
Public Sub disableProperties()
Dim nID As Integer = Me.docPreview.Inst.Str2ID("propertiesView")
Dim view As PDFXEdit.IPXV_View = Me.docPreview.Frame.View.Panes.Active(nID)
If view IsNot Nothing Then
Dim outPtr As IntPtr
view.Obj.QueryImpl(GetType(PDFXEdit.IUIX_PropList).GUID, Nothing, outPtr)
Dim propList As PDFXEdit.IUIX_PropList = DirectCast(System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(outPtr), PDFXEdit.IUIX_PropList)
If propList IsNot Nothing Then
Dim listPtr As IntPtr
propList.Obj.QueryImpl(GetType(PDFXEdit.IUIX_List).GUID, Nothing, listPtr)
Dim list As PDFXEdit.IUIX_List = DirectCast(System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(listPtr), PDFXEdit.IUIX_List)
If list IsNot Nothing Then
'Removes general properties
list.RemoveGroups(0, 1)
End If
End If
End If
End Sub
Current event code within my application that maybe I could use?
Public Sub OnEvent(pSender As PDFXEdit.IUIX_Obj, pEvent As PDFXEdit.IUIX_Event) Implements PDFXEdit.IUIX_ObjImpl.OnEvent
If pEvent.Code = CInt(&H204) Then
Dim pt As PDFXEdit.tagPOINT
pt.x = pEvent.Pos.x
pt.y = pEvent.Pos.y
Dim screenPt As PDFXEdit.tagPOINT
Dim nHitTestCode As Integer = 0
Dim annot As PDFXEdit.IPXC_Annotation = Parent.docPreview.Doc.ActiveView.PagesView.GetAnnotFromPt(pt, nHitTestCode)
If annot IsNot Nothing Then
Dim linkAnnotType As UInteger = Parent.pxsInst.StrToAtom("Link")
If annot.Type = linkAnnotType Then
pEvent.Handled = True
End If
Else
pSender.ClientPtToScreen(pt, screenPt)
Parent.RadialMenu1.ShowPopup(New Point(screenPt.x, screenPt.y))
End If
ElseIf pEvent.Code = CInt(PDFXEdit.UIX_EventCodes.e_BeforeDestroy) Then
Dispose()
ElseIf pEvent.Code = CInt(PDFXEdit.UIX_EventCodes.e_Last) Then
Dispose()
End If
End Sub
The correct event to use in this case is https://sdkhelp.pdf-xchange.com/vie ... s_inserted
Please look at the FullDemo application on how to use the Control's events. And also, do not forget to register/unregister them.
I've looked in the FullDemo and have found the following section that refers to IPXV_AnnotsEvent however if I uncomment the code in the FullDemo is errors??
I still cannot get this to work I have added my code to fire when the op.annots.addNew event is triggered however it still does not hide the properties. Is is as if another event is firing that I need to capture, maybe properties pane update event or something?
ElseIf e.nEventID = nIDS(CInt(IDS.e_operExecuted)) Then
Try
Dim oper As PDFXEdit.IOperation = DirectCast(e.pFrom, PDFXEdit.IOperation)
Dim input As PDFXEdit.ICabNode = oper.Params.Root("Input")
Dim commands As String = Me.docPreview.Inst.ID2Str(oper.ID)
Console.WriteLine("eExecuted: " & commands)
If oper.ID = Me.docPreview.Inst.Str2ID("op.annots.addNew", False) Then
disableProperties()
End If
I've read the problem again and I think that the correct event would be the https://sdkhelp.pdf-xchange.com/vie ... on_changed event. If you catch it - get the ActiveSel from the document and see whether it's an IPXV_AnnotSelection. If so, call your code.
ElseIf e.nEventID = nIDS(CInt(IDS.e_docSelection_changed)) Then
Try
Dim annotsSelected As PDFXEdit.IPXV_AnnotSelection = DirectCast(Me.docPreview.Doc.ActiveSel, PDFXEdit.IPXV_AnnotSelection)
If annotsSelected IsNot Nothing Then
disableProperties()
End If
Catch ex As Exception
e.pEvent.Result = 1
e.pEvent.Handled = True
End Try
Yes I am catching the break point there and the disableProperties code does work as I have just added a button to fire the method and it works. It must be firing some kind of update properties pane event after the e.docSelection.changed event.
I don's see any event that is being fired after the properties update (and they do update after the selection change event). So basically that means that you won't be able to do this with the events alone.