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.

keydown event

Thread ID:

Created:

Updated:

Platform:

Replies:

19564 Sep 29,2004 05:17 AM Sep 29,2004 07:29 AM Windows Forms 3
loading
Tags: GridControl
Mahesh Naik
Asked On September 29, 2004 05:17 AM

where do i get detailed infomtion about these event.It is critical for my vanilla Data entry . unlike other grids (other vendors) this grid returns even the arrow keys.As am processing the keys myself i donot want it to move to next row on its own.Waht do i do .set e.handled=true in the keydown event?. can i handle also like that.what about keys of the numeric keypad.

Administrator [Syncfusion]
Replied On September 29, 2004 05:28 AM

There are several KeyDown type events since there may be different controls involve is a cell is actively being edited. (The GridControl may have input focus, or the active cell control like a TextBox might have focus). So, catching keystrokes may depend upon exactly what control has focus. If you want to catch them no matter what control has the input focus, you might use the CurrentCellKeyDown event. Here is a handler that ignores any arrow key.
Private Sub gridControl1_CurrentCellKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles gridControl1.CurrentCellKeyDown
      If e.KeyCode = Keys.Up Or e.KeyCode = Keys.Down Or e.KeyCode = Keys.Left Or e.KeyCode = Keys.Right Then
            e.Handled = True ''ignore
       End If
End Sub

Mahesh Naik
Replied On September 29, 2004 06:55 AM

thank you. I have done just that I am as of now wary of any additional controls to make my life miserable. I have got my Good for something progra going . I handle the keystrokes myself. Now the next step is to snare the Rat. In the keydown event is there a translation table or something like that so that i know which symbolic key corresponds to what. Using absolute numerical values is a pain. What about numeric keypad keys. Mine is a Data entry program for a surevy and the data entry operators (Ladies!) prefer not to even look at the beautiful forms on the screen. They use only the numeric pad.Even the arrow keys they want from there only. The long keyboard is used only for alpha. The other 2 grids were handling the arrow keys without giving me a keydown. Your method is NEAT. Do you raise a keydown for all keysstrokes ?. I have got the doc files installed. Tell me the references to browse and i will be much more obliged. I have got the grid readonly while tablestle. I have it "static" via tablestyle and also by using the column styles. I dont know what is required so i put a double property. Mahesh Naik Mumbai,India, 19:25 (IST)

Administrator [Syncfusion]
Replied On September 29, 2004 07:29 AM

The simplest way for you to see how CurrentCellKeyDown works with respect to the arrow keys and the numeric keypad is to just add a handler and output the key to the Output page. Then run the sample in debug and watch the output page as you press the keys. If you are using Static CellType for all cells, then CurrentCellKeyDown should catch most keys. If you are using menu accelerator keys or something of that nature, then you may have to derive the grid and override ProcessCommandKeys to catch such keys.
Private Sub gridControl1_CurrentCellKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles gridControl1.CurrentCellKeyDown
            Console.WriteLine(e.KeyCode.ToString())
End Sub

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.

;