Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Attaching an Object to a ShapeNode (Read 1481 times)
gringogordo
YaBB Newbies
*
Offline


Flowcharting is my life
baby

Posts: 12
Joined: Nov 13th, 2007
Attaching an Object to a ShapeNode
Nov 13th, 2007 at 8:46am
Print Post  
Hi,

I've just started playing with this so sorry if this is obvious...

I'm trying to associate objects (for sake of argument could be just an Id (int)) with the shapenodes on my diagram.  Is there a way to do this and not have it displayed as text. 

I guess as an example it could be a list of names with Ids so three shapenodes with the same shape might display John Smith, Joe Evans, Carol Jones while being associated with the (hidden) Ids 1, 2 and 3.

Sorry slight overkill on the explanation of the question there...!

I'm assuming it must be possible but I can't see any properties which I can use (changing the ShapeId not surprisingly changes the Id for all shapenodes associated with that shape)

Thanks...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Attaching an Object to a ShapeNode
Reply #1 - Nov 13th, 2007 at 8:57am
Print Post  
Hi,

You can create your own class that derives from ShapeNode and add an ID property to it. To let users create items of your type, set the view.Behavior to Custom and the view.CustomNodeType to typeof(your_node_class). For an example showing how to use custom types with FlowChart.NET, check the IconNodes sample project.

A more simple solution is to assign the id to the item's Tag property. An additional "bonus" is that you will be able to use the FindNode method of Diagram to search for nodes by their tag/ID.

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


Flowcharting is my life
baby

Posts: 12
Joined: Nov 13th, 2007
Re: Attaching an Object to a ShapeNode
Reply #2 - Nov 13th, 2007 at 9:39am
Print Post  
Woops should have looked for a tag property Embarrassed

Thanks for the help.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint