Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Unselect node (Read 8578 times)
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Unselect node
Dec 22nd, 2011 at 3:06pm
Print Post  
Hello, simple question.
Exist some way to unselect any node selected:

Example some code for run when a click a button, make if any object in the diagram is selected be unselected.

Best regards.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unselect node
Reply #1 - Dec 22nd, 2011 at 5:25pm
Print Post  
Try with diagram.Selection.Clear().

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Unselect node
Reply #2 - Dec 22nd, 2011 at 6:47pm
Print Post  
Thank You stoyo!!

Merry X-MAS !
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unselect node
Reply #3 - Dec 22nd, 2011 at 8:16pm
Print Post  
Merry Christmas to you too Smiley
  
Back to top
 
IP Logged
 
Hunter
Full Member
***
Offline



Posts: 194
Location: Sevastopol
Joined: Dec 1st, 2009
Re: Unselect node
Reply #4 - Jan 5th, 2012 at 1:11pm
Print Post  
I have the problem with deactivate node in version 2.7. With older versions all works ok, but now when I click on the diagram area I catch the NodeDeactivated event but on the diagram node marked as activated. Also in the same time I stop the program on the breakpoint in the CanExecute event handler for the copy cmd and check the Diagram.ActiveItem property and see that it is null.
P.S.: when mouse is over the fake active item (BUT NOT CLICK) and after that I take away mouse cursor from this item, this item doesn't marked as active
« Last Edit: Jan 5th, 2012 at 2:34pm by Hunter »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unselect node
Reply #5 - Jan 5th, 2012 at 5:16pm
Print Post  
Do you mean the node's selection handles remain visible even after deselecting that node? I cannot reproduce that. What exactly does your NodeDeactivated handler do?
  
Back to top
 
IP Logged
 
Hunter
Full Member
***
Offline



Posts: 194
Location: Sevastopol
Joined: Dec 1st, 2009
Re: Unselect node
Reply #6 - Jan 6th, 2012 at 8:52am
Print Post  
Stoyo wrote on Jan 5th, 2012 at 5:16pm:
Do you mean the node's selection handles remain visible even after deselecting that node? I cannot reproduce that. What exactly does your NodeDeactivated handler do?

Yes, active handlers stay as is. Selection handlers are grey and active handlers are white. So active handlers remains. When mouse is over the node but not click handlers change to grey color. And when mouse cursor leaves the node area, then node lost all handlers. But if I click to anothe node I see that old active node keeps the active handlers and real active node also has active handlers. NodeDeactivated handler:
Code
Select All
            MainFrameWnd mainWnd = App.GetMainWnd();
            mainWnd.ClearProceesStructureSelection();
            ProcessOperationProp ctrl = mainWnd.m_PropsWnd.Content as ProcessOperationProp;
            if (ctrl != null) m_nOpCtrlTabSelectedIndex = ctrl.m_TabCtrl.SelectedIndex;
            mainWnd.m_PropsWnd.Content = null;
            m_PreviousActiveItem = null;
 


In this code mainWnd.ClearProceesStructureSelection() removes selection from the TreeViewItem in the Tree which placed into the left side of the Layout. ProcessOperationProp ctrl is the control in the bottom side of the Layout. It corresponds to the active node and showing active nove's properties. I can make the video to demonstrate the effect. The way to show you the code is hard because our application is strongly linked with the database and can't work without it. The base of the Layout is your example (FlowCharter). When I drag the node from the right side of the Layout and drop it into the diagram area this effect doesn't reproduce. But when I activate nodes by mouse clicks I see this effect
  
Back to top
 
IP Logged
 
Hunter
Full Member
***
Offline



Posts: 194
Location: Sevastopol
Joined: Dec 1st, 2009
Re: Unselect node
Reply #7 - Jan 6th, 2012 at 10:14am
Print Post  
It is interesting that when in the Deactivated event I call Diagram.Selection.Clear() all works. But problem remains when I try to select more then one node by pressing Shift button and mouse click. First selected node in this case whole time marked as active before I move mouse cursor over this node.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unselect node
Reply #8 - Jan 6th, 2012 at 11:17am
Print Post  
Are you also modifying the diagram selection from that ClearProceesStructureSelection method, or some event handler? If you copy property settings and event handlers from your project to the Flowcharter example, which one leads to the problem?
  
Back to top
 
IP Logged
 
Hunter
Full Member
***
Offline



Posts: 194
Location: Sevastopol
Joined: Dec 1st, 2009
Re: Unselect node
Reply #9 - Jan 6th, 2012 at 12:02pm
Print Post  
In ClearProceesStructureSelection I don't modify any Diagram properties. But I found the code which leads to the problem. I use the Actipro Tebbed MDI Layout in our project. And into the bottom DockPanel when each node is activated I place the necessary UserControl which represents the properties of the node. So when node is deactivated I need to clear this control. This control works using MVVM pattern and the reference to the node transmits into the ViewModel constructor. After that ViewModel object sets as DataContext of the user control. If I comment the string mainWnd.m_PropsWnd.Content = null; all works OK. In the new year (January, 3) we upgrade the Mindfusion library from 2.6 version to 2.7 and at the same time we upgrade the Actipro library. And which problem leads to the problem I don't know yet.
  
Back to top
 
IP Logged
 
Hunter
Full Member
***
Offline



Posts: 194
Location: Sevastopol
Joined: Dec 1st, 2009
Re: Unselect node
Reply #10 - Jan 6th, 2012 at 12:26pm
Print Post  
Also when I move code into SelectionChanged event handler as
Code
Select All
                if (m_Diagram.Selection.Nodes.Count != 1 && !m_bNodeActivatedProcessing)
                {
                    ProcessOperationProp ctrl = App.GetMainWnd().m_PropsWnd.Content as ProcessOperationProp;
                    if (ctrl != null) m_nOpCtrlTabSelectedIndex = ctrl.m_TabCtrl.SelectedIndex;
                    App.GetMainWnd().m_PropsWnd.Content = null;
                }
 


all works OK
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unselect node
Reply #11 - Jan 7th, 2012 at 9:04am
Print Post  
Selection handles are drawn inside the DiagramItem.Adorner visual, and the diagram calls item.Adorner.InvalidateVisual() whenever ActiveItem changes. This in turn starts a new WPF layout pass that should update the rendering of the elements inside the adorner.

If the MDI container control you are using somehow stops the layout pass while processing mouse input, the handles won't get updated. In case that happens before the selection event is raised, you could explicitly call e.Node.Adorner.InvalidateVisual() from the handler to work around it. I suppose if Diagram.Selection.Clear() works at that point, Adorner.InvalidateVisual() should work too.

Adorner.InvalidateVisual() gets invoked also when moving the mouse if auto-handles / auto-anchors properties are enabled, so that's why the handles are redrawn then.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Hunter
Full Member
***
Offline



Posts: 194
Location: Sevastopol
Joined: Dec 1st, 2009
Re: Unselect node
Reply #12 - Jan 10th, 2012 at 8:13am
Print Post  
Thanks! Really when I add e.Node.Adorner.InvalidateVisual(); to the NodeDeactivated event handler all works as I need!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint