Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Lack of screen updates when using OnModify() (Read 2245 times)
Rennie
Full Member
***
Offline


I Love MindFusion!

Posts: 108
Location: Copenhagen, Denmark
Joined: Jul 17th, 2012
Lack of screen updates when using OnModify()
Apr 2nd, 2013 at 10:05am
Print Post  
I'm using a custom node class, derived from DiagramNode. In a previous version of my program that did not use OnModify() you could see the node being moved or resized as it was done. Now I'm trying to use OnModify(), and the node is not resized or moved until I release the mouse button. In other words, while the mouse is being moved there is no visual feedback that the move or resize operation is working - even though it is working.

Is there some way to get the same mouse-screen interaction when using OnModify() as when not using it?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Lack of screen updates when using OnModify()
Reply #1 - Apr 2nd, 2013 at 12:33pm
Print Post  
OnModify is called just before raising the NodeModified event, and there shouldn't be any differences with your previous version if OnModify runs exactly the same code as previous NodeModified handler:

Code
Select All
internal void RaiseModified(DiagramNode node, PointF mousePosition, AdjustmentHandles adjustmentHandle)
{
    node.OnModify(mousePosition, adjustmentHandle);

    NodeEventArgs e = new NodeEventArgs(node, mousePosition, adjustmentHandle);
    RaiseNodeModified(e);
} 



So check for differences between the OnModify / NodeModified code in both versions, or look for the problem somewhere else (e.g. Draw or DrawLocal overrides).

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


I Love MindFusion!

Posts: 108
Location: Copenhagen, Denmark
Joined: Jul 17th, 2012
Re: Lack of screen updates when using OnModify()
Reply #2 - Apr 2nd, 2013 at 9:49pm
Print Post  
Thanks. This was my mistake - I thought the OnModify event was fired continuously during the mouse movement, but it's only fired once at the end of the modification.

But now I've run into another problem.

I'm trying to have my custom node defined primarily via some added fields in the derived class, and not primarily defined by the Bounds object.

After determining that OnModify was not what I needed to provide continuous updating during a move or resize I figured that Diagram.NodeModifying was the way to go. But that event was not firing at all - at least until I discovered that having a Node.AllowModify override method that always returned true was preventing the Diagram.NodeModifying event from being fired. This seems strange, and isn't documented as far as I can see. (Please either fix the code or document this behavior.)

So removing the Node.AllowModify method permits Diagram.NodeModifying to be used, and now I can see the movement of one node happening as it happens.

But now I've discovered that Diagram.NodeModifying does not get fired if multiple nodes are being moved! So I still don't have a viable solution - I do want to be able to show multiple nodes being moved as they are moved.

What to do?

Edit: The StartDraw() method in my custom Behavior class is not getting called either when multiple nodes are being moved.
« Last Edit: Apr 2nd, 2013 at 11:53pm by Rennie »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Lack of screen updates when using OnModify()
Reply #3 - Apr 3rd, 2013 at 7:48am
Print Post  
There is the SelectionMoving event raised if moving multiple selected nodes. If you need to update your fields from a node's Bounds while the node is being moved or resized, the best method to override should be OnUpdateBounds().

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