Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ButtonComponent (Read 1352 times)
billcollis
YaBB Newbies
*
Offline


I love mindfusion

Posts: 19
Location: Auckland, NZ
Joined: Jun 4th, 2011
ButtonComponent
Jun 8th, 2013 at 7:42pm
Print Post  
I have buttoncomponents working with clicked event
but want to use mousedown and mouseup events separately how do I do this and identify the button that was clicked
thanks
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: ButtonComponent
Reply #1 - Jun 9th, 2013 at 7:39am
Print Post  
You need to inherit the ButtonComponent class and override the OnMouseDown and OnMouseUp methods, then raise some custom events. The following code illustrates a sample implementation of the custom button:

Code
Select All
public class MyButton : ButtonComponent
{
	public override void OnMouseDown(PointF point)
	{
		base.OnMouseDown(point);

		if (Down != null)
			Down(this, EventArgs.Empty);
	}

	public override void OnMouseUp(PointF point)
	{
		base.OnMouseUp(point);

		if (Up != null)
			Up(this, EventArgs.Empty);
	}

	public event EventHandler Down;
	public event EventHandler Up;
} 


If you are loading the contents of your composite node through a XmlLoader, the class of the custom button should be resolved automatically. If this is not the case you could supply a custom ITypeResolver object to the XmlLoader.Load method.

Regards,
Meppy
  
Back to top
 
IP Logged
 
billcollis
YaBB Newbies
*
Offline


I love mindfusion

Posts: 19
Location: Auckland, NZ
Joined: Jun 4th, 2011
Re: ButtonComponent
Reply #2 - Jun 13th, 2013 at 10:38am
Print Post  
Thanks
I see where I had messed up now
All working well
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint