Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Disabling Selection (Read 3842 times)
John Preston
YaBB Newbies
*
Offline


Lost Developer

Posts: 18
Joined: Mar 9th, 2011
Disabling Selection
Mar 21st, 2011 at 7:11pm
Print Post  
When I have a node, attached to another node (inside it in all my cases) when I click the inner node, rather than getting a NodeClick event raised, I instead get a selection box created.

I've set every property I could find...

SelectionOnTop
Selection.Locked
Selection.AllowMultipleSelection

I've tried handling events: NodeSelecting, and SelectionMoving and set e.Cancel = True, e.CancelDrag...

No matter what I do, instead of getting a nodeclicked event, I get a selection box. Is there a way I'm missing to totally disable this and get the event I want?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Disabling Selection
Reply #1 - Mar 21st, 2011 at 7:59pm
Print Post  
NodeClicked is raised ok for me with everything at default values:
https://mindfusion.eu/_samples/EventLogger.Wpf.zip

Please try adding your property values to this sample and let me know which one stops it from working.
  
Back to top
 
IP Logged
 
John Preston
YaBB Newbies
*
Offline


Lost Developer

Posts: 18
Joined: Mar 9th, 2011
Re: Disabling Selection
Reply #2 - Mar 21st, 2011 at 9:29pm
Print Post  
Ooops. That would be my fault. I was using a custom scrollviewer we have that was eating my left click and handling it so it never raised up to me.
  
Back to top
 
IP Logged
 
John Preston
YaBB Newbies
*
Offline


Lost Developer

Posts: 18
Joined: Mar 9th, 2011
Re: Disabling Selection
Reply #3 - Mar 21st, 2011 at 11:06pm
Print Post  
That said... even with that corrected, and in your test project I still get the selection box, there seems to be no way to disable it.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Disabling Selection
Reply #4 - Mar 22nd, 2011 at 7:37am
Print Post  
I can't draw a selection box in the sample. Doesn't the control create a link when you start drawing from the attached node? It always draws a selection box if you hold down Ctrl, but that can be disabled by setting:

Diagram.ModifierKeyActions.Control = ModifierKeyAction.None;

It will also draw selection box if Behavior is set to Modify and you start drawing from a position that will not move or resize items.

In any case, you can derive from the Behavior class that most closely resembles the interaction mode you need, override StartDraw and check the base result - if the base class has returned an InteractionState(Selection, Create) object, you can return null instead to stop it.

Alternatively you could handle MouseMove and check Diagram.Interaction. If it is an InteractionState(Selection, Create) object, call Diagram.CancelDrag().

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


Lost Developer

Posts: 18
Joined: Mar 9th, 2011
Re: Disabling Selection
Reply #5 - Mar 22nd, 2011 at 2:49pm
Print Post  
I'm definitely not holding control, and the behavior isn't modify.

I did set these:

subNode.AllowIncomingLinks = false;
subNode.AllowOutgoingLinks = false;

So that's probably why it doesn't start drawing links, and instead starts drawing a selection box. But that seems like odd behavior. I'd not expect a selection just because I'm not getting links.

Should I look into the MouseMove InteractionState, Diagram.CancelDrag, or does it sound like a bug?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Disabling Selection
Reply #6 - Mar 23rd, 2011 at 8:56am
Print Post  
It draws the selection box by design if no other operation has started.

Check how it behaves if you set subNode.Locked = true instead of the AllowLinks properties. Then instead of selection the control would start drawing a link from the main node, which might work depending on what your usage scenario is.

Otherwise you will have to return null from a custom Behavior class to prevent the selection, or call CancelDrag. Alternatively you could keep the AllowLinks properties set to true, but call e.CancelDrag from the LinkCreating event if you detect that the link origin is an attached node.

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


Lost Developer

Posts: 18
Joined: Mar 9th, 2011
Re: Disabling Selection
Reply #7 - Mar 23rd, 2011 at 2:57pm
Print Post  
Ahhh yes... Locked will work better than AllowIncoming and AllowOutgoing set to false.

Thank you Stoyo.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint