Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ValidateAnchorPoint not firing (Read 2468 times)
Mann Madhan
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Dec 4th, 2021
ValidateAnchorPoint not firing
Dec 5th, 2021 at 7:22am
Print Post  
Dear team,
public Form2()
        {
            InitializeComponent();
            diagram1.ValidateAnchorPoint += new EventHandler<LinkValidationEventArgs>(ValidateAnchorPoint);
}
private void ValidateAnchorPoint(object sender, LinkValidationEventArgs e)
        {
            if (CountLinks(e.Node, e.AnchorIndex, e.Link) > 0)
                e.Cancel = true;
        }
when the event will fire? or i am doing some thing wrong
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3378
Joined: Oct 19th, 2005
Re: ValidateAnchorPoint not firing
Reply #1 - Dec 6th, 2021 at 6:42am
Print Post  
Hi,

This is fired when choosing AnchorPoint from a node's AnchorPattern property. It won't raise if node.AnchorPattern is null.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
madhan1
Full Member
***
Offline


FOLLOW NO ONE BUT LEARN
FROM EVERY ONE ..

Posts: 101
Location: India
Joined: Feb 17th, 2010
Re: ValidateAnchorPoint not firing
Reply #2 - Dec 6th, 2021 at 7:23pm
Print Post  
Dear sir,

Code (Java)
Select All
  TableNode tbResources1 = diagram1.Factory.CreateTableNode(210, 10, 100, 200);
            tbResources1.RowHeight = 25;
            tbResources1.RedimTable(1, itemIDs.Count);
            tbResources1.Caption = "Senses";
            tbResources1.Font = new Font(FontFamily.GenericSansSerif, 9.0F, FontStyle.Italic, GraphicsUnit.Pixel);
            tbResources1.Pen = new MindFusion.Drawing.Pen(Color.FromArgb(192, 192, 192));
            tbResources1.CaptionHeight = 20;
            tbResources1.CaptionBrush = new MindFusion.Drawing.SolidBrush(Color.White);
            tbResources1.CaptionBackBrush = new MindFusion.Drawing.SolidBrush(Color.FromArgb(247, 150, 70));
            for (int i=0;i<itemIDs.Count;i++)
            {
                tbResources[0, i].Text = itemIDs[i][1].ToString();
                tbResources1[0, i].Text = itemIDs[i][2].ToString();
                tbResources1.Rows[i].AnchorPattern = new AnchorPattern(new[] { new AnchorPoint(0,50) });

            }

            diagram1.Nodes.Add(tbResources1); 




but the links are return as o only
  

nodes_002.png (Attachment deleted)

if you want something then go and grab it
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3378
Joined: Oct 19th, 2005
Re: ValidateAnchorPoint not firing
Reply #3 - Dec 7th, 2021 at 7:46am
Print Post  
Index reported to ValidateAnchorPoint event is of the AnchorPoint within AnchorPattern.Points array, so it's always first point in your case. It seems you are trying to prevent connecting a link to specific rows of the table. You can achieve that by handling the LinkCreating validation event -

Code
Select All
void OnLinkCreating(object sender, LinkValidationEventArgs e)
{
	var table = e.Destination as TableNode;
	if (table != null && e.ChangingDestination && e.TableRow some condition)
		e.Cancel = true;
} 



You might want to handle LinkModifying the same way.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint