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
754
UltraButton AcceptsFocus property disables key events?
posted

Dear all,

WinForms 10.3: we have modal form called with

.....form.ShowDialog() == DialogResult.Ok;

and the form contains UltraButton instances for Ok and Cancel. For some strange reason, pressing ESC was not closing the form when the Cancel button was set to the CancelButton property of the form. So my developer played around and found that if AcceptsFocus is set to true for the Cancel button, the ESC keypress closed the window, but not if AcceptsFocus is set to false.

The reason for disabling this that we do not want to have the focus border around the cancel button immediatley after startup (prevent the thick border there).

But even if we have to just make a workaround and manually shift the focus upon activation, shouldn´t be the ESC button bound in any way to the CancelButton property in such a way that it does not need to have the focus?

Thanks and regards Florian

Parents
No Data
Reply
  • 12480
    Verified Answer
    Offline posted

    Hi Florian,

    I apologize for using the phrase "Confirmed as a bug." Our engineers have looked into this, and determined that it is intended behavior.

    The reason that the AcceptsFocus property blocks the ESC key binding is that turning AcceptsFocus off sets the button's ControlStyle to non-selectable. The same result can be achieved by deriving a class from Button and setting its ControlStyle to non-selectable.

    Please let me know if you have any further questions.

Children