[.net] scrollbar stealing keyboard input

Started by
1 comment, last by EvilNando 15 years, 5 months ago
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
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.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

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 ..

This topic is closed to new replies.

Advertisement