Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic KeyBoard navigation on specific nodes (Read 4280 times)
priyanka
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
KeyBoard navigation on specific nodes
Oct 20th, 2009 at 9:42am
Print Post  
Hi,

I need to navigate on the nodes of the diagram using keyboard arrow keys.

But also I need to move the focus only on a specific set of nodes in diagram not on all the nodes.

How could I do this.??

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: KeyBoard navigation on specific nodes
Reply #1 - Oct 20th, 2009 at 12:27pm
Print Post  
Hi,

Are you using the built-in arrow keys navigation? If it's close enough to what you need, but you’d like to filter out some items, we could add a validation event to allow that. Otherwise you can add your own command bindings to the arrow keys.

Stoyan
  
Back to top
 
IP Logged
 
priyanka
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Re: KeyBoard navigation on specific nodes
Reply #2 - Oct 20th, 2009 at 12:31pm
Print Post  
Hi Stoyo,

Yes I am using the built in arrow keys navigation.

Actually I have two parent node and I need to navigate within the child nodes of those parent nodes only but in a specific pattern.

So could you please guide me on how could I get this done.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: KeyBoard navigation on specific nodes
Reply #3 - Oct 20th, 2009 at 1:03pm
Print Post  
You can override the default navigation like this:

Code
Select All
// in the window constructor/onload
diagram.CommandBindings.Add(new CommandBinding(
	Diagram.NavigateDown, (sender, args) => { MyNavigateDown(); }));

private void MyNavigateDown()
{
	diagram.Selection.Change(...);
}
 



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


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Re: KeyBoard navigation on specific nodes
Reply #4 - Oct 20th, 2009 at 1:23pm
Print Post  
Hi Stoyo,

Thanks for your quick response.!!!!!

What if i want the nodes to be selected on tab press.??

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: KeyBoard navigation on specific nodes
Reply #5 - Oct 20th, 2009 at 3:49pm
Print Post  
This is the only way I've found doing that without tabbing out of the control:

Code
Select All
diagram.PreviewKeyDown += new KeyEventHandler(diagram_PreviewKeyDown);

void diagram_PreviewKeyDown(object sender, KeyEventArgs e)
{
	if (e.Key == Key.Tab)
	{
		MyNavigateDown();
		e.Handled = true;
	}
}
 



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


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Re: KeyBoard navigation on specific nodes
Reply #6 - Nov 2nd, 2009 at 7:22am
Print Post  
Hi,

By overridding the default implemetation for Diagram.NavigateDown I am able to provide the custom implementation for Navigating the nodes.

But the diagram_NodeModified event is fired every time the node is moved.

Due to this I am only able to move the node at one step down and validation for the position of node is made(at NodeModified).
And if validation fails I am not able to move it further down

But I want the Modified event to be Raised only when I Release the Down arrow key(On Key up of down arrow key) and the validate the position of Node at that point.

How could I restrict the ModeModified event to be called on every move of the node.

Thanks,
Priyanka
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: KeyBoard navigation on specific nodes
Reply #7 - Nov 2nd, 2009 at 12:48pm
Print Post  
Are you moving the node by calling SetRect(Rect, true) to raise the NodeModified event?

Stoyan
  
Back to top
 
IP Logged
 
priyanka
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Re: KeyBoard navigation on specific nodes
Reply #8 - Nov 2nd, 2009 at 12:59pm
Print Post  
No I am not using the SetRect() to move the node.

I am using the node.Move() to move the node to a different location.

And after the MyNavigateDown() gets completed the diagram_NodeModified() event is called.

I want it diagram_NodeModified() to be called only when I am finish with moving to the node to any specific location ie. when the user released the down arrow key,and not after every move of the node.

Priyanka

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: KeyBoard navigation on specific nodes
Reply #9 - Nov 2nd, 2009 at 1:26pm
Print Post  
node.Move() does not raise this event - I suppose you are calling the handler method after each Move? You might add a bool parameter to MyNavigateDown() and call the Modified handler only if the argument is set to true. Then handle both KeyDown and KeyUp events, call MyNavigateDown(false) from the down handler, and MyNavigateDown(true) from the up handler. KeyUp should not be raised while KeyDown repeats because the arrow key is held down, so you will get NodeModified called only once.

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