Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Mouselistener (Read 5958 times)
superNova
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Aug 5th, 2011
Mouselistener
Oct 6th, 2011 at 6:08am
Print Post  
I want to add an event on node. When I do right click on a particular node so it must give a list of option , like open , delete, update etc. Please tell me a very simple way ,
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouselistener
Reply #1 - Oct 6th, 2011 at 7:49am
Print Post  
You should handle nodeClicked, but it is raised only for the left mouse button at this time:

Code
Select All
diagram.addEventListener(Events.nodeClicked, onNodeClicked);

function onNodeClicked(sender, args)
{
	alert(args.getNode().getText());
} 



Our developer will check if we can stop the browser's context menu from appearing and raise nodeClicked for the right button too.

Stoyan
  
Back to top
 
IP Logged
 
superNova
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Aug 5th, 2011
Re: Mouselistener
Reply #2 - Oct 6th, 2011 at 8:24am
Print Post  
I think u didnt understand about my question, actully i want to open another window. When i do right click so it must show a list of options so how i can put this right click event on node ..

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouselistener
Reply #3 - Oct 6th, 2011 at 8:31am
Print Post  
You will be able to handle the event as shown above, but first we'll have to modify the control to raise the event for right clicks and stop the browser from showing its default context menu. Our developer will check if this can be done later today.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouselistener
Reply #4 - Oct 6th, 2011 at 11:46am
Print Post  
This version raises nodeClicked event for the right button:
http://mindfusion.eu/_beta/MindFusion.Diagramming.js

You must also add an oncontextmenu handler to the canvas to prevent the browser from showing a context menu:
Code
Select All
diagram.addEventListener(Events.nodeClicked, onNodeClicked);
diagram.get_element().oncontextmenu = function () { return false; }

function onNodeClicked(sender, args)
{
	// handle right button click
	if (args.getMouseButton() == 2)
		alert(args.getNode().getText());
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint