Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to find on nodecreated event that node parent (container) is available or not? (Read 2097 times)
reshma
Junior Member
**
Offline


I Love MindFusion!

Posts: 91
Joined: Jan 16th, 2018
How to find on nodecreated event that node parent (container) is available or not?
Sep 23rd, 2020 at 12:03pm
Print Post  
Hi,
I want to know parent of node on nodecreated event before Containerchildadded().
Please let me know the property
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: How to find on nodecreated event that node parent (container) is available or not?
Reply #1 - Sep 24th, 2020 at 6:10am
Print Post  
Before containerChildAdded, earliest you will get the container is as argument of containerChildAdding, as we discussed in https://mindfusion.eu/Forum/YaBB.pl?num=1596017540/6#6

If it's that important to find container from nodeCreated handler, call Diagram.getNodesAt(args.mousePosition) and check if topmost node behind newly created one is container.
  
Back to top
 
IP Logged
 
reshma
Junior Member
**
Offline


I Love MindFusion!

Posts: 91
Joined: Jan 16th, 2018
Re: How to find on nodecreated event that node parent (container) is available or not?
Reply #2 - Sep 24th, 2020 at 8:10am
Print Post  
i added this.diagram.getNodes(args.getMousePosition()) but args.getMousePosition() is undefined on nodecreated event is any other way to find node is having parent on nodecreated event
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: How to find on nodecreated event that node parent (container) is available or not?
Reply #3 - Sep 25th, 2020 at 5:50am
Print Post  
Actually mouse position is reported with nodeCreating event but not nodeCreated. You could save last one from creating to check in created, or get it from the Diagram.pointerPosition field.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
reshma
Junior Member
**
Offline


I Love MindFusion!

Posts: 91
Joined: Jan 16th, 2018
Re: How to find on nodecreated event that node parent (container) is available or not?
Reply #4 - Sep 28th, 2020 at 12:45pm
Print Post  
resolve my problem but i have one more issue which is suppose i have parent and child and i am trying to drag child outside parent it is not allowed (somewhere args.setcancel(True))event is fired can you please let me know which one is the event to find childs are not allowed to move outside parent  and setcancel(true) is applied ( i checked on nodemodifying but it is not there)
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: How to find on nodecreated event that node parent (container) is available or not?
Reply #5 - Sep 29th, 2020 at 9:26am
Print Post  
Try the containerChildRemoving event.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint