Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Diagram.ClearAll() problem (Read 4984 times)
wojto
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Jan 20th, 2010
Diagram.ClearAll() problem
Jan 25th, 2010 at 4:11pm
Print Post  
Hi, after clicking a node I want to redraw the diagram. So in NodeSelected event handler I call Diagram.ClearAll(). By doing so I get the following exception:

System.NullReferenceException was unhandled by user code
  Message="Object reference not set to an instance of an object."
  StackTrace:
      at MindFusion.Diagramming.Silverlight.Selection.RemoveItem(DiagramItem item)
      at MindFusion.Diagramming.Silverlight.Selection.xd7c7cf5c5fa6b628(Object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
      at MindFusion.Diagramming.Silverlight.CollectionBase`2.xa9d636b00ff486b7(Boolean x808547253555a9ba)
      at MindFusion.Diagramming.Silverlight.CollectionBase`2.Clear()
      at MindFusion.Diagramming.Silverlight.Selection.x6e950a5680221e52()
      at MindFusion.Diagramming.Silverlight.Diagram.ClearAll()
      at Silverlight.Pages.FlowDiagram.DrawDiagram()
      at Silverlight.Pages.FlowDiagram.SelectNode(DiagramNode node)
      at Silverlight.Pages.FlowDiagram.dgSteps_NodeSelected(Object sender, NodeEventArgs e)
      at MindFusion.Diagramming.Silverlight.Diagram.OnNodeSelected(NodeEventArgs e)
      at MindFusion.Diagramming.Silverlight.Diagram.x687b9b7bc932d66f(DiagramItem xccb63ca5f63dc470)
      at MindFusion.Diagramming.Silverlight.DiagramItem.x5db081b43af662f4(Boolean x8f9d3ffcb9383cde)
      at MindFusion.Diagramming.Silverlight.Selection.xc72e48b5cfcebb45(DiagramItem xccb63ca5f63dc470)
      at MindFusion.Diagramming.Silverlight.Selection.AddItem(DiagramItem item)
      at MindFusion.Diagramming.Silverlight.BehaviorBase.OnMouseUp(MouseButtonEventArgs e)
      at MindFusion.Diagramming.Silverlight.Diagram.x66c89b500bffc63d(Object xe0292b9ed559da7d, MouseButtonEventArgs xfbf34718e704c6bc)
      at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
      at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

When Diagram.ClearAll() is called from some other event (like clicking some button or OnLoad) everything works fine.

Any suggestions?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.ClearAll() problem
Reply #1 - Jan 25th, 2010 at 5:53pm
Print Post  
Hi,

Call ClearAll from the NodeClicked handler.

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


I love YaBB 1G - SP1!

Posts: 12
Joined: Jan 20th, 2010
Re: Diagram.ClearAll() problem
Reply #2 - Jan 26th, 2010 at 10:06am
Print Post  
Neither NodeClicked nor CellClicked seem to be raised on my TableNode when I use NodeSelected Smiley Is it that Diagram.ClearAll() cannot be called while handling NodeSelected?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.ClearAll() problem
Reply #3 - Jan 26th, 2010 at 10:15am
Print Post  
ClearAll can't be called from NodeSelected at this time because the latter is called form a loop that iterates over the selection. Do you mean Clicked events are not raised if there are both Selected and Clicked handlers added? This seems to work fine in my test -

private void OnNodeSelected(object sender, NodeEventArgs e)
{
     Debug.WriteLine("selected");
}

private void OnNodeClicked(object sender, NodeEventArgs e)
{
     Debug.WriteLine("clicked");
}

However the control does not raise NodeClicked if there is a CellClicked handler and you click over a cell.
  
Back to top
 
IP Logged
 
wojto
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Jan 20th, 2010
Re: Diagram.ClearAll() problem
Reply #4 - Jan 26th, 2010 at 10:23am
Print Post  
I have a CellDoubleClicked and NodeDoubleClicked (which works only in 1.3 beta) handlers.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.ClearAll() problem
Reply #5 - Jan 26th, 2010 at 10:26am
Print Post  
So you have handlers for Clicked, DoubleClicked and Selected, and in such case the Clicked events are not raised?
  
Back to top
 
IP Logged
 
wojto
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Jan 20th, 2010
Re: Diagram.ClearAll() problem
Reply #6 - Jan 27th, 2010 at 2:59pm
Print Post  
Yes, even if I only have NodeClicked handler, it is still not raised in my diagram with TableNodes. It works only when i click the node, drag the mouse then release the left mouse button - then NodeClicked is raised.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.ClearAll() problem
Reply #7 - Jan 27th, 2010 at 3:48pm
Print Post  
Could you copy here your diagram initialization code? Also, are you using the 1.3 released version?

Stoyan
  
Back to top
 
IP Logged
 
wojto
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Jan 20th, 2010
Re: Diagram.ClearAll() problem
Reply #8 - Jan 27th, 2010 at 4:09pm
Print Post  
Nothing special here:

<my:Diagram x:Name="dgSteps" LinkBrush="Green" ShapeBrush="LightSkyBlue"
             AlignToGrid="True" NodeClicked="dgSteps_NodeClicked" >

And then I create node like this:

TableNode rootNode = dgSteps.Factory.CreateTableNode(_bounds);
rootNode.Caption = "root";
rootNode[0, 0].Text = "test";

I use v1.2 because I can't show users "this is 1.3 beta" warning on top of every diagram  Wink
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.ClearAll() problem
Reply #9 - Jan 27th, 2010 at 5:29pm
Print Post  
Could you try that with V1.3? - we have released it on Monday
http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_news;action=display;num=126441279...

and you can download a licensed version here -
http://clientsarea.eu/
  
Back to top
 
IP Logged
 
wojto
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Jan 20th, 2010
Re: Diagram.ClearAll() problem
Reply #10 - Feb 1st, 2010 at 3:10pm
Print Post  
Yes, ver 1.3 seems to fix that problem. Thanks!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint