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.
Syncfusion Feedback

Handling a key event in GDBG

Thread ID:

Created:

Updated:

Platform:

Replies:

35715 Oct 6,2005 09:04 PM UTC Oct 6,2005 10:32 PM UTC Windows Forms 1
loading
Tags: GridControl
Brian N. Wright
Asked On October 6, 2005 09:04 PM UTC

I have a GridDataBoundGrid. I want to setup a hotkey similar to Excel''s that allows a user to select the entire row of the current cell by typing (Shift + Spacebar). I have tried every key event I can find (KeyUp, KeyDown, KeyPress, CurrentCellKeyUp, etc..) In every case, I can get it to select the entire row.. BUT.. I cannot seem to prevent the keyboard event from also activating the current cell and typing a space into it. The e.Handled part seems to have no effect (I believe it may be because the space has already been typed into the active cell by the time I get the message) So how can I trap the (Shift + Spacebar) key event and prevent it from also typing into the active cell? Here is 1 way I have unsucessfully tried to do this: private void gridDataBoundGrid1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Space && e.Shift == true) { // do my stuff here to select the row... e.Handled = true; } } Thanks, Brian

Administrator [Syncfusion]
Replied On October 6, 2005 10:32 PM UTC

One way to do this is to derive teh grid and override ProcessCmdKey. Here is a sample. http://www.syncfusion.com/Support/user/uploads/GDBG_Copy_7193cd4b.zip If you do not want to derive the grid, then you can handle CurrentCellControlKeyMessage. But this causes the cell velue to ''blink'' which you may not want. The above sample has this solution commented out.

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.

Warning Icon 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.Close Icon

;