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

Gridcontrol, Scrollbar and cell movement

I am useing the Gridcontrol and my cells exceed the page size, so I have the horizontal scrollbar appearing. As I tab through the cell, which I manually manage, when the cell that appears off of the current screen is selected the grid will not scroll that cell. Is there someway to manage the scrollbar movement to move with the cell that is currently selected?

Thanks


7 Replies

AD Administrator Syncfusion Team June 8, 2008 01:19 PM UTC

Here are 2 ways to move a cell into view.

The grid has a method grid.ScrollCellInView that you can use to explicitly scroll a cell into view given its rowIndex and colIndex.

In addition, the grid.CurrentCell.MoveTo has an overload where the third argument has an option to scroll the cell into view.



JP James Pemberton June 9, 2008 02:41 PM UTC

I didn't even notice the overloads. But when I do use them, either of them, even if I tell the grid the exact address of the cell, it wants to start skipping cells, so If i tell it grid(2,3), focus is somehow set to grid(2,4). And this happens with both examples you gave me.

Thanks

>Here are 2 ways to move a cell into view.

The grid has a method grid.ScrollCellInView that you can use to explicitly scroll a cell into view given its rowIndex and colIndex.

In addition, the grid.CurrentCell.MoveTo has an overload where the third argument has an option to scroll the cell into view.





AD Administrator Syncfusion Team June 9, 2008 02:52 PM UTC

>>which I manually manage

Exactly what are you doing to manually manage moving the currentcell? Are you handling an event like QueryNextCurrentCellPosition or some other events? Can you post a sample showing the problem that we can debug?

In general, the grid normally handles tabbing to the next cell in a row when the tab key is pressed without you having to do anything to manage it. What part of the default behavior of the grid are you trying to change?



JP James Pemberton June 10, 2008 11:57 AM UTC

I am attaching the sample methods I use to move the cursor within my grid. I have readonly columns and rows, so when the enter, or tab keys are pressed, I want to make sure that the cell focus goes to the next cell that is not marked as readonly. If there is a better way to handle this, I would love to know. I've just started using the Grid control abotu a week or so ago, so I am sure there is alot to learn.



syncfusion_bd82885e.zip


AD Administrator Syncfusion Team June 10, 2008 07:16 PM UTC

Instead of setting the cells style.ReadOnly = True, try setting them style.Enabled = False. Disabling them will make the grid avoid them as you tab through the grid. If you want the tabbing to wrap the rows, make sure you set

Me.GridControl1.Model.Options.WrapCellBehavior = Syncfusion.Windows.Forms.Grid.GridWrapCellBehavior.WrapRow

This way you would not have to handle any of the tabbing process yourself.



JP James Pemberton June 11, 2008 12:18 PM UTC

I'm feeling kind of dumb here, but I made the changes like you requested, and that works great for access those cells. But my Tab or Enter key don't work, they do absolutely nothing. I've taken out all of the code to check for keypress events and still nothing. The property for Enter key move is set to right as well.

Any suggestions?



JP James Pemberton June 11, 2008 01:07 PM UTC

I finally have it working using the QueryNextCurrentCellPosition to move between enabled cells and rows.

Thanks for all of your help!


Loader.
Live Chat Icon For mobile
Up arrow icon