visEvtCodeShapeParentChange on Drop

W

WizZerD

Hi, I have added an event for visEvtCodeShapeParentChange this works fine for shapes that are already on the page
When I drop a new shape, the event doesn't fire .. Anyone know why

Implements Visio.IVisEventPro

'Declare visEvtAdd as a 2-byte valu
'to avoid a run-time overflow erro
Private Const visEvtAdd% = &H800

Private Function IVisEventProc_VisEventProc(
ByVal nEventCode As Integer,
ByVal pSourceObj As Object,
ByVal nEventID As Long,
ByVal nEventSeqNum As Long,
ByVal pSubjectObj As Object,
ByVal vMoreInfo As Variant) As Varian

Dim strMessage As Strin

'Find out which event fire
Select Case nEventCod
Case visEvtCodeShapeDelet
strMessage = "ShapesDeleted(" & nEventCode & ")
Case visEvtCodeShapeParentChang
strMessage = "ShapeParentChanged " & vbCrLf &
"Object:" & pSubjectObj.Name & vbCrLf &
"New Parent:" & pSubjectObj.Paren
If Left(pSubjectObj.Parent, 15) = "WLI Application" The
addFunctionToApp pSubjectObj, CStr(pSubjectObj.Parent
Els
MsgBox (pSubjectObj.Parent
End I
Case Els
strMessage = "Other (" & nEventCode & ")
End Selec

'Display the event name and the event cod
'MsgBox (strMessage

End Functio

Private Sub addFunctionToApp(iFunction As Object, iApp As String
MsgBox ("New Parent for " & iFunction.Name & " = " & iApp
End Sub
 
M

Markus Breugst

Hello,

as far as I know, the ParentChanged event is fired if you group or ungroup a
shape. If you drop a new shape onto a page, you can use the ShapeAdded event
(code: -32704) or the SelectionAdded event (code: visEvtCodeSelAdded).

Best regards,
Markus

WizZerD said:
Hi, I have added an event for visEvtCodeShapeParentChange this works fine
for shapes that are already on the page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top