Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Moving nodes using Keys (Read 7425 times)
madhan1
Full Member
***
Offline


FOLLOW NO ONE BUT LEARN
FROM EVERY ONE ..

Posts: 101
Location: India
Joined: Feb 17th, 2010
Moving nodes using Keys
Aug 17th, 2012 at 12:25pm
Print Post  
dear stoyo,

        i want to move the nodes up,down,left and right using keys. but i am not able to catch the keys "diagramView_KeyDown" kindly help
  

if you want something then go and grab it
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Moving nodes using Keys
Reply #1 - Aug 17th, 2012 at 1:24pm
Print Post  
The Windows Forms framework does not raise KeyDown for arrow keys. You can detect them using PreviewKeyDown instead:
http://mindfusion.eu/Forum/YaBB.pl?num=1323665629/1#1

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
madhan1
Full Member
***
Offline


FOLLOW NO ONE BUT LEARN
FROM EVERY ONE ..

Posts: 101
Location: India
Joined: Feb 17th, 2010
Re: Moving nodes using Keys
Reply #2 - Aug 18th, 2012 at 4:30am
Print Post  
Thanks stoyo,

             it works only first time. when i am press the left key continuously the event is not fired. kindly help
  

if you want something then go and grab it
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Moving nodes using Keys
Reply #3 - Aug 20th, 2012 at 8:04am
Print Post  
It is raised continuously in my test project. If it is raised only once in your application, perhaps the DiagramView loses the keyboard focus after the first key-press. You can verify that by adding a breakpoint to the DiagramView.Leave event handler; then you should be able to see in the call-stack window what exactly changes the focus.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
madhan1
Full Member
***
Offline


FOLLOW NO ONE BUT LEARN
FROM EVERY ONE ..

Posts: 101
Location: India
Joined: Feb 17th, 2010
Re: Moving nodes using Keys
Reply #4 - Aug 20th, 2012 at 11:25am
Print Post  
Dear stoyan,

My call stack,kindly check and help

Telephony.exe!Telephony.Form1.diagramView_Leave(object sender = {MindFusion.Diagramming.WinForms.DiagramView}, System.EventArgs e = {System.EventArgs}) Line 16754      C#
     System.Windows.Forms.dll!System.Windows.Forms.Control.OnLeave(System.EventArgs e) + 0x70 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Control.NotifyLeave() + 0x20 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.UpdateFocusedCont
rol() + 0x2e2 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.AssignActiveContr
olInternal(System.Windows.Forms.Control value = {System.Windows.Forms.PropertyGrid}) + 0x54 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ActivateControlIn
ternal(System.Windows.Forms.Control control, bool originator = false) + 0x76 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.SetActiveControlI
nternal(System.Windows.Forms.Control value = {System.Windows.Forms.PropertyGrid}) + 0x73 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.SetActiveControl(
System.Windows.Forms.Control ctl) + 0x33 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ActiveControl.set
(System.Windows.Forms.Control value) + 0x5 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.Select(bool directed = true, bool forward = true) + 0x42 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Control.SelectNextControl(System.W
indows.Forms.Control ctl, bool forward, bool tabStopOnly, bool nested, bool wrap) + 0x7b bytes      
     System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ProcessArrowKey(b
ool forward) + 0x3f bytes      
     System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ProcessDialogKey(
System.Windows.Forms.Keys keyData = LButton | RButton | MButton | Space) + 0x6c bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Form.ProcessDialogKey(System.Windo
ws.Forms.Keys keyData) + 0xf8 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Control.ProcessDialogKey(System.Wi
ndows.Forms.Keys keyData) + 0x16 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Control.PreProcessMessage(ref System.Windows.Forms.Message msg) + 0xe2 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Control.PreProcessControlMessageIn
ternal(System.Windows.Forms.Control target = {MindFusion.Diagramming.WinForms.DiagramView}, ref System.Windows.Forms.Message msg = {System.Windows.Forms.Message}) + 0x101 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.PreTrans
lateMessage(ref System.Windows.Forms.NativeMethods.MSG msg = {System.Windows.Forms.NativeMethods.MSG}) + 0xf6 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.System.W
indows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(ref System.Windows.Forms.NativeMethods.MSG msg) + 0x5 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.Syste
m.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int dwComponentID, int reason = -1, int pvLoopData = 0) + 0x22e bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessa
geLoopInner(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x177 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessa
geLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x61 bytes      
     System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.For
ms.Form mainForm) + 0x31 bytes      
     Telephony.exe!Telephony.Form1.Main(string[] args = {string[0]}) Line 1919 + 0x2d bytes      C#
     [Native to Managed Transition]      
     [Managed to Native Transition]      
     mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x3a bytes      
     Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.Hosti
ngProcess.HostProc.RunUsersAssembly() + 0x2b bytes      
     mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x66 bytes      
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionCon
text executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes      
  

if you want something then go and grab it
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Moving nodes using Keys
Reply #5 - Aug 21st, 2012 at 7:01am
Print Post  
There's a ContainerControl.ProcessArrowKey method that handles the arrow keys and calls UpdateFocusedControl, which I suppose is what moves the focus away from the view. ContainerControl is a base for UserControl; if you have placed the DiagramView inside a user control, check this SO post:
http://stackoverflow.com/questions/6177201/how-to-prevent-usercontrol-form-handl...
  
Back to top
 
IP Logged
 
madhan1
Full Member
***
Offline


FOLLOW NO ONE BUT LEARN
FROM EVERY ONE ..

Posts: 101
Location: India
Joined: Feb 17th, 2010
Re: Moving nodes using Keys
Reply #6 - Aug 21st, 2012 at 8:34am
Print Post  
Dear stoyan,

              Thanks a lot,it works fine.

But i am not able to move the input node (shape node and Table combined ) and not able to move multiple nodes at a same time
  

if you want something then go and grab it
Back to top
 
IP Logged
 
madhan1
Full Member
***
Offline


FOLLOW NO ONE BUT LEARN
FROM EVERY ONE ..

Posts: 101
Location: India
Joined: Feb 17th, 2010
Re: Moving nodes using Keys
Reply #7 - Aug 23rd, 2012 at 4:33am
Print Post  
Hi stoyan,

        is it possible to do.give some ideas so that i will try.
  

if you want something then go and grab it
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Moving nodes using Keys
Reply #8 - Aug 23rd, 2012 at 6:42am
Print Post  
Ideas about what?
  
Back to top
 
IP Logged
 
madhan1
Full Member
***
Offline


FOLLOW NO ONE BUT LEARN
FROM EVERY ONE ..

Posts: 101
Location: India
Joined: Feb 17th, 2010
Re: Moving nodes using Keys
Reply #9 - Aug 23rd, 2012 at 7:18am
Print Post  
moving multiple selected nodes
  

if you want something then go and grab it
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Moving nodes using Keys
Reply #10 - Aug 23rd, 2012 at 8:07am
Print Post  
You can get a list of selected nodes through diagram.Selection.Nodes.
  
Back to top
 
IP Logged
 
madhan1
Full Member
***
Offline


FOLLOW NO ONE BUT LEARN
FROM EVERY ONE ..

Posts: 101
Location: India
Joined: Feb 17th, 2010
Re: Moving nodes using Keys
Reply #11 - Aug 23rd, 2012 at 10:18am
Print Post  
Thanks stoyan,

           it worked Smiley
  

if you want something then go and grab it
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint