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
785
How to implement delete key with UltraComboEditor in UltraGrid?
posted

Hi, 

Recently I'm using UltraGrid in my application.And here is the request, in the first column of the grid I have to use comboEditor column, with the columnStyle to DropDownList.

I customized the UltraComboEditor component, and implement the OnKeyDown event which when I press the "del" button, the value selected will be deleted and the comboEditor will show empty value(not really delete the value, only set with this.SelectedIndex=-1).

Meanwhile, I customized the UltraGrid component, and also implement the OnKeyDown event which should deal with the "del" button when press the "del" button on keyboard it will delete the comboEditor value, which just the effect shown above with the customized comboEditor.

But when I got focued on the comboEditor in the grid, and press the "del" button, it won't delete the value that selected in the comboEditor, which is what I want to implement.

Could you please help me with that? Thanks for your concern.

And I'll attach the sample code that I implement before.

WindowsFormsApplication8.zip
Parents
  • 23930
    Offline posted

    Hi Richard,

    Thank you for posting in our forums.

    When you press the delete key and the grid is the active control on the form, it handles itself the key. What happens is that the grid executes an action based on its key action mappings collection (for the delete key, when you have a selected row it deletes it). What you could do in order to change this is to handle the delete key in the grid yourself. First set the Handled property in the OnKeyDown method to true if the key is delete and get the active cell or active row and set the value for the cell you want to delete to String.Empty.

    I have modified your sample in order to demonstrate this approach.

    Please let me know if you have any additional questions.

    WindowsFormsApplication8Mod.zip
Reply Children