Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ChildNode(ShapeNode) on DiagramView cannot be removed when deleted with DeleteKey from ContainerNode (Read 568 times)
Nobu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Nov 27th, 2023
ChildNode(ShapeNode) on DiagramView cannot be removed when deleted with DeleteKey from ContainerNode
Dec 13th, 2023 at 10:31am
Print Post  
ChildNode(ShapeNode) on DiagramView cannot be removed when deleted with DeleteKey from ContainerNode.
Also, the exceptions below occur when the Node has selected and Drag&Dropped.

Messageļ¼š
   Object reference not set to an instance of an object.
StackTraceļ¼š
   MindFusion.Diagramming.InteractionState.Start(PointF point, Diagram diagram)
   MindFusion.Diagramming.WinForms.Behaviors.BehaviorBase.OnMouseMove(Point mousePosition)
   MindFusion.Diagramming.WinForms.DiagramView.OnMouseMove(MouseEventArgs e)
   System.Windows.Forms.Control.WmMouseMove(Message& m)
   System.Windows.Forms.Control.WndProc(Message& m)
   MindFusion.Diagramming.WinForms.DiagramView.WndProc(Message& m)
   System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)
   Interop.User32.DispatchMessageW(MSG& msg)
   System.Windows.Forms.Application.ComponentManager.Interop.Mso.IMsoComponentManag
er.FPushMessageLoop(UIntPtr dwComponentID, msoloop uReason, Void* pvLoopData)
   System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(msoloop reason, ApplicationContext context)
   System.Windows.Forms.Application.ThreadContext.RunMessageLoop(msoloop reason, ApplicationContext context)
   System.Windows.Forms.Application.Run(Form mainForm)

In the case of the above situation, what steps do I need to take?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3223
Joined: Oct 19th, 2005
Re: ChildNode(ShapeNode) on DiagramView cannot be removed when deleted with DeleteKey from ContainerNode
Reply #1 - Dec 13th, 2023 at 3:06pm
Print Post  
I've reproduced some problems by not adding the child node to the diagram, otherwise Del works fine and not seeing exceptions. CreateShapeNode here calls Nodes.Add internally:

Code
Select All
void Form1_Load(object sender, EventArgs e)
{
	var container = diagram.Factory.CreateContainerNode(10, 10, 80, 80);
	var child = diagram.Factory.CreateShapeNode(30, 30, 30, 30);
	/*var child = new ShapeNode();
	//diagram.Nodes.Add(child);*/
	child.Selected = true;
	child.Text = "delete me";
	container.Add(child);

	diagramView.Focus();
} 



If that does not help, please modify attached test project to reproduce and post it back.

Regards,
Slavcho
Mindfusion
  

TestDeleteFromCtr.zip ( 4 KB | 40 Downloads )
Back to top
 
IP Logged
 
Nobu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Nov 27th, 2023
Re: ChildNode(ShapeNode) on DiagramView cannot be removed when deleted with DeleteKey from ContainerNode
Reply #2 - Dec 22nd, 2023 at 3:10pm
Print Post  
Thank you for your response.

This was due to the fact that I had customized the ShapeNode and included a process to add it to Diagram in Constructor.
*The same node was being added to Diagram twice.

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