Jump to content
  • Advertisement
Sign in to follow this  
EvilNando

[.net] scrollbar stealing keyboard input

This topic is 3540 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have placed a couple of scrollbars over a custom control, the problem is that these bars seems to receive focus constantly , stealing keyboard inputs for themselves. Is there a way to configure these controls so that they ignore focus events or keypresses? thanks

Share this post


Link to post
Share on other sites
Advertisement
If the problem is what I think it is, then you need to make sure that the control that is meant to receive the key presses indicates that it does. In WinForms, you'd override the IsInputKey method, like this:

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

That will ensure that the control receives events from the cursor keys and that they won't be sent to the scrollbars instead.

Share this post


Link to post
Share on other sites
thanks I did not think of that.

a quick solution that I've found was to set the small and large change field both to 0 , then again I am not handling inputs in a standard fashioned way so maybe that is why it is working now ..

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!