Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Can the Cursor be changed? (Read 3538 times)
cds
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: Apr 7th, 2010
Can the Cursor be changed?
Apr 11th, 2010 at 8:02am
Print Post  
I'm wanting to change the cursor on a diagram as follows:

The user clicks a button to add a new node and a dialog pops up which they fill in. On clicking OK I want to change the cursor on the digram to cue them they're in "add" mode and allow them to click to actually add the node in their selected position on the diagram.

I've tried setting the Cursor property but it doesn't seem to work.

Thanks,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Can the Cursor be changed?
Reply #1 - Apr 11th, 2010 at 8:39am
Print Post  
The diagram shows a cursor based on the current context while the mouse moves, and perhaps this overwrites your cursor. You could either override Behavior.SetMouseCursor and return the one you need, or set the cursor from the MouseMove handler as in the TreeLayout example to set your cursor over the context-sensitive one.

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


I love YaBB 1G - SP1!

Posts: 10
Joined: Apr 7th, 2010
Re: Can the Cursor be changed?
Reply #2 - Apr 11th, 2010 at 8:50am
Print Post  
OK, that does sound useful.

Next question: is it possible to cause the diagram to enter a particular mode programmatically as follows:

My nodes will be Controls which will have a template. In the template will be various buttons, one of which I want to use to allow the user to select a link type to add. Once selected, I want to start the operation programmatically (which would add a new link to the selected node) but go into the LinkCreating "mode" which they then finish by clicking the destination node. Is this possible?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Can the Cursor be changed?
Reply #3 - Apr 12th, 2010 at 7:20am
Print Post  
It could be possible by simulating the mouse gesture that starts drawing a link. Call the Behavior class OnMouseDown method immediately followed by OnMouseMove to do that. They are protected, so you can call them only from a derived class.

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


I love YaBB 1G - SP1!

Posts: 10
Joined: Apr 7th, 2010
Re: Can the Cursor be changed?
Reply #4 - Apr 13th, 2010 at 2:05am
Print Post  
Hi Stoyan

Your suggestion of the OnMouseDown/OnMouseMove doesn't work.

If I'm to call base.OnMouseDown and base.OnMouseMove I need to pass the MouseButtonEventArgs and MouseEventArgs objects.

Those classes have internal constructors, so only the framework can create instances of them, and the base class methods fail if I pass null.

Any other ideas?

Thanks,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Can the Cursor be changed?
Reply #5 - Apr 14th, 2010 at 11:29am
Print Post  
Hi Craig,

https://mindfusion.eu/_beta/diaglite_startintr.zip

We have added a StartInteraction method you could call in response to the button click:

var link = new DiagramLink(diagram, originNode, mousePosition);
diagram.Links.Add(link);
diagram.StartInteraction(
     new InteractionState(link, Action.Create, 1, mousePosition));

The diagram will be in a draw-link mode after this and the mouse will be moving the link's end point.

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


I love YaBB 1G - SP1!

Posts: 10
Joined: Apr 7th, 2010
Re: Can the Cursor be changed?
Reply #6 - Apr 14th, 2010 at 10:04pm
Print Post  
Thanks Stoyan

That's interesting, though it seems a little buggy. If I move the mouse quickly it goes out of the link add mode and into the Drag-select mode.

However, I've now found another way of accomplishing what I want to do so probably won't need that functionality in the end.

I'm intending on purchasing the component today.

Cheers...

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