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


I love YaBB 1G - SP1!

Posts: 51
Joined: May 13th, 2011
Re: Starting with a Default Node
Reply #15 - Jun 9th, 2011 at 11:30am
Print Post  
Thanks,

I need to find the DestinationIndex which is -1 always. The method TableNode.RowFromPoint doesn't seem to exist in Diagramming WPF. I can only find TableNode.CellFromPoint but I cannot track back from TableNode.Cell to TableNode.Row which holds the IncomingLinks that I have to check.

Regards
  
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 #16 - Jun 9th, 2011 at 1:36pm
Print Post  
Hi Stoyan,

my Templated Node has three AnchorPoints, two in and one out. When the user tries to create a DiagramLink to this node as destination it happens that the node connects the link beside one of these AnchorPoints. How can I get rid of this?

In TableNode I can set the property ConnectionStyle = TableConnectionStyle.Rows indicating that only the rows are allowed to connect links but not the node as an entity. Is there something similiar in DiagramNode?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Starting with a Default Node
Reply #17 - Jun 9th, 2011 at 2:24pm
Print Post  
Hi,

Use the table.CellFromPoint(point, bool, ref row, ref col) method to find the row.

If you mean that a newly created link does not connect to an anchor point, check the ValidateAnchorPoint handler. If it returns false for all points, the link should be either rejected if AllowUnanchoredLinks is false, or it could connect to any point on the node border if AllowUnanchoredLinks is true.

If this happens when modifying an existing link and you need the link to align to the anchor point in that case too, set diagram.SnapToAnchor = OnCreateOrModify.

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 #18 - Jun 9th, 2011 at 3:30pm
Print Post  
Hi,

I' sorry for not finding the CellFromPoint(point, bool, ref row, ref col) method. But my problem still exists.

The diagram has:
SnapToAnchor = OnCreateOrModify
AllowUnanchoredLinks  = false

The TableNode has:
ConnectionStyle = TableConnectionStyle.Rows

The ValidateAnchorPoint as follows:
private void diagram_ValidateAnchorPoint(object sender, LinkValidationEventArgs e)
{
if (e.Link == null) return;
if(e.Node == MyTableNode) e.Cancel=true;
}

And still the DiagramLink is connected to this very MyTableNode. Not at a given AnchorPoint but anywhere else at the border of the node.

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 #19 - Jun 9th, 2011 at 6:18pm
Print Post  
CellFromPoint is a member of TableNode. The event handler seems to prevent the link if you move the MyTableNode check in front. Otherwise when the handler is raised without e.Link argument in the beginning (to check if the control should start drawing a link at all), the execution never reaches the e.Cancel assignment.

Code
Select All
void diagram_ValidateAnchorPoint(object sender, LinkValidationEventArgs e)
{
	if (e.Node == MyTableNode) e.Cancel = true;
	if (e.Link == null) return;

	int row = -1;
	int col = -1;
	if (MyTableNode.CellFromPoint(e.MousePosition, true, ref row, ref col))
	{
		//...
	}
} 



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 #20 - Jun 10th, 2011 at 12:53pm
Print Post  
I understand CellFromPoint now and do not have any more questions to that. Thanks.

Please check my code lines again. It shouldn't be possible to create the link at all:

Code
Select All
private void diagram_ValidateAnchorPoint(object sender, LinkValidationEventArgs e)
{
if (e.Link == null) return;
if(e.Node == MyTableNode) e.Cancel=true;
}
  



But Diagramming for WPF creates the link!
The first line I have implemented to be able to start creating the link at the first node.
if (e.Link == null) return;

The second line I have implemented to supress connecting it to MyTableNode.
if(e.Node == MyTableNode) e.Cancel=true;

But still the link is created and connects to the surface of MyTableNode.

Without getting rid of this elemtary problem I don't need to count InComingLinks to supress connecting to occupied AnchorPoints because it cannot work at all.

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 #21 - Jun 10th, 2011 at 1:01pm
Print Post  
Reverse these two lines of code as shown above and it will work.
  
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 #22 - Jun 10th, 2011 at 2:12pm
Print Post  
Thanks Stoyan,

the following code works for me:
Code
Select All
private void diagram_ValidateAnchorPoint(object sender, LinkValidationEventArgs e)
{
    if (e.Node == MyTableNode)
    {
        TableNode tn = e.Node as TableNode;
        int row = -1;
        int column = -1;

        if (tn.CellFromPoint(e.MousePosition, true, ref row, ref column))
        {
            if (tn.Rows[row].AnchorPattern == null)
            {
                e.Cancel = true;
            }
            else
            {
                e.Cancel = AnchorIsOccupied(tn.Rows[row].IncomingLinks, e.AnchorIndex, e.Link);
            }
        }
        else
        {
            e.Cancel = true;
        }
    }
    else
    {
        e.Cancel = AnchorIsOccupied(e.Node.IncomingLinks, e.AnchorIndex, e.Link);
    }
}

private bool AnchorIsOccupied(DiagramLinkCollection incomingLinks, int anchorIndex, DiagramLink skipThisLink)
{
    foreach (DiagramLink link in incomingLinks)
    {
        if (link == skipThisLink)
        {
            continue;
        }

        if (link.DestinationAnchor == anchorIndex)
        {
            return true;
        }
    }

    return false;
}
 



The probelm was that there might exists Rows that do not have an AnchorPattern but what they have is an existing Collection of IncomingLink with a count=0.

The only uncomely thing is still that I have to ask for
if(e.Node == MyTableNode)
instead of doing it in inherited manner with virtual methods for TableNode, or TemplatedNode.

Regards and thanks for your patience with me.
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 #23 - Jun 21st, 2011 at 10:00am
Print Post  
Hi,

the TableNode.Cell ToolTip does not show up.

If I just write
MyCell.ToolTip = "hello";
nothing happens when I move the mouse over the cell. The mouspointer has the hand symbol and is the same everywhere over the hole TableNode. But no ToolTip appears.

What may I have done wrong?

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 #24 - Jun 22nd, 2011 at 7:08am
Print Post  
Hi,

It seems we have not implemented cell tooltips. We'll try to do that for the next release.

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 #25 - Jun 22nd, 2011 at 8:01am
Print Post  
Hi Stoyan,

ok, when can I expect the next release including tooltips? Is it a question of some weeks only or several months?

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 #26 - Jun 22nd, 2011 at 10:52am
Print Post  
Hi,

We released v2.6 a couple of weeks ago so I suppose there's no new release coming for at least 2-3 months. If you are a client and need this urgently, contact my coworkers at support@mindfusion.eu and they will arrange sending you an updated build asap.

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 #27 - Jun 30th, 2011 at 5:09pm
Print Post  
Thanks Stoyan,

I will come back to your offered support later.

I want to set a different Brush to the DiagramLink depending on the AnchorPoint.Tag property to distinguish between analog and digital signals.

Which event would you propose to do that?
The diagram_LinkCreating(...) event is raised only when the links destination is reached which comes too late to paint the link in a different color from the very beginning on.

Thanks
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 #28 - Jun 30th, 2011 at 6:20pm
Print Post  
Try the InitializeLink event.

Regards,
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 #29 - Jul 1st, 2011 at 9:01am
Print Post  
Hi Stoyan,

when the InitializeLink event is raised the LinkEventArgs do not contain information about which AnchorPoint is choosen.
The LinkEventArgs.MousePosition is 0,0
The LinkEventArgs.Link.OriginAnchor and the LinkEventArgs.Link.OriginIndex both are -1.

So even while I can see that the Link has already snapped to a dedicated AnchorPoint I cannot find out which one it is by using the InitializeLink event.

Is there another event that is raised (may be a little bit later) when the LinkEventArgs.Link.OriginAnchor or the LinkEventArgs.Link.OriginIndex are known already and wear the data that I need?

Regards,
Pontius
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 4 5
Send TopicPrint