Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Direction Keys not firing KeyDown event (Read 2188 times)
gamesmeister
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 14
Joined: Aug 2nd, 2006
Direction Keys not firing KeyDown event
Oct 24th, 2006 at 7:02pm
Print Post  
As per the subject, I've added a KeyDown event to my flowchart. It seems to pick up every key except the cursor (directional) keys, which don't seem to fire the event.

Any idea why not?

Many thanks
Gerry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Direction Keys not firing KeyDown event
Reply #1 - Oct 25th, 2006 at 5:15am
Print Post  
The cursor keys are used for form navigation and by default they are not sent to controls on the form. You can work around that by overriding the IsInputKey method and returning true for the keys you need to process.

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


I love YaBB 1G - SP1!

Posts: 14
Joined: Aug 2nd, 2006
Re: Direction Keys not firing KeyDown event
Reply #2 - Oct 25th, 2006 at 9:38pm
Print Post  
Well I tried it, by adding the following to the form containing my flowchart.

protected override bool IsInputKey(Keys keyData)
{
switch(keyData)
{
case Keys.Left:
case Keys.Right:
case Keys.Up:
case Keys.Down:
return true;
default:
return base.IsInputKey(keyData);
}

}

This didn't work though, and didn't seem to get fired when I pressed a key either. Any idea what I'm doing wrong?

Thanks again
Gerry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Direction Keys not firing KeyDown event
Reply #3 - Oct 26th, 2006 at 5:10am
Print Post  
Hi,

You must create a new class derived from FlowChart and override that method there. Then put your FlowChart class on the form and the keys should work ok - just replace the 'FlowChart fc;' declaration in the form class with 'MyFlowChart fc;', and change the constructor call from 'new FlowChart()' to 'new MyFlowChart()'.

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