I have a grid which is utilizing a creation filter which added a checkbox to the header of the grid. When this checkbox is checked/unchecked, the checkboxelement click event is fired and handled in the creation filter, which raises an event that is handled by another object(my grid class implementing the creation filter).
My problem is when I have scrollable screen and the user clicks a header checkbox, the screen jumps the grid control to the top of the screen and the event does not fire.
However, once the grid is at the top of the screen, the user can click the header checkbox without the screen jumping the control to the top(since it is already there), and it works fine.
How do I get the click event to fire for the header checkbox that was clicked? I guess I need the click event for the creation filter to fire before the screen gets jumped, how do I do that. Or, how do I avoid the jumping of the screen?
Thanks for your help,
Dave Krecker
Hi Dave,
When you use a scrollable control, there's a property on it called (I think) AutoScroll. This property automatically scrolls the top-left corner of a control into view whenever that control gets focus.
So my guess is that when you click on the grid, the grid gets focus on or shortly after the MouseDown event occurs. Then the scrollable control scrolls so that the top-left of the grid is in view. And by the time the MouseUp occurs, the checkbox is no longer under the mouse, so the checkbox doesn't get changed.
So the easiest thing to do would be to turn off AutoScroll.
The AutoScroll property on the panel enables scroll bars to appear is the control withing the panel is larger than the panel itself. If I disable the autoScroll property, I lose my toolbars. Even if I set the visible and enable properties of the horizontal and vertical scrollbars in code to true, they show up but do not function if the autoScroll is set to false.