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' cellI 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
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.
Hi Mike,
Ideally I would like to prevent the mouse wheel from affecting the cell when ever the drop down list is not shown.
Some of my users are selecting a value from the drop down (either with the mouse or using the keyboard) and then attempt to use the mouse scroll wheel to scroll down the grid. Obviously it won't scroll but the problem is sometimes they do this and don't realise they've changed the value in the cell.
My initial solutions was as below but it doesn't work. The ControlAdded code runs and adds the handle but the ctrl_MouseWheel function is never called.
private bool allowCellScroll;
private void gridFdp_BeforeCellListDropDown(object sender, CancelableCellEventArgs e){ this.allowCellScroll = true;}private void gridFdp_AfterCellListCloseUp(object sender, CellEventArgs e){ this.allowCellScroll = false;}
allowCellScroll
this.allowCellScroll = false;
private void gridFdp_ControlAdded(object sender, ControlEventArgs e){ Infragistics.Win.UltraControlBase ctrl = e.Control as Infragistics.Win.UltraControlBase; if (ctrl != null) ctrl.MouseWheel += new MouseEventHandler(ctrl_MouseWheel);}
private void ctrl_MouseWheel(object sender, MouseEventArgs e){ HandledMouseEventArgs args = e as HandledMouseEventArgs; if (args != null && !this.allowCellScroll) args.Handled = true;}
this.allowCellScroll