Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic node create and text (Read 2898 times)
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
node create and text
Nov 13th, 2019 at 9:41am
Print Post  
Hi, I want to open the editor for the node just after creating the node, this time it is happening at the time of double click of node. Please help for this.
  
Back to top
AIM  
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: node create and text
Reply #1 - Nov 13th, 2019 at 9:49am
Print Post  
This may help you,

diagram.beginEdit(node, new Point(0, 0));

https://mindfusion.eu/Forum/YaBB.pl?num=1568953899
  
Back to top
 
IP Logged
 
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: node create and text
Reply #2 - Nov 21st, 2019 at 5:54am
Print Post  
hi,
I wrote in this way, but it is not working

function onNodeCreated(s, e) {

    var hubId = $.connection.hub.id;
    e.node.id = hubId + s.getItems().length;
    var r = e.node.bounds;
    e.node.setBounds(new Rect(r.x, r.y, 18, 10));

    e.node.setAnchorPattern(anchorPattern);
    var model = {
        id: e.node.id,
        x: r.x,
        y: r.y,
        width: 18,
        height: 10
    };
    diagramHub.server.nodeCreated(model);
    creatednodeidupdate = e.node.id;
    diagram.beginEdit(e.node.bounds, new Point(0, 0));
}
  
Back to top
AIM  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: node create and text
Reply #3 - Nov 21st, 2019 at 6:59am
Print Post  
Hi,

It expects node reference as argument, and not node's bounds. Other than that, the browser's debug window will give you more information why it's not working, like diagram variable being undefined, or Point shortcut not set (to MindFusion.Drawing.Point).

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


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: node create and text
Reply #4 - Nov 26th, 2019 at 9:44am
Print Post  
Okay,
But now I am getting getActiveItem as null in nodecreated event. please help
  
Back to top
AIM  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: node create and text
Reply #5 - Nov 26th, 2019 at 1:56pm
Print Post  
getActiveItem will return null when there are no selected nodes. You have access to the newly create node via the e.node reference, already used in script above.
  
Back to top
 
IP Logged
 
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: node create and text
Reply #6 - Dec 2nd, 2019 at 4:06am
Print Post  
you mean, I should use e.node.beginEdit(), but I tried that it is showing, "e.node.beginEdit()" is not a function. please clear if I am wrong.
  
Back to top
AIM  
IP Logged
 
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: node create and text
Reply #7 - Dec 2nd, 2019 at 4:08am
Print Post  
also I tried with e.node.beginedit , but nothing is happening.
  
Back to top
AIM  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: node create and text
Reply #8 - Dec 2nd, 2019 at 9:59am
Print Post  
I mean diagram.beginEdit(e.node) instead of diagram.beginEdit(diagram.getActiveItem());

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


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: node create and text
Reply #9 - Dec 6th, 2019 at 10:43am
Print Post  
Thank you it worked for me
  
Back to top
AIM  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint