Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic read only diagram (Read 2107 times)
msperling
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Jul 1st, 2010
read only diagram
Sep 9th, 2011 at 9:56pm
Print Post  
I am programmatically creating a diagram.  I would like to make this diagram read only, i.e. I dont want users to be able to modify it.  However, I would also like to get node selected and link selected callbacks when the user clicks on these items.  When I set the diagramview.behavior to "DONOTHING", the diagram becomes read/only, but I am not getting these callbacks, even though the documentation says I should still be getting mouse events. Also, I would also like to change the mouse cursor when the mouse is over a node or link.  I usually do this in mousemove, but I cant find a method to call to determine if the mouse is positioned over a mindfusion item.  Please tell me how to do this.  Thanks for your help. Mike
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: read only diagram
Reply #1 - Sep 10th, 2011 at 6:19am
Print Post  
DoNothing prevents selection so you won't get NodeSelected and LinkSelected events. The control will still raise NodeClicked and LinkClicked though, so there are two ways to implement what you need:

- use the Modify behavior, and call CancelDrag from the NodeModifying and LinkModifying handlers;

- or in DoNothing mode, handle NodeClicked and LinkClicked to select the clicked item programmatically. Or instead of selecting it, you can just change the border style to indicate that it's the currently 'focused' item.

Detecting the item from MouseMove should look like this:

Code
Select All
private void diagramView_MouseMove(object sender, MouseEventArgs e)
{
	PointF point = diagramView.ClientToDoc(e.Location);
	DiagramItem item = diagram.GetItemAt(point);
	...
} 



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


I love YaBB 1G - SP1!

Posts: 4
Joined: Jul 1st, 2010
Re: read only diagram
Reply #2 - Sep 12th, 2011 at 10:02pm
Print Post  
Stoyan,
  This did help.  I am getting NodeClicked and LinkClicked and handling those events.  However, I cant get changing the cursor to work.  I am trying both:

           if (item == null)
               diagramView1.CurrentCursor = Cursors.Default;
           else
               diagramView1.CurrentCursor = Cursors.Hand;

AND

           if (item == null)
               this.Cursor = Cursors.Default;
           else
               this.Cursor = Cursors.Hand;

where "this" is my usercontrol, but I cant get the cursor go change to a "Hand".  I have confirmed with breakpoints that the else clause is being entered appropriately, but the appearance of the cursor is still not changing.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: read only diagram
Reply #3 - Sep 13th, 2011 at 5:39am
Print Post  
Set the OverrideCursor property, otherwise the cursors reverts back to its context-sensitive value on next mouse move.

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