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.

How not to autoselect option in radiobutton cell when tabbing in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

69588 Nov 2,2007 01:14 PM Nov 2,2007 02:10 PM Windows Forms 1
loading
Tags: GridControl
Brian R
Asked On November 2, 2007 01:14 PM

Heyo,

I have a grid control where I have enabled/disabled certain cells to basically provide a form for the user to fill in. Everything looks great.

Now I'm trying to make it so that if the user presses the tab key to naviagate around the grid it will only stop on editable cells. I have code that does this. However, I have a few cells that are a radio button with a single value and tabbing into these cells will auto select the option in the radio button, which I don't want it to.

All my navigation code does is iteratates through the cells left to right, top to bottom, until it finds an editable cell and then calls grid.CurrentCell.MoveTo(x,y) and grid.CurrentCell.ScrollInView(). This is being called in an override of the ProcessCmdKey().

Is there any property or method for preventing this auto selecting and requiring the user to either click on it with the mouse or press the space key or something?


TIA,

Brian

haneefm [Syncfusion]
Replied On November 2, 2007 02:10 PM

Hi Brian,

One way you can do this by handling the CurrentCellKeyDown event of the grid and set the e.Handled to True when Right/Left arrowkey is pressed in GridRadioButtonCell. Below is a code snippet that shows this task.

void gridCurrentCellKeyDown(object sender, KeyEventArgs e)
{
GridControl _ctlGrid = sender as GridControl;
GridCurrentCell cc = _ctlGrid.CurrentCell;

string _strCurrentCellType = _ctlGrid.Model[cc.RowIndex, cc.ColIndex].CellType;
if (_strCurrentCellType == "RadioButton")
{
switch (e.KeyCode)
{
case Keys.Right:
e.Handled = true;
cc.MoveRight();
break;
case Keys.Left:
e.Handled = true;
cc.MoveLeft();
break;
}
}
}

Best regards,
Haneef

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.

;