Disable properties on annotaion placement or selection
Posted: Thu Jul 20, 2017 9:46 am
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??
Current event code within my application that maybe I could use?
Thanks in advance
Simon
Code: Select all
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
Code: Select all
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
Simon