Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic CellBoundsEventArgs.OldBounds Property Y coord (Read 1821 times)
tom_w
Junior Member
**
Offline


Swimlanes made our dreams
come true :-)

Posts: 79
Joined: Oct 20th, 2008
CellBoundsEventArgs.OldBounds Property Y coord
Nov 13th, 2008 at 12:21pm
Print Post  
Hi there

I'm getting some strange behaviour with the code below:

Code
Select All
    Private Sub LaneGrid_CellBoundsChanged(ByVal sender As Object, ByVal e As CellBoundsEventArgs)

         If e.NewBounds.Y <> e.OldBounds.Y Then
            For Each actNode As ActivityNode In diagram.Nodes
                If e.OldBounds.Contains(actNode.GetCenter) Then
                    Dim vertMoveDist = e.NewBounds.Y - e.OldBounds.Y

                    actNode.Bounds = New RectangleF(actNode.Bounds.X, actNode.Bounds.Y + vertMoveDist, actNode.Bounds.Width, actNode.Bounds.Height)
                End If
            Next
        End If


        'reset the diagram size to match the grid
        SetBoundsToGrid()
    End Sub 



What I am trying to achieve is: when a user resizes a lane (i.e. a diagram.lanegrid rowheader) the nodes in all of the lanes below the lane that was resized should move down by the amount that the lane was resized by.

The problem comes with comparing the new and old Y values:

Assume a grid with two lanes (i.e two cells)

     Lane 0: X = 0, Y = 0, Height = 20, Width = 100
     Lane 1: X = 0, Y = 20, Height = 20, Width = 100

If I resize lane 0 from height of 20 to height of 30, lane 1's newbounds.Y will correctly show as 30, but the oldbounds.Y is not 20.

All the other values for the oldbounds (X, width, height) are correct but the Y is not.

Is this a bug or am I being an idiot?


On a related note, am I right to be doing this in the first place or is there some built in features to do the above - i.e. to keep the nodes in their lanes when a lane is resized? It isn't that useful to resize a lane and for all of the nodes below to stay put while their lanes move I guess.

Many thanks

Tom


Edit for the benefit of anyone else looking at this later: The activityNode is a custom type derived from the ShapeNode class. The code above should work in the same way for anything derived from DiagramNode.


Edit2:  I have a workround for this so no panic.
« Last Edit: Nov 13th, 2008 at 4:44pm by tom_w »  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: CellBoundsEventArgs.OldBounds Property Y coord
Reply #1 - Nov 14th, 2008 at 10:23am
Print Post  
This appears to be a bug. We have fixed it and it should be available in the next release. If you need it sooner than this, you will have to contact my colleagues through e-mail and they will send you a patched version.

Thank you,
Meppy
  
Back to top
 
IP Logged
 
tom_w
Junior Member
**
Offline


Swimlanes made our dreams
come true :-)

Posts: 79
Joined: Oct 20th, 2008
Re: CellBoundsEventArgs.OldBounds Property Y coord
Reply #2 - Nov 14th, 2008 at 10:29am
Print Post  
Thanks Meppy, I have worked round it.

Just to double check: am I right in saying there is no inbuilt functionality that keeps nodes in their relative positions in the lanes when another lane is resized.

The functionality at the moment whereby resizing a lane doesn't move the nodes in the lanes below doesn't seem that useful to me, but maybe I am missing something?

Thanks,

Tom
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: CellBoundsEventArgs.OldBounds Property Y coord
Reply #3 - Nov 14th, 2008 at 2:10pm
Print Post  
That's correct - the current lane grid implementation does not automatically modify the contents of the diagram in any way (including automatic node position adjustment). We might think of an option to enable such functionality in the future.

Meppy
  
Back to top
 
IP Logged
 
tom_w
Junior Member
**
Offline


Swimlanes made our dreams
come true :-)

Posts: 79
Joined: Oct 20th, 2008
Re: CellBoundsEventArgs.OldBounds Property Y coord
Reply #4 - Nov 14th, 2008 at 2:13pm
Print Post  
Great stuff, thanks Meppy.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint