Prevent button getting focus

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Prevent button getting focus


      I have several buttons that works like a switches. On first click button changes the variable state to true and second to false (for example). Everyting works perfect but there is a problem. When I click button first time it's get focus and second click doesn;t do anything. I have to click somewhere and button lost focus - now I can click it second time. Is it a way to prevent button getting focus or lost it when I click it automatically?

      Best regards
    • Hi,

      Yes, simply call BUTTON_SetFocusable(hButton, State) where hButton is a handle to the button and State describes whether it is focusable or not.

      Please note, that there was a typo in older versions of emWin. Depending on the version you are using it might be necessary to call BUTTON_SetFocussable().