*****How to scroll in the grid when editing data in a cell

How to scroll in the grid when editing data in a cell

 

from:http://www.devexpress.com/Support/Center/p/CQ5675.aspx

 

Hi,


I would like to know how can I allow to scroll the grid when I'm editing a cell. Currently the scroll doesn't work

Thanks

Christophe
<-     Reviewed by DevExpress Team         2006/12/19 6:44:05
<-     Processed (Answered) by DevExpress Team         2006/12/19 9:33:49

Hi Christophe,

Sorry, this is impossible. The cell editor is a separate control shown over the grid. So the scrolling is blocked to avoid visual separation of the editor and the edited cell. Please explain, why you need this functionality.

Thanks,
Michael.
->     Reactivated by Jürg Furthmüller         2006/12/19 11:29:40

Because I'm currently implementing an application that already existed on another platform and had this functionnality.

Is it possible to emulate this behaviour? for example can we handle the event MouseWheel on a gridView in order to allow scrolling the grid while editing a cell? I mean, if I want to scroll the grid then the current edited cell's editor is closed and the grid is scrolled.

I would like to be able to scroll with the mouse wheel through the rows of the grid even if there is no vertical scrollbar. Is it possible? The focus should be placed on the next row above/below the current focused one when scrolling one step up/down. And if there is a vertical scrollbar, this one should be moved only when the next row is not visible. This is a common behaviour. Currently the scrolling of the grid moves the vertical scrollbar and not the focus of the current row, is it just a option to set correctly or should I implement this functionality?
Thanks
Christophe
<-     Processed (Answered) by DevExpress Team         2006/12/19 16:23:44

Hi Christophe,

The XtraGrid doesn't provide this functionality. However, it can be implemented by handling the GridView.MouseWheel event. The base scrolling behavior can be disabled by creating the DXMouseEventArgs and setting the Handled property to True. Please use the following code:

        void gridView1_MouseWheel(object sender, MouseEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
            view.CloseEditor();
            if (e.Delta < 0)
                view.MoveNext();
            else if(e.Delta > 0)
                view.MovePrev();
            DevExpress.Utils.DXMouseEventArgs.GetMouseArgs(e).Handled = true;
        }

Thanks,
Michael.

你可能感兴趣的:(scroll)