Need C# Help in BrowserPanesEvents

Need C# Help in BrowserPanesEvents

Anonymous
Not applicable
507 Views
3 Replies
Message 1 of 4

Need C# Help in BrowserPanesEvents

Anonymous
Not applicable
I would appreciate any sample code on BrowserPanesEvents in C#.
VB.Net would probably be ok too.
Thanks,
Luc
0 Likes
508 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Here is what I wrote so far:

private Inventor.BrowserPanesSink_OnBrowserNodeActivateEventHandler oBrowserNodeActivateHandler;


public void OnBrowserNodeActivate( Object BrowserNodeDefinition, NameValueMap Context, out HandlingCodeEnum kHandlingCode)
{
kHandlingCode = HandlingCodeEnum.kEventNotHandled;
}

...
oPanes= oDoc.BrowserPanes;
if (oPanes!=null)
{
oBrowserNodeActivateHandler = new Inventor.BrowserPanesSink_OnBrowserNodeActivateEventHandler(OnBrowserNodeActivate);
oPanes.BrowserPanesEvents.OnBrowserNodeActivate += oBrowserNodeActivateHandler;

...
when I put a break point on oBrowserNodeActivateHandler, it never hits when I click on my browser nodes.

I must be missing something trivial.
thanks,
Luc
0 Likes
Message 3 of 4

Anonymous
Not applicable
Ok, it works.
I did not know that to activate a node you have to double click it!

As I implemented the other events it became obvious they were working and by double clicking I finally hit my breakpoint!

On to the next hurdle...

Luc
0 Likes
Message 4 of 4

Anonymous
Not applicable

I've got the problem with handling inventor events in standalone VB.Net application.

While OnSaveDocument, OnActivateDocument, ... work fine, the events for BrowserPanes don't.

 

Here is my code:

 

Public Class Form1

 

Public invApp As Inventor.Application
Public appEvents As Inventor.ApplicationEvents
Public  bPanesEvents As Inventor.BrowserPanesEvents

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call Inventor_connection()

' -----------------------------------------------------------

appEvents = invApp.ApplicationEvents

AddHandler appEvents.OnSaveDocument, AddressOf Me.appEvents_OnSaveDocument
AddHandler appEvents.OnActivateDocument, AddressOf Me.appEvents_OnActivateDocument

' ----------------------------------------------------------
activeDoc = invApp.ActiveDocument
bPanesEvents = activeDoc.BrowserPanes.BrowserPanesEvents

AddHandler bPanesEvents.OnBrowserNodeActivate, AddressOf Me.bPanesEvents_OnBrowserNodeActivated


End Sub

 

Public Sub appEvents_OnSaveDocument(ByVal docObject As Inventor._Document, _
ByVal b_or_a As Inventor.EventTimingEnum, _
ByVal context As Inventor.NameValueMap, _
ByRef handlingCode As Inventor.HandlingCodeEnum)
If b_or_a = EventTimingEnum.kAfter Then
MsgBox("Document saved!!")
End If
End Sub


Public Sub appEvents_OnActivateDocument(ByVal docObject As Inventor._Document, _
ByVal b_or_a As Inventor.EventTimingEnum, _
ByVal context As Inventor.NameValueMap, _
ByRef handlingCode As Inventor.HandlingCodeEnum)
If b_or_a = EventTimingEnum.kAfter Then
MsgBox("Document activated!!")
End If
End Sub

 

Public Sub bPanesEvents_OnBrowserNodeActivated(ByVal browserNodeDef As Object, _
ByVal context As Inventor.NameValueMap, _
ByRef handlingCode As Inventor.HandlingCodeEnum)
MsgBox("Browser node activated!!")
End Sub

 

End Class

 

Please help me.

 

Thx!

0 Likes