Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
475
Simulating a key press on UltraGrid
posted

Hi,

In my application some key presses are captured by accelerators and translated into the appropriate command.  For instance CTRL+C is mapped to the ID_EDIT_COPY command.  I am able to capture these commands in my C# UltraGrid wrapper assembly and get them to the grid by calling for instance....

m_grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.Copy);

However, I need to be able to simulate clicking the Delete key in the grid when it is in edit mode.  I do not see any actions in the PerformAction method that would send a key press to the grid.

I have tried using the PostMessage API call with WM_KEYDOWN but this caused the grid to hang ?

Any recommendations ?

Parents
No Data
Reply
  • 69832
    Verified Answer
    Offline posted

    The grid uses out embeddable editor architecture so when a cell is in edit mode, you can usually use the properties and methods of the EmbeddableEditorBase class (from which all embeddable editors derive) to manipulate the cell's current value. For example, if you wanted to clear the text out of an EditorWithText, you could set the editor's Value property to an empty string. It is possible that you can solve your problem in this manner without having to simulate typing the Delete key.

    To answer your question, you can use the SendKeys class to simulate user keyboard interactivity.

Children