Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Porblem with the clearAll function (Read 1550 times)
cas_ramos
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Oct 17th, 2006
Porblem with the clearAll function
Oct 17th, 2006 at 9:41am
Print Post  
I.

I'm having a problem with the function clearAll(). When executing a function (that draws the workflow) from the boxcreated property to redraw everything, the component "explode" giving a message "Object reference not set to an instance of an object." and shows the assembly window. The problem can't be from the code because i have a try..catch block and do not enter in the cacth state.

Best regards,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Porblem with the clearAll function
Reply #1 - Oct 17th, 2006 at 11:52am
Print Post  
Hi,

It seems the control does not expect ClearAll to be called from BoxCreated, and uses the reference of the just created-box after the event. You could work around that by deleting the items as follows:

private void fc_BoxCreated(object sender, MindFusion.FlowChartX.BoxEventArgs e)
{
while (fc.Boxes.Count > 0)
fc.DeleteObject(fc.Boxes[0]);
}

DeleteObject sets a flag that makes the flowchart MouseUp handler exit immediately after raising BoxCreated, which prevents using the reference to the deleted box.

Stoyan
  
Back to top
 
IP Logged
 
cas_ramos
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Oct 17th, 2006
Re: Porblem with the clearAll function
Reply #2 - Oct 18th, 2006 at 8:06am
Print Post  
OK. That resolved my problem. Thanks.

Carlos Ramos
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint