Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic diagramViewer.NodeClicked Event fires only on left mouse button (Read 7220 times)
Oli
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Sep 23rd, 2013
diagramViewer.NodeClicked Event fires only on left mouse button
Sep 27th, 2013 at 11:05am
Print Post  
Hello

I have a layeredLayout Diagram in an ASP.net page.
(.NET 4.5, Browser IE 9)
In each node shall be a right-click context-menu available.
The values in the context-menu are depending on the node values.
I tried the following:
In the aspx-page I set <body onmousedown="return false;">

In code-behind I did
Private Sub diagramViewer_NodeClicked(sender As Object, e As MindFusion.Diagramming.NodeEventArgs) Handles diagramViewer.NodeClicked
If (e.MouseButton <> MouseButton.Left) Then
Dim nodeTag As String = e.Node.Tag
Dim x As Single = e.Node.Bounds.X
Dim y As Single = e.Node.Bounds.Y...
and so on.

My problem is that the "NodeClicked" event fires only on left mouse clicks, never on a right click.
Any idea what I'm doing wrong or is there even a better way to get a context-menu?

Thanks in advance!
Oli
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: diagramViewer.NodeClicked Event fires only on left mouse button
Reply #1 - Sep 27th, 2013 at 11:10am
Print Post  
Hi,

See http://mindfusion.eu/Forum/YaBB.pl?num=1343319764/1#1 for a context menu example.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Oli
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Sep 23rd, 2013
Re: diagramViewer.NodeClicked Event fires only on left mouse button
Reply #2 - Sep 28th, 2013 at 10:14am
Print Post  
Hello Stoyan

thank you for your help.

I got the thing working, but it does not realy solve my problem ( or I didn't see it all). I need a node-specific context-menu and therefore it is essential that I know which node was clicked.
I was thinking of scenarios like:
  • Javascript reads the node-value and stores the value in a hiddenfield. After that I can start my serverside code which writes the specific context-menu for the clicked node and displays it.

  • call from the mousedown event handler which was added before as Attribute (like described in your post) a serverside function, which writes the specific context-menu for the clicked node and displays it.


Is one of these two scenarios possible or do you have a third, better idea ( I would appreciate that)

Thank you in advance!
Oli
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: diagramViewer.NodeClicked Event fires only on left mouse button
Reply #3 - Sep 30th, 2013 at 6:21am
Print Post  
Hi Oli,

In CreatingAreaElement event handler the current node is accessible via the args.Item property. If you identify nodes by their Tag or Id values, you could append args.Item.Tag/Id as argument to the onNodeMouseDown JS function, and then show a node-specific menu depending on the id parameter value.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Oli
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Sep 23rd, 2013
Re: diagramViewer.NodeClicked Event fires only on left mouse button
Reply #4 - Sep 30th, 2013 at 7:16am
Print Post  
HI Stoyan

I tried your advice and added in the CreatingAreaElement event Handler the following:
e.Attributes("onmousedown") = "return onNodeMouseDown(event, event.item.Id)"
But there pops up a JS error - Id is undefined or nothing.
I 'm sorry but I'm really a lame duck in JS...

Thanks for any help.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: diagramViewer.NodeClicked Event fires only on left mouse button
Reply #5 - Sep 30th, 2013 at 7:46am
Print Post  
Hi,

I meant you should append the Id value to the attribute string to generate item-specific scripts:

Code
Select All
e.Attributes["onmousedown"] = "return onNodeMouseDown(event," + e.Item.Id + ")"; 



And also add a second Id parameter to onNodeMouseDown, which will receive the Id value set from the server.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Oli
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Sep 23rd, 2013
Re: diagramViewer.NodeClicked Event fires only on left mouse button
Reply #6 - Sep 30th, 2013 at 7:57am
Print Post  
Hi Stoyan

Great, it works, thanks a lot for this excellent support! Cool

Oli
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint