datagrid : navigation keys

  • Thread starter Thread starter jjj
  • Start date Start date
J

jjj

hi,

I have a derived DataGridColumnStyle, with a custom textbox. If i press left
or right navigation keys, the custom textbox losses focus and move to other
cell, instead of moving position between the character in the textbox
(editing).


Tried to intercept navigation keys by overriding ProcessCmdKey, but that
only disable the Left and Right key.


Thanks.
 
Hi,

Thanks for your reply.

Here is the code that overrides the ProcessCmdKey of derived Grid control.



////////////////////////////////////////////////////////////

protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg,
System.Windows.Forms.Keys keyData) {

if(msg.WParam.ToInt32() == (int) Keys.Right) { return true; }

return base.ProcessCmdKey(ref msg, keyData);

}

////////////////////////////////////////////////////////////

This will disable the right key pressed. But what I want is move one
character position, in the custom TextBox, editing and not exiting the
cell.
 
Hi,

thanks for your reply.

Here is the code, a override ProcessCmdKey of a derived DataGrid.


///////////////////////////////////////////////////////////////////////////////////////////////

ected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg,
System.Windows.Forms.Keys keyData)

{

if(msg.WParam.ToInt32() == (int) Keys.Right) {return true;}

return base.ProcessCmdKey(ref msg, keyData);

}

////////////////////////////////////////////////////////////////////////////////////



This will disable the Right key. What I want is move position to the right,
in the custom TextBox ... editing and not exiting the cell or diable the
right key.

Thanks.
 
Back
Top