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.
Unfortunately, activation email could not send to your email. Please try again.

Tab stop

Thread ID:

Created:

Updated:

Platform:

Replies:

89733 Sep 3,2009 03:00 PM Apr 9,2010 09:51 AM WPF 10
loading
Tags: GridControl
Andre Slenko
Asked On September 3, 2009 03:00 PM

I made my cell non-editable by using the following: this.dgMain.Model[3, 2].ReadOnly = true;. How can I make the same cell non-focusable, so that I can't tab to it. Is there an event I can handle that will allow me to implement this functionality. I need certain cells to be read-only and non-focusable.

Clay Burch [Syncfusion]
Replied On September 3, 2009 03:39 PM

You set:

this.dgMain.Model[3, 2].Enabled = false;

Andre Slenko
Replied On September 3, 2009 04:07 PM

Thank you for the tip!
When I set certain fields to be enabled and then using the TAB key try to tab off to the next enabled cell, the TAB keystroke does nothing (the next logical cell is not receiving focus). How can I enable tabbing to the next enabled cell?
If I use UP/DOWN arrow keys, they work and the next cell receives focus.

Clay Burch [Syncfusion]
Replied On September 4, 2009 04:57 AM

The default behavior of a GridControl is to stick once you tab to the end of a row. If you want the tab to wrap to the next row once you are at the end, then you can set this property:

grid.Model.Options.WrapCell = true;


There is an event you can use to control whether cells can become a current cell during tabbing. This event is the gridControl1.QueryNextCurrentCellPosition. In that event, the e.RowIndex and e.ColIndex come in as the new current cell position. If you want to change where the current cell is going, then you can explicitly set e.ColIndex and e.RowIndex. You also have to set e.Handled and e.Result = true to make the grid position the currentcell to its new cordinates.

Here is a sample handle that moves the current cell to row 8 column 3 whenever the cell is row 2 column 4 is about to be tabbed into.

void grid_QueryNextCurrentCellPosition(object sender, GridQueryNextCurrentCellPositionEventArgs e)
{
if (e.RowIndex == 2 && e.ColIndex == 4)
{
e.Handled = true;
e.Result = true;
e.ColIndex = 3;
e.RowIndex = 8;
}
}

Andre Slenko
Replied On September 4, 2009 09:58 AM

Thank you for your help!
Is there a method that can programatically set the new CurrentCell?

Clay Burch [Syncfusion]
Replied On September 4, 2009 10:11 AM

You can use gridControl1.CurrentCell.MoveTo to position the current cell.

Joe Ward
Replied On March 8, 2010 04:04 PM

We're using the grid to create forms for users to fill out. Every cell is disabled with

this.dgMain.Model.TableStyle.Enabled = false;

to start out. Then the cells we want them to fill in are enabled as we create them. In our first section, starting at row 6, the first enabled GridStyleInfo is in column 2, and this continues to row 11, where only column 2 cells are enabled. At row 12, we have a read only "header" row.

At row 13, we pick up with having the column 2 cells enabled again. This is all fine until we get to row 15. This time there are 2 read only header rows.

At row 18, the enabled cells are now in column 6. Tabbing from row 15 column 2 to row 18 column 6 does not work.

From 18 down to 35, the enabled cells are column 6. To further complicate things, at rows 24 and 27, in column 12, there are enabled cells. If we start tabbing at row 18, column 6, it gets down to (24, 6), then moves over to (24, 12), but then moves to (27, 6), skipping over (25, 6) and (26, 6). It then stops at (27, 12) and doesn't go to (28, 6).

We have even set the WrapCellBehavior to WrapRow.

I've attached some code, as well as two screenshots, one showing what actually happens while tabbing (actualgrid.bmp) and the other shows the expected tabbing behavior (desiredgrid.bmp). There's three issues here. Tabbing stops at the end of section 1 (where the enabled boxes are in column 2). Then in section 2, when the enabled boxes are in column 6, the first issue is why it skips rows 25 and 26 after it moves to column 12 on row 24, and how come it stops on row 27 column 12?



grid_31230b18.zip

Clay Burch [Syncfusion]
Replied On March 9, 2010 09:04 AM

There is another way you can control tabbing in a GridControl, and that is through the QueryNextCurrentCell event. Attached is a sample trying to use this event to control things with the code you posted. (I could not use all of the code you posted because of some missing methods which were just commented out so things would compile).

I will forward this post onto the development team so they can look into why the tabbing is not behaving properly with just the property settings.



WpfApplication28_af704ef6.zip

Joe Ward
Replied On March 29, 2010 02:18 PM

Thanks Clay. Sorry for the late response. I had used the QueryNextCurrentCellPosition event successfully before my previous post. In fact, some of that random "Point" code in my previous post was the first attempt. I was using Point to store the row and column indexes, but then realized there was a RowColumnIndex object built into the Grid, so I switched over to that instead. I'm hoping to use QueryNextCurrentCellPosition as a last resort, as I know it does work, I just want to avoid the extra code.

I apologize for the code not working. I had to strip out a lot of company sensitive data but tried to leave in as much code as possible. I cleaned it up some more, so this version should show exactly what's happening.

Thanks.



tab code_def168ba.zip

Joe Ward
Replied On April 9, 2010 09:46 AM

Is there any update on this?

Thanks.

Karthik Vishnu R [Syncfusion]
Replied On April 9, 2010 09:51 AM

Hi Joe,

Sorry for the delay caused. With default property settings t, pressing Tab should work fine, but it seems there is a bug in our implementation. Please create a DirectTrac Incident, we will be providing you with a patch to get this issue resolved. Also, if the implementation is urgent you can use QueryNextCurrentCellPosition event to achieve you requirement.

Regards,'Karthik

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;