Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic No click event for custom shape? (Read 1905 times)
Vincent
Junior Member
**
Offline


I Love MindFusion!

Posts: 62
Joined: Oct 3rd, 2013
No click event for custom shape?
Dec 19th, 2013 at 2:06pm
Print Post  
Hi Stoyan,

In our operator node (with the left and right slot), we want to catch the event when an user clicks on the slot. I did this by overriding the method OnMouseLeftButtonUp but this method is never reached in the debugger when I click on a slot.

I temporarily commented the override of ContainsPoint out but this doesn't help either.

Do you have an idea? Is it perhaps the override of Draw()?

Code
Select All
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonUp(e);

            Point mousePosition = e.GetPosition(this);
            Rect detectionArea = new Rect(...);
            if (detectionArea.Contains(mousePosition))
            {
                //Do something
            }
        }
 



Thanks in advance!

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: No click event for custom shape?
Reply #1 - Dec 19th, 2013 at 4:53pm
Print Post  
Since your node class doesn't contain any child graphic elements in the slot area, WPF won't pass mouse events to a node when you click inside its slot. Try filling the slot area with not-entirely transparent color but one with very small alpha value, and you should start getting events.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Vincent
Junior Member
**
Offline


I Love MindFusion!

Posts: 62
Joined: Oct 3rd, 2013
Re: No click event for custom shape?
Reply #2 - Dec 20th, 2013 at 7:56am
Print Post  
Works impeccably, thanks!  Smiley

Greets,

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