Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Identifying selected node in TabbedDiagramView (Read 3025 times)
justinp
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Dec 11th, 2015
Identifying selected node in TabbedDiagramView
Dec 11th, 2015 at 6:37pm
Print Post  
How do I get the node object via an event on a DiagramPage that's in a TabbedDiagramView when the node is selected?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Identifying selected node in TabbedDiagramView
Reply #1 - Dec 11th, 2015 at 7:04pm
Print Post  
If you don't need selection handled differently for different pages, handle DiagramDocument.NodeSelected to get the event raised for any page in the document. Handle DiagramPage.NodeSelected if you need it only for some distinct page.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
justinp
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Dec 11th, 2015
Re: Identifying selected node in TabbedDiagramView
Reply #2 - Dec 13th, 2015 at 8:53pm
Print Post  
Thanks, but I can't seem to get the event to trigger. Could you post a code snippet for the event handler please?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Identifying selected node in TabbedDiagramView
Reply #3 - Dec 14th, 2015 at 8:44am
Print Post  
Check the sample project here:
https://mindfusion.eu/_samples/TabbedView_NodeSelected.zip

The event handlers just add a string to ListBox control:
Code
Select All
tabbedDiagramView.Document.NodeSelected +=
	(s, e) => lbLog.Items.Add("DiagramDocument.NodeSelected");
tabbedDiagramView.Document.Pages[0].NodeSelected +=
	(s, e) => lbLog.Items.Add("DiagramPage.NodeSelected"); 



If you draw and select nodes on first page you should see both messages logged. If you open a second page and select nodes there, the log will show only document's message, unless you also attach handler to new DiagramPages (e.g. from TabbedDiagramView.PageAdded event).

If you have already attached handlers but can't get them to raise, check if your project doesn't replace the DiagramDocument/Page objects with new instances at some point without attaching handlers to them.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint