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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top