Page Index Toggle Pages: [1] 2 3 ... 5 Send TopicPrint
Very Hot Topic (More than 25 Replies) Starting with a Default Node (Read 28482 times)
Pontius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 51
Joined: May 13th, 2011
Starting with a Default Node
May 30th, 2011 at 4:53pm
Print Post  
Hi,

I want to know when my diagram is ready so that I am able to add a first node as a starting point for the user. Therefor I need to know the size of the diagram.

When I use the UserControl_Initialized event to create my first node the values of diagram.Heigt or diagram.ActualHeigt both are 0.0.

Which event can I use so that I can ask for the size of the diagram?

Regards,
Pontius
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Starting with a Default Node
Reply #1 - May 30th, 2011 at 6:34pm
Print Post  
Hi,

If you need to know the size of the diagram control on screen to center that default node, you should handle the UserControl.Loaded event. It occurs when the element is laid out and rendered. To center a node on screen, you probably have to check the size of the diagram's parent control (ScrollViewer in most cases) and not the diagram itself.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Pontius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 51
Joined: May 13th, 2011
Re: Starting with a Default Node
Reply #2 - May 31st, 2011 at 8:18am
Print Post  
Hi,

That's exactly what I was searching for and it works.

Thanks and best regards,
Pontius
  
Back to top
 
IP Logged
 
Pontius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 51
Joined: May 13th, 2011
Re: Starting with a Default Node
Reply #3 - May 31st, 2011 at 3:28pm
Print Post  
Hi,

I want to have a fixed side element that is not movable and holds a table of anchor points.

When I use the TableNode I have a caption that is used for dragging the node. Is it possible to use the TableNode without the caption and without the possibility to move it away from the side?
Or should I better use a different node, e.g. the ShapedNode for that purpose and program the table behavior on my own?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Starting with a Default Node
Reply #4 - May 31st, 2011 at 4:44pm
Print Post  
Hi,

Try setting CaptionHeight to 0 and Cosntraint.MoveDirection to one appropriate to the side.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Pontius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 51
Joined: May 13th, 2011
Re: Starting with a Default Node
Reply #5 - Jun 3rd, 2011 at 3:31pm
Print Post  
Thanks again,

now I want to create a DiagramLink between a row of a TableNode and an AnchorPoint of a ShapeNode.

The method Factory.CreateDiagramLink seems to support only creating Links between a row of TableNode and a ShapeNode as an entity. But I must create it to one single of several AnchorPoints.

I there any possibility to do so?

Regards,
Pontius
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Starting with a Default Node
Reply #6 - Jun 3rd, 2011 at 5:48pm
Print Post  
You can set the link's OriginAnchor or DestinationAnchor property after creating the link.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Pontius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 51
Joined: May 13th, 2011
Re: Starting with a Default Node
Reply #7 - Jun 8th, 2011 at 1:35pm
Print Post  
Thanks.

In my application the user should be able to create more than one DiagramLink between two nodes.

The background is that I have a big TabelNode on the left side of my diagram where the cells represent variables like "X1", "X2", or "Y". Now the user may drop a "Plus"-Node on the diagram that has two input variables and one output variable representing the sum. He wants to create two DiagramLinks from the TableNode: one links "X1" to the first AnchorPoint of the "Plus"-Node, the other one links "X2" to the second AnchorPoint of the same "Plus"-Node.

When the user has created the first link already then he cannot create the second link and the mouse symbol shows something like forbidden.

How can I work around this?

Regards,
Pontius
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Starting with a Default Node
Reply #8 - Jun 8th, 2011 at 1:57pm
Print Post  
This should be enabled by default. If you are handling the ValidateAnchorPoint or LinkCreating event, please verify that the event handler doesn't prevent the second link. Also check the Diagram.AllowLinksRepeat property value.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Pontius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 51
Joined: May 13th, 2011
Re: Starting with a Default Node
Reply #9 - Jun 8th, 2011 at 3:26pm
Print Post  
Thanks,

it was the Diagram.AllowLinksRepeat property that was set to false. By setting it to true I face the problem that multiple incoming links may link to an AnchorPoint.

I can handle the ValidateAnchorPoint event but how can I find out from the LinkValidationEventArg if an AnchorPoint has a link connected already?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Starting with a Default Node
Reply #10 - Jun 8th, 2011 at 4:16pm
Print Post  
Use the CountLinks method from this post:
http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_disc;action=display;num=124159240...

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Pontius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 51
Joined: May 13th, 2011
Re: Starting with a Default Node
Reply #11 - Jun 8th, 2011 at 4:41pm
Print Post  
Thanks,

that seems to work for my TemplatedNode but not for my TableNode. Probably because the TableNode has the property ConnectionStyle = TableConnectionStyle.Rows and the IncomingLinks of the TableNode always count 0.

Any suggestions how to handle the TableNode?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Starting with a Default Node
Reply #12 - Jun 8th, 2011 at 5:17pm
Print Post  
You could add a CountLinks overload for tables that counts the link using an outer loop over table.Rows and a nested loop over each row's link collection.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Pontius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 51
Joined: May 13th, 2011
Re: Starting with a Default Node
Reply #13 - Jun 8th, 2011 at 5:43pm
Print Post  
Do you know what the LinkValidationEventArgs.TableRow is usable for?
It is described as 'An integer value specifying the zero-based index of a TableNode's row.'

When I try to use it it is always zero for my TableNode and also zero for my TemplatedNode where it should better be -1 to show that it is invalid.

Regarding your suggestion, which virtual method of DiagramNode can I overload to have access to a CountLinks property.
I mean in the diagram_ValidateAnchorPoint method I would not cast to a derived MyTableNode class using try/catch to be able to access my very own code inside of the MyTableNode class.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Starting with a Default Node
Reply #14 - Jun 9th, 2011 at 6:32am
Print Post  
The TableRow argument is used only with the LinkCreating and LinkModifying events at this time. In ValidateAnchorPoint you can check the link's OriginIndex property to find the origin row if it has already been set, or call table.RowFromPoint to find what destination row will be set if the user stops drawing at the current mouse position.

To overload means you can create a separate CountLinks version just for TableNodes, though that can probably be done with only one method if you get the links through DiagramNode.GetAllLinks() instead of checking the node's and rows' Links collections.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 3 ... 5
Send TopicPrint