No announcement yet.

Use Keyboard to Press Toolbar Button

  • Filter
  • Time
  • Show
Clear All
new posts

  • Use Keyboard to Press Toolbar Button

    I want to use the keyboard to navigate through the buttons of a toolbar and then to press one of the toolbar buttons. I'm pretty sure I've seen posts that show how to do that but cannot find it here - nor through a Google search either.

    Can someone remind me how that is done?

  • #2
    What about ACCEL ATTACH? Just a guess.
    In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.


    • #3
      Windows button+B
      Then cursor keys to move and space or enter to select.


      • #4
        Howdy, Paul!

        Thanks! But, Win-B does not work here. Win-B highlights the SysTray "Show Hidden Icons" button on the Windows TaskBar.


        • #5
          Oops, I've misread toolbar as taskbar.


          • #6
            Found it ... 2003 post by Borje...


   a DDT dialog I happened to add WS_TABSTOP
            style to a toolbar with flat style buttons and suddenly keyboard can be
            used to navigate between keys.
            TAB will cycle to the toolbar. Once on the toolbar, left/right arrow. Space will press the key.


            • #7

              If you are still interested in playing around with this, here's a couple of extended window styles to play with.


              The window is intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. If a tool window has a system menu, its icon is not displayed on the title bar. However, you can display the system menu by right-clicking or by typing ALT+SPACE.



              The window itself contains child windows that should take part in dialog box navigation. If this style is specified, the dialog manager recurses into children of this window when performing navigation operations such as handling the TAB key, an arrow key, or a keyboard mnemonic.
              I have used both of these and they work as advertised. What I cannot recall is if I ever used these for a pure "toolbar" rather than an actual window created with CreateWindowEx() and which itself includes controls. But no reason WS_EX_CONTROLPARENT (with WS_TABSTOP) shouldn't work if the "tool window" is a dialog with its own controls and you want to use the standard "control navigation" keys Tab and Shift+tab

              Worth a note.

              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]


              • #8
                I'd also like to point out that for accessibility purposes, having above said code in your guis makes it a whole lot easier for screen readers to follow the flow of a screen layout. Sometimes it's difficult or impossible to get to buttons that must be pressed in programs using a screen reader, because the screen reader doesn't know how to navigate the gui, and in some cases, (such as when folks draw their own buttons and don't use windows functions to let the os know it's a button), then the screen reader doesn't even know there's something there to click. It can be a real problem. I'm happy to say though, that in general, powerbasic does an excellent job creating navigatable screens. I've never had to do any extra work to make my programs work with a screen reader which is a good thing, because if I did, I'd be in real trouble.

                for hosting/internet