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
  • 12480
    Offline posted

    Hello Florian,

    When a form is shown, focus is automatically given to a control based on the TabStop property. It may be a simpler workaround to change the TabStop property of your OK button so that it is a smaller value than the TabStop property of the Cancel button.

    It is possible to disable the thick blue border around the button by setting the button's ShowOutline property to false. You can also disable the focus rectangle by setting the button's ShowFocusRect property to false. Note that if you disable both properties, the user will have no indication that the button has focus, and may become confused.

    I will follow up with you on the cancel button functionality.

Reply Children