Page Index Toggle Pages: 1 [2]  Send TopicPrint
Hot Topic (More than 10 Replies) Custom Node Type (Read 11712 times)
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom Node Type
Reply #15 - Sep 13th, 2013 at 8:36am
Print Post  
What else does your MouseDown handler do? This shows the cursor correctly in my test project every time the pointer enters the image area:

Code
Select All
<Image
	Width="55" Height="55" Source="Resources\Icons\icon.png"
	x:Name="image"
	Cursor="Cross"
	MouseDown="OnImageMouseDown" />

private void OnImageMouseDown(object sender, MouseButtonEventArgs e)
{
	string label = (string)textblock.Content;
	textblock.Content = label + "+";

	var node = Diagram.GetDiagramItem(this) as DiagramNodeAdapter;
	if (node != null)
		node.Parent.CancelDrag();
} 



However the diagram control changes the cursor between mouse down and up events. You can override this by setting the OverrideCursor property, or using a custom behavior class.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
esri_test
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 44
Joined: Aug 21st, 2013
Re: Custom Node Type
Reply #16 - Sep 13th, 2013 at 3:33pm
Print Post  
This still doesn't work for me.

I got similar thing as yours in a usercontrol. I put this usercontrol in a nodelistview, drag & drop this usercontrol to a diagram, create a node, the first time into image, the cursor is a cross, clicked it, give me what the mousedown handler supposed to do, called Diagram.CancelDrag, no drag link lines appears, but when I move the cursor back to the node, it always shows the hand cursor until I click the node or somewhere else in the diagram.

It looks to me it still waits for another click to finish the link draw between nodes although I called Diagram.CancelDrag.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom Node Type
Reply #17 - Sep 13th, 2013 at 4:25pm
Print Post  
What Diagram.Behavior value are you using, and are you showing any UI objects such as menus or message boxes from the image.MouseDown handler? You could also try handling the MouseUp event instead of Down.
  
Back to top
 
IP Logged
 
esri_test
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 44
Joined: Aug 21st, 2013
Re: Custom Node Type
Reply #18 - Sep 13th, 2013 at 4:33pm
Print Post  
I didn't set Diagram.Behavior value, but you are right, I do show a UI object as a message box from image.MouseDown handler. So you think this messagebox is the trouble maker?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom Node Type
Reply #19 - Sep 13th, 2013 at 4:56pm
Print Post  
This seems some WPF-wide problem, probably related to management of mouse capture. Even the menus and the window close button don't work unless you click them a second time. Showing the message box from a Preview event seems to work fine though:

Code
Select All
<Image
	Width="55" Height="55" Source="Resources\Icons\icon.png"
	x:Name="image"
	Cursor="Cross"
	PreviewMouseDown="OnImageMouseDown" />

private void OnImageMouseDown(object sender, MouseButtonEventArgs e)
{
	string label = (string)textblock.Content;
	textblock.Content = label + "+";

	var node = Diagram.GetDiagramItem(this) as DiagramNodeAdapter;
	if (node != null)
	{
		node.Parent.CancelDrag();
		MessageBox.Show("trouble maker");
	}
}  



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint