Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Move Node only (Read 4638 times)
yrauma
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Move Node only
Jul 14th, 2010 at 11:44am
Print Post  
Hello Stoyan,

quick question for you.
How can I move a node (programmatically of course) without moving the container in which it is.

I use Node.SetBounds(Bounds, false, true) but it still moves the container un which the node is...

Any idea ?

Thanks
Amaury
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Move Node only
Reply #1 - Jul 14th, 2010 at 12:00pm
Print Post  
Hi Amaury,

Is SetBounds the only code you are running in that case? The container does not update in my test after child.SetBounds(), unless I also call container.UpdateBounds().

Stoyan
  
Back to top
 
IP Logged
 
yrauma
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Re: Move Node only
Reply #2 - Jul 14th, 2010 at 2:09pm
Print Post  

Hello Stoyan.

No update bounds is not called unfortunatly..
I also noticed that this does not happen when I move only one node but with at least 2.

what can I try to override to see who is moving my container ?
any other idea ?

Thanks
Amaury
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Move Node only
Reply #3 - Jul 14th, 2010 at 2:21pm
Print Post  
Hi Amaury,

Try overriding the container's OnUpdateBounds method.

Stoyan
  
Back to top
 
IP Logged
 
yrauma
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Re: Move Node only
Reply #4 - Jul 14th, 2010 at 2:31pm
Print Post  

Hello Stoyan

Here is what I override
Code
Select All
	  public new void UpdateBounds()
	  {
		base.UpdateBounds();
	  }

	  public new RectangleF Bounds
	  {
		get { return base.GetBounds(); }
		set
		{
		    base.Bounds = value;
		}
	  }

	  protected override void OnUpdateBounds()
	  {
		base.OnUpdateBounds();
	  }
 



None of them are called....
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Move Node only
Reply #5 - Jul 14th, 2010 at 5:28pm
Print Post  
If your container class overrides Draw(), check if it renders the correct Bounds rectangle. The control itself should always call OnUpdateBounds when it's changing the Bounds value - could you verify if it really changes after moving the children?
  
Back to top
 
IP Logged
 
yrauma
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Re: Move Node only
Reply #6 - Jul 14th, 2010 at 5:46pm
Print Post  
Hello Stoyan

Actually you are right.
When I move the node wich is into a container from the shcematic view, it moves the container.
But calling the methode Node.Move or setting the bounds of the node doesn't not move the container...

Even though when I move 2 nodes it seems that it moves the group...

How weird is that.
I am hintless on that one :S
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Move Node only
Reply #7 - Jul 15th, 2010 at 7:20am
Print Post  
Hi Amaury,

Could you copy here the initial Bounds values for the child nodes and the container and the new values you are setting?

Stoyan
  
Back to top
 
IP Logged
 
yrauma
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Re: Move Node only
Reply #8 - Jul 15th, 2010 at 2:24pm
Print Post  
Hello Stoyan,

Ok, so first Ill show you a bit of code to put you in context.

In my containers I overide the draw & GetBounds Fuctions.

Here is my container's GetBounds Function
Code
Select All
public override RectangleF GetBounds()
{
RectangleF bounds = new RectangleF(
base.GetBounds().X,
base.GetBounds().Y,
Folded ? _foldedWidth : base.GetBounds().Width,
Folded ? _foldedHeight : base.GetBounds().Height);

return bounds;
}
 



I move the nodes in an undo operation. Which means the nodes are still in the container when I move them but removed right after.
I use the move function :
Code
Select All
node.Move(location.X, location.Y);
 


I tried the setBounds(location, false, true) functions but it didn't changed anything, and the move function fix another bug I have.

So when I place just 1 node into my container and undo the operation, the node is moved back to where it was and the container does not move which is exactly what I want.
But if I put 2 nodes in the container at the same time (as a Selection), when I undo, 2 move operations are called, one on each node, at this step, the container is moved which is strange...

I put a print for the container bounds into my Container.GetBounds overriden fuction and I wrapped the move operation of the node with other print.
Here are the results

Code
Select All
*Initial  container bounds (the 2 nodes are in the container)*
Container Bounds : X=359,4416 Y=78,63958 W=61,88333 H=58,44166
*Move back first node*
---- Move node to X=421,2499 Y=184,9916
     Initial node bounds X=369,4416 Y=95,63958
     Final node bounds X=421,2499 Y=184,9916
*Move back second node*
---- Move node to X=470,4625 Y=162,9354
     Initial node bounds X=386,325 Y=102,0812
     Final node bounds X=470,4625 Y=162,9354
*2 calls to container.GetBounds(), first is correct, second is not, who changed it ?*
Container Bounds : X=359,4416 Y=78,63958 W=61,88333 H=58,44166
Container Bounds : X=460,4625 Y=145,9354 W=50 H=52
 




I hope it is clear enough,
thanks again for the help.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Move Node only
Reply #9 - Jul 16th, 2010 at 5:13am
Print Post  
Are you moving nodes in response to ActionRecorded and ActionUndone events? This might mess up the undo records and the container could be restoring to some intermediate state. If your container size is a calculated value, you might try setting it from a RestoreState override after the base values are restored.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
yrauma
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Re: Move Node only
Reply #10 - Jul 16th, 2010 at 12:58pm
Print Post  
Hi Stoyan.

No at all, I use my own undo/redo system. The one that I use in the rest of my application'
I do not use the mindfusion undo/redo
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Move Node only
Reply #11 - Jul 16th, 2010 at 3:30pm
Print Post  
I don't have any other ideas then. If you send us a sample project that reproduces this, our developer will debug the flowchart code to see what happens.

Stoyan
  
Back to top
 
IP Logged
 
yrauma
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Mar 28th, 2010
Re: Move Node only
Reply #12 - Jul 16th, 2010 at 9:49pm
Print Post  
Hello Stoyan,

unfortunatly I cant give you any code from our project. The security departement will kill me.

I have been able to build your source code, so I guess I will just plug it in my application and debug it !

Thanks for the help.
Amaury
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint