Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
665
Disable mouse scroll wheel in drop down
posted

Hello,

I have an UltraGrid with a column called 'LandCodes'. I set the ValueList of this column and set the Style to ColumnStyle.DropDownList.

The scenario is:
I select a value from the drop down for a 'LandCodes' cell
I then scroll the mouse wheel

Currently this causes the value in the cell to change.

The behaviour I am looking for is the value no remain the same but for the grid to scroll.

Any help would be greatly appreciated.

Thanks,
Paul

Parents
  • 469350
    Offline posted

    Hi Paul,

    When you select an item from the list, the cell remains in edit mode. So the MouseWheel is handled by the cell's editor instead of by the grid. This is not different then if you tabbed into that cell or clicked on it without selecting a value.

    Do you want to prevent the mouse wheel from working in ALL of those cases? Or just this one particular case?

    If it's just this one case, then the thing to do would be to force the cell out of edit mode. But this will be very tricky and kinda weird for the user. first off, it will be very difficult to detect when the user is really "done" editing the cell. Suppose they drop down the list, pick an item, and then change their mind and try to type in the cell. If it's not in edit mode any more, then typing won't work. There is also no way to tell if the user drops down the list and picks something or drops down the list and clicks on some other cell without choosing anything. You can reliably detect when the list closes, though. So if you want to explore this option, you could do something like this:

            private void ultraGrid1_AfterCellListCloseUp(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
            {
                UltraGrid grid = (UltraGrid)sender;
                grid.PerformAction(UltraGridAction.ExitEditMode);
            }

    If you want to prevent the editor from handling the MouseWheel in all cases, then I'm not sure if that's possible. I would have to look into it some more.

Reply Children