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,
ADAdministrator Syncfusion Team 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);
private void grid_CurrentCellControlKeyMessage(object sender, GridCurrentCellControlKeyMessageEventArgs e)
Keys keyCode = (Keys)((int)e.Msg.WParam) & Keys.KeyCode;