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.

Function key event handling

Thread ID:

Created:

Updated:

Platform:

Replies:

14526 May 28,2004 04:13 AM May 28,2004 04:41 AM Windows Forms 1
loading
Tags: GridControl
Vincent Loy Chee Hoon
Asked On May 28, 2004 04:13 AM

How do you detect function keys (F1 -> F12) cells in GRIDDATABOUNDGRID (GDBG)? I was only able to capture F1, F2 in keydown events within cell. It appears that each function key will trigger different events. Is that the default behaviour of GDBG in handling function keys? Awaiting your reply, Lance

Administrator [Syncfusion]
Replied On May 28, 2004 04:41 AM

While the grid cell is not actively being edited, then the grid itself gets these keystrokes. In this case, event handlers like grid.CurrentCellKeyDown and grid.KeyDown can be used to catch the keys. But when the current cell is actively being edited, the grid does not automcatically catch these keys. In this case, you can use the grid.CurrentCellControlKeyMessage to catch the function keys. Now this event may be fired more than once (for KeyDown, KeyPress & KeyUp) as it handles all teh key messages in the active cell. So, normally, you would condition do something for only one of these hits. One other thing is that this message does not appear in the designer event list in C#. So, you do have to manually subscribe to it. (Did not check to see if it was in teh VB event dropdown, but probably you would have to use AddHandler there as well to subscribe to it). //subscribe to the event this.gridDataBoundGrid1.CurrentCellControlKeyMessage += new GridCurrentCellControlKeyMessageEventHandler(grid_CurrentCellControlKeyMessage); //the handler private void grid_CurrentCellControlKeyMessage(object sender, GridCurrentCellControlKeyMessageEventArgs e) { Keys keyCode = (Keys)((int)e.Msg.WParam) & Keys.KeyCode; Console.WriteLine(keyCode); Console.WriteLine(e.Msg); }

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.

;