Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Custom shapes not saving/restoring in SaveToXML (Read 3853 times)
Bill Dimes
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Mar 13th, 2012
Custom shapes not saving/restoring in SaveToXML
Mar 13th, 2012 at 2:53pm
Print Post  
I have very simple requirements and only need 2 shapes in my diagram. A long, short rounded rectangle (maybe 40 tall 100 long) and a diamond for decisions.

I created these shapes and put them in a library using your shape designer tool and I can drag and drop them onto my drawing from a ShapeListBox.

Question 1: The shapes seem to be locked to an overall size of 100x100. When I drag my rectangle onto the diagram, I still get drag handles much taller than the rectangle. How can I get an appropriate sized node to drag and drop from the ShapListBox that isn't square?

This may be a related issue, but SaveToXML and LoadToXML lose my shapes. They are saved and restored, but not in my shape, rather a 100x100 square box. If I manually resize my shapes BEFORE the SaveToXML, they restore properly.

Question 2: How do I get my custom shapes that were dragged and dropped to save/restore properly? (May be related to question 1).

Thanks in advance,

Bill

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom shapes not saving/restoring in SaveToXML
Reply #1 - Mar 13th, 2012 at 6:10pm
Print Post  
1. Set ShapeListBox.DefaultShapeSize.
2. The custom shapes must be registered on the server side too, e.g. call ShapeLibrary.LoadFrom from the form_load handler.

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


I Love MindFusion!

Posts: 3
Joined: Mar 13th, 2012
Re: Custom shapes not saving/restoring in SaveToXML
Reply #2 - Mar 14th, 2012 at 3:10pm
Print Post  
Yes, it did help some. I had set the ShapeLibraryLocation property of both my ShapeListBox and my DiagramView but once I included the line "ShapeLibrary.LoadFrom(...)" it worked. I'm not even sure what that does and how it relates to everything???

But the ShapeListBox.DefaultShapeSize appears to set the "zoom" factor of the shapes as they are dragged into the diagram. I have it set to 30,30. If I change it to say 100,40 it stretches out my shape but it still exists in a 100x100 matrix. The grab handles area is much taller than the control. This gives me problems when I use a layout manager (it stops the arrows at the edge of that imaginary box instead of touching the shape).

I can "draw" a 100x40 node, but when I drag a node designed to be 100x40 it comes along with a 100x100 box with the node in the middle. I simply need a 100x40 node and a decision node about 40x40 (diamond) with no extra margin.

Is there a way? How can I override the drag and drop behavior and manually draw the 2 simple shapes based on the one being drug?

Thanks again for your help.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom shapes not saving/restoring in SaveToXML
Reply #3 - Mar 14th, 2012 at 4:02pm
Print Post  
Coordinates in a custom shape definition should be specified as percents of the node's bounding rectangle, and I think you've tried to specify them in pixels. E.g. if you want a 100x40 px. rectangular nodes created, the lower-right point in the shape should be set to 100%, 100%, while the DefaultShapeSize should be set to 100, 40.

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


I Love MindFusion!

Posts: 3
Joined: Mar 13th, 2012
Re: Custom shapes not saving/restoring in SaveToXML
Reply #4 - Mar 14th, 2012 at 4:40pm
Print Post  
Thanks, I'll give that a try.  (But what about the 40x40 diamond in the same shape library as the 100x40 shape? - am I stuck with having it smashed?)

Have I not found the documentation that would explain all of this? I read the chm file and searched the KB and forums. I'd rather read some docs than bother you with questions. But I DO appreciate your prompt response, thank you!

BTW, I did purchase the license for the WebForms suite. And interestingly, I found that I have used your control years ago on a Visual FoxPro project. Funny, we came full-circle.

One more question: I need to assign an ID to the tag property of the nodes. I've tried several events but none seem to fire after a shape is dragged onto the diagram. How do I do this?

Thanks again,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom shapes not saving/restoring in SaveToXML
Reply #5 - Mar 14th, 2012 at 5:04pm
Print Post  
DefaultShapeSize will let you create only nodes of the same size. You will have to change the node sizes from the NodeCreated event if nodes are not the same size. E.g. in a NodeCreatedScript function in Java mode you could check the e.getNode().getShape().getId() value and call e.getNode().resize() according to the shape.

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