Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How can I save a my own derived node class? (Read 1341 times)
brianh
YaBB Newbies
*
Offline



Posts: 30
Joined: Jul 1st, 2008
How can I save a my own derived node class?
Jul 10th, 2008 at 4:03pm
Print Post  
Hi,

I have derived my own DiagramNode class from TableNode, and now I need to be able to save and restore these nodes along with the diagram.

I found a thread on this forum discussing the problem and a possible solution, but that's a few years old and refers to an earlier version of the FlowChart:

http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_disc;action=display;num=113111092...

The solution involved overriding GetClassId() and createObj(int clsid), but GetClassId() does not appear to be overridable, and I can't find createObj() anywhere! :S

When I save my diagram to a stream it calls SaveTo(), but does NOT call LoadFrom() when loading, I guess this is because the object that it's creating is a TableNode and NOT my derived class. Sad

Is there a modern solution to this problem?

Thanks.

Brian
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How can I save a my own derived node class?
Reply #1 - Jul 10th, 2008 at 4:08pm
Print Post  
Hi,

Use the Diagram.RegisterItemClass method, and override the SaveTo and LoadFrom methods. This is shown in the IconNodes sample project.

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



Posts: 30
Joined: Jul 1st, 2008
Re: How can I save a my own derived node class?
Reply #2 - Jul 16th, 2008 at 10:33am
Print Post  
Thanks Stoyan, that's just what I needed. Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint