We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

cancel event returns cursor to top

Hi, I am trying to simulate readonly property for the griddataboundgrid object. In the OnCurrentCellActivating i am checking to see if the form is readonly and cancel the request accordingly. The problem here is, that every time the user scrolls down and then click on any cell, the grid returns to the top. It doesn''t happen if the scroll horizontally though. I don''t want to set every cell to readonly, because the grid''s quite large. Here''s the code i''m using that''s causing the problem (i believe). Protected Overrides Sub OnCurrentCellActivating(ByVal e As Syncfusion.Windows.Forms.Grid.GridCurrentCellActivatingEventArgs) If Not mReadOnly Then MyBase.OnCurrentCellActivating(e) End If e.Cancel = mReadOnly End Sub Thanks in advanced!

4 Replies

AD Administrator Syncfusion Team June 14, 2005 12:23 AM UTC

Instead of setting e.Cancel = true, try setting e.ColIndex = 0 to see if that will do what you want.


BH Bernard Herrok June 14, 2005 12:29 AM UTC

Clay, I think you missunderstood what I meant. All I want the grid to do is ignore the entering of a cell. Just so it acts like it''s readonly/disabled. On the onCellActivating event I cancel (e.cancel = true) the user request. This works ok. But the grid then goes to the top, instead of just staying where the user clicked. >Instead of setting e.Cancel = true, try setting e.ColIndex = 0 to see if that will do what you want. > >


AD Administrator Syncfusion Team June 14, 2005 12:40 AM UTC

If you cancel OnCurrentCellActivating, the focus will not move to the clicked cell. If you do not want to see the cursor in ths clicked cell, but still let the click cell get focus, then try handling CurrentCellStartEditing, and setting e.Cancel there.


BH Bernard Herrok June 14, 2005 12:52 AM UTC

Thanks Clay, that''s worked a treat! >If you cancel OnCurrentCellActivating, the focus will not move to the clicked cell. > >If you do not want to see the cursor in ths clicked cell, but still let the click cell get focus, then try handling CurrentCellStartEditing, and setting e.Cancel there.

Loader.
Live Chat Icon For mobile
Up arrow icon