Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic CellBoundsChanged not being fired (Read 4671 times)
David Long
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 153
Location: England
Joined: Oct 23rd, 2006
CellBoundsChanged not being fired
Apr 2nd, 2008 at 1:15pm
Print Post  
I'd like to resize my chart boxes in a LaneGrid type chart when the cells are re-sized and so have added the following line to the form constructor after InitializeComponent:

           flowChart.LaneGrid.CellBoundsChanged += new CellBoundsEventHandler(LaneGrid_CellBoundsChanged);

Everything works well on a new form: my function, LaneGrid_CellBoundsChanged is called but when I load a chart from disk the event does not seem to be fired when the cells are re-sized - debugging shows that the constructor is called ok and the above line of code is executed.

I'm using version FlowChart .NET version 4.3.1

Any help gratefully received.

DavidL

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CellBoundsChanged not being fired
Reply #1 - Apr 2nd, 2008 at 1:22pm
Print Post  
Perhaps there is a new LaneGrid object created when loading from a file, and you should attach the event handler each time after calling LoadFromFile.

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


I love YaBB 1G - SP1!

Posts: 153
Location: England
Joined: Oct 23rd, 2006
Re: CellBoundsChanged not being fired
Reply #2 - Apr 2nd, 2008 at 3:42pm
Print Post  
Yes, when I load a file, a new form with associated FlowChart and LaneGrid are created and the form's constructor is called (including the line to add the new event handler), but still no events are fired in this case.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CellBoundsChanged not being fired
Reply #3 - Apr 2nd, 2008 at 5:51pm
Print Post  
What does you file loading code look like? If you call LoadFromFile after the original LaneGrid's event handler is set, you end up with a new LaneGrid object without any handlers attached to it, and the original LaneGrid (to which you've attached the handler) is discarded.

Stoyan
  
Back to top
 
IP Logged
 
David Long
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 153
Location: England
Joined: Oct 23rd, 2006
Re: CellBoundsChanged not being fired
Reply #4 - Apr 2nd, 2008 at 8:18pm
Print Post  
Yes, this does seems to make sense.  So I've added a call to add the event handler every time I sucessfully load a file. e.g.

           OpenFileDialog dlg = new OpenFileDialog();

           dlg.DefaultExt = "step";
           dlg.Filter = "STEP files (*.step)|*.step";
           dlg.Title = "Open STEP File";
           dlg.FilterIndex = 0;

           if (dlg.ShowDialog(this) == DialogResult.OK)
           {
                   LoadFromFile(dlg.FileName);
                   flowChart.LaneGrid.CellBoundsChanged += new CellBoundsEventHandler(LaneGrid_CellBoundsChanged);
            }

However, I still have the same problem.  I may be doing something stupid, but I can't spot what it is!  In principle am I doing the right thing?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CellBoundsChanged not being fired
Reply #5 - Apr 3rd, 2008 at 7:13am
Print Post  
You've mentioned you are creating a new form and flowchart when loading a form. Is the flowChart member from this line

flowChart.LaneGrid.CellBoundsChanged += ...

the same as the one created by the LoadFromFile method called jsut above it?

Stoyan
  
Back to top
 
IP Logged
 
David Long
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 153
Location: England
Joined: Oct 23rd, 2006
Re: CellBoundsChanged not being fired
Reply #6 - Apr 3rd, 2008 at 11:00am
Print Post  
There should be only one flowChart object in my form - the one created in InitializeComponent - I don't "new" any others.  I've moved the line:

flowChart.LaneGrid.CellBoundsChanged += ....

to my LoadFromFile() function placing it after the call to:

     flowChart.LoadFromStream(stream);

But still no joy.  Any Ideas?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CellBoundsChanged not being fired
Reply #7 - Apr 3rd, 2008 at 4:33pm
Print Post  
Hi,

Look in the private messages area for a fixed dll.

Stoyan
  
Back to top
 
IP Logged
 
David Long
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 153
Location: England
Joined: Oct 23rd, 2006
Re: CellBoundsChanged not being fired
Reply #8 - Apr 3rd, 2008 at 11:31pm
Print Post  
Many thanks: new DLLs work well.  Thanks for excellent support  Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint