Issues with Escape and Enter Keys

Posted by: d2.autoservicio on 31 January 2025, 2:31 pm EST

    • Post Options:
    • Link

    Posted 31 January 2025, 2:31 pm EST - Updated 1 February 2025, 12:01 pm EST

    Hi,

    I am using Spread.NET in Visual Basic. I am having issues on a Spread control with Enter and Escape Keys.

    There are some spread controls that Enter key will trigger Keydown event, while on other controls, the DialogKey event is the one triggered.

    1. How can I standardize the Event for that Enter key triggers KeyDown event?

    Additionally, Escape key, while in EditMode, clears the contents of the cell in some Spread controls but not on others.

    1. How can I make Escape key only exit EditMode without clearing contents?

    I am using latest Spread.Net version (18.0.20241.0) and programming in Visual Basic.net

  • Posted 3 February 2025, 8:35 am EST

    Hi,

    In a general Spread cell:

    • The DialogKey event triggers when a key is pressed while the cell is in edit mode.
    • The KeyDown event triggers when a key is pressed while the cell is not in edit mode.

    To ensure that pressing the Escape key only exits edit mode without clearing the cell content, you can use the following code snippet:

     Private Sub SprLayout_DialogKey(sender As Object, e As DialogKeyEventArgs) Handles SprLayout.DialogKey
         Debug.WriteLine("Dialog Key Down fired!!!")
         If e.KeyCode = Keys.Escape Then
             e.Handled = True
             SprLayout.EditMode = False
         End If
     End Sub

    We have also attached a sample application for implementation. See SpreadDemo.zip

    If your requirement differs from our understanding, then please update the attached sample to replicate your use-case scenario.

    Thanks & regards,

    Aastha

  • Posted 6 February 2025, 2:57 pm EST

    Ok, thanks, I added the e.handled to true.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels