C1TextBox escape issue

Posted by: dung.itcdt on 20 August 2023, 8:43 pm EST

  • Posted 20 August 2023, 8:43 pm EST - Updated 20 August 2023, 8:51 pm EST

    Hi,

    I have a test program when the user focused on c1textbox and presses the escape button, the current forms will be closed. But it is not working.



    But if focused on the built-in textbox, it works well.

    My current version is 2023v2.

    I tried it on the old version and didn’t get this error.

    TestEscape.zip

  • Posted 21 August 2023, 2:01 pm EST

    Hello Le,

    You need to set the AcceptsEscape property of the C1TextBox to false so that the Escape key press action can pass to the owner form and handle your ProcessDialogKey code.

    c1TextBox1.AcceptsEscape = false;

    We hope it helps. If you need any other help, please feel free to ask.

    Regards,

    Prabhat Sharma.

  • Posted 21 August 2023, 2:18 pm EST - Updated 21 August 2023, 2:19 pm EST

    Hi Prabhat,

    I tried your way and it seems to work properly. But there is a problem that when I type text and press ESC it doesn’t return the previous value.

    Regards,

  • Posted 21 August 2023, 7:29 pm EST

    Hello,

    As far as we understand your requirement, you are looking to get the previous C1TextBox value before pressing the ESC button. You can get it by handling the GotFocus and LostFocus events and storing the value in it.

    Please find the attached modified sample implementing the same. And let us know if you have any different requirements.

    Regards,

    Prabhat Sharma.

    TestEscape_Mod.zip

  • Posted 22 August 2023, 11:25 am EST

    Hi Prabhat,

    In the old version, when a textbox has a Value and Modified = false, if I type a few characters and press ESC, the Text of the textbox will return to the Value before I typed.

    But in the new version, it doesn’t work.

    Regards

  • Posted 22 August 2023, 4:02 pm EST

    Hello,

    Thank you for bringing this to our attention.

    We too can observe the issue at our end with the latest version and escalate this to the development team to look into this matter. We will update you as soon as we get the update from their end.

    [Internal Tracking ID: C1WIN-30984]

    Regards,

    Prabhat Sharma.

  • Posted 23 August 2023, 3:42 pm EST

    Hello,

    To achieve your requirements, you can set the AcceptsEscape to false and get the TextBox value to get the previous value by pressing the ESC key.

    Please find the attached sample implementing the same.

    Regards,

    Prabhat Sharma.

    TestEscape_Mod1.zip

  • Posted 31 March 2024, 6:41 pm EST

    Hi,

    Thank you for providing me with the sample code.

    However, it seems that it does not meet my requirements.

    If I set AcceptEscape = false, the value of the textbox will not revert to its previous value before I type, and it will close the form immediately.

    My desired behavior is that when the Modified state is false, I type a few characters (Modified becomes true), and press ESC => the value of the textbox reverts to the time when Modified was false. And when I press ESC again, the form will be closed (because the change in the textbox value is not recorded).

    Regards,

  • Posted 2 April 2024, 12:32 am EST

    Hello,

    For this requirement, you can handle C1TextBox’s PreviewKeyDown event to get when the escape key is pressed and what the modified state of the C1TextBox is.

    Please refer to the attached sample for implementation. (see TestEscape_CloseOnSecondEsc.zip)

    Regards,

    Uttkarsh.

Need extra support?

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

Learn More

Forum Channels