Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic BoxCreate Event in C# (Read 4503 times)
bemorem
YaBB Newbies
*
Offline


MacPro Xeon Quad

Posts: 44
Joined: May 3rd, 2007
BoxCreate Event in C#
Oct 2nd, 2007 at 2:57am
Print Post  
I needed following same function of delphi :

FC1.OnBoxCreated(self, box0);

Below code in c# not working.

what's the matter?

Thanks in advance.

Code
Select All
    private void FCX1_MouseDownEvent(object sender, AxFLOWCHARTLib._IFlowChartEvents_MouseDownEvent e)
    {
	if (this.IsNode == true)
	{
	  // Create a new box
	  FLOWCHARTLib.box b1 = FCX1.CreateBox(e.docX, e.docY, 10, 10);

	  FCX1.BoxCreated += new AxFLOWCHARTLib._IFlowChartEvents_BoxCreatedEventHandler(this.FCX1_BoxCreated);
	}
    }

    private void FCX1_BoxCreated(object sender, AxFLOWCHARTLib._IFlowChartEvents_BoxCreatedEvent e)
    {
  // But No Event Occur --;
}
 

  

HW: MacPro Xeon Quad/ 4GB RAM&&OS: WinXP sp3 / .NET 3.5&&Dev: VS 2008 C# sp1&&flowchart .Net ver 4.3.x&&
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: BoxCreate Event in C#
Reply #1 - Oct 2nd, 2007 at 4:55am
Print Post  
Maybe your "if" condition is never true? Add a breakpoint to the first line in the "if" block to see if it's executed.

Or if you are expecting BoxCreated to be raised in response to the CreateBox method - that won't happen because the Created events are raised only after users' actions.

Stoyan
  
Back to top
 
IP Logged
 
bemorem
YaBB Newbies
*
Offline


MacPro Xeon Quad

Posts: 44
Joined: May 3rd, 2007
Re: BoxCreate Event in C#
Reply #2 - Oct 2nd, 2007 at 5:38am
Print Post  
I know that.

So, I add the event effect like above.

In delphi, below code is the event occuring method. 

FC1.OnBoxCreated(self, box0);

I want same function in c#.
  

HW: MacPro Xeon Quad/ 4GB RAM&&OS: WinXP sp3 / .NET 3.5&&Dev: VS 2008 C# sp1&&flowchart .Net ver 4.3.x&&
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: BoxCreate Event in C#
Reply #3 - Oct 2nd, 2007 at 7:01am
Print Post  
Do you mean you need to call your event handler method after calling CreateBox()?
  
Back to top
 
IP Logged
 
bemorem
YaBB Newbies
*
Offline


MacPro Xeon Quad

Posts: 44
Joined: May 3rd, 2007
Re: BoxCreate Event in C#
Reply #4 - Oct 2nd, 2007 at 11:37am
Print Post  
Yes.
  

HW: MacPro Xeon Quad/ 4GB RAM&&OS: WinXP sp3 / .NET 3.5&&Dev: VS 2008 C# sp1&&flowchart .Net ver 4.3.x&&
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: BoxCreate Event in C#
Reply #5 - Oct 2nd, 2007 at 11:52am
Print Post  
FCX1.BoxCreated += new AxFLOWCHARTLib._IFlowChartEvents_BoxCreatedEventHandler(this.FCX1_BoxCreated);

does not call the event method, but attaches a handler that will be called when the user creates a box. Calling a method should look like

FCX1_BoxCreated(this, new AxFLOWCHARTLib._IFlowChartEvents_BoxCreatedEvent()).

If you need to execute the same code when boxes are created both programmatically or by the user, it might be easier to create a method that takes a simple Box argument, and call it both from the BoxCreated event handler and after CreateBox().

Stoyan
  
Back to top
 
IP Logged
 
bemorem
YaBB Newbies
*
Offline


MacPro Xeon Quad

Posts: 44
Joined: May 3rd, 2007
Re: BoxCreate Event in C#
Reply #6 - Oct 4th, 2007 at 12:42am
Print Post  
"Type Expected" error is broken at fcx1_boxcreated() line.



  

HW: MacPro Xeon Quad/ 4GB RAM&&OS: WinXP sp3 / .NET 3.5&&Dev: VS 2008 C# sp1&&flowchart .Net ver 4.3.x&&
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: BoxCreate Event in C#
Reply #7 - Oct 4th, 2007 at 6:15am
Print Post  
Just create a method that take a Box argument and call it both from the event handler and after CreateBox(), ok?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint