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.

CheckBox event for spacebar

Thread ID:

Created:

Updated:

Platform:

Replies:

59857 Apr 23,2007 07:06 PM Apr 24,2007 10:47 PM Windows Forms 5
loading
Tags: GridControl
Julie Levy
Asked On April 23, 2007 07:06 PM

Hi -
i noticed that the CheckBoxClick event doesn't fire when the user changes it's value using the space bar even though the checkbox is sensitive to that keypress and knows what to do with it. What event gets fired letting me know the value has been set/changed?
Thanks,
Julie

haneefm [Syncfusion]
Replied On April 23, 2007 07:20 PM

Hi Julie,

This is by design. If you want to get the CheckBoxState changes when pressing the SPACE bar in a grid cell then hanlde the CurrentCellChanged event for check box cell. Here is a code snippet to shiw this.

private void gridDataBoundGrid1_CurrentCellChanged(object sender, EventArgs e)
{
GridDataBoundGrid grid = sender as GridDataBoundGrid;
GridCurrentCell cc = grid.CurrentCell;
if( grid.Model[cc.RowIndex, cc.ColIndex].CellType == "CheckBox" )
Console.WriteLine("CheckBox has been clicked!");
}

Best regards,
Haneef

Rajagopal [Syncfusion]
Replied On April 23, 2007 07:22 PM

Hi Julie,

The CheckBoxClick is the event that gets triggered only when user clicks using the mouse on the checker box of checkbox. You can catch the CurrentCellChanged event for detecting any changes made to the checkbox cell.

void gridDataBoundGrid1_CurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if (cc.Renderer.StyleInfo.CellType == "CheckBox")
{
Console.WriteLine("CheckBox cell({0},{1})", cc.RowIndex, cc.ColIndex);
}
}

Regards,
Rajagopal


Julie Levy
Replied On April 23, 2007 07:29 PM

Hi -
thanks for your response. I have one question: how does the CurrentCellEditingComplete work with CurrentCellChanged? Will CurrentCellChanged fire on every key press? I used CurrentCellEditingComplete to track changes to regular textbox cells.
Thanks,
Julie

haneefm [Syncfusion]
Replied On April 24, 2007 11:45 AM

Hi Julie,

How does the CurrentCellEditingComplete work with CurrentCellChanged?
>>>>
The CurrentCellEditingComplete event is occured when the grid completes editing mode for the active current cell. But the CheckBox cell is a special case as the changes are committed with each click and do not wait for the user to leave the cell for the changes to be committed. So, it is handled differently. So, if you want to catch each change in a CheckBox, you have to use CurrentCellChanged. You can only execute your code for CheckBox cells by testing the CellType of the currentcell. In the checkbox cell, The CurrentCellEditingComplete event doesn't occur.

Will CurrentCellChanged fire on every key press?
>>>>>
No, The CurrentCellChanged event is occured when the user changed contents of the current cell.


Best regards,
Haneef

Julie Levy
Replied On April 24, 2007 10:47 PM

thanks for the explanation 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.

;