Click to See Complete Forum and Search --> : How can I include a toolbar in the tab order of a dialog box?


stefan_tzanev
February 14th, 2003, 03:21 PM
Hello,

I create several toolbars in the WM_INITDIALOG handler of a modal dialog box.

Although the toolbars have WS_TABSTOP style set, I cannot include them in the tab order. That is, when navigating among dialog box controls with TAB key the toolbars never get the focus.

What should I do to enable tabstop for the toolbars (and eventually for the toolbar buttons, although I would be happy also to get to the toolbar with TAB key and then navigate inside the toolbar with arrow keys) ?

Thank you.

v0id
February 16th, 2003, 02:42 PM
There is no way to do that. I've never seen it so I think toolbars doesn't support that feature.

mwilliamson
February 16th, 2003, 05:18 PM
well, there is a way. You could implement your own custom tabbing. Basically you would override PreTranslateMessage() to catch the tab key then set focus to the next window in the tab order. It not very hard to do.

stefan_tzanev
February 16th, 2003, 06:48 PM
Originally posted by mwilliamson
well, there is a way. You could implement your own custom tabbing. Basically you would override PreTranslateMessage() to catch the tab key then set focus to the next window in the tab order. It not very hard to do.

Thanks to both v0id and mwilliamson for the replies.

Unfortunately, I have the feeling that the toolbar ctrl is implemented by rendering the button bitmaps and then tracing the mouse position and generating notifications to the parent. If this is true, this makes it impossible to set the focus on any of the buttons or to navigate among them - these buttons simply don't exist. This idea came to my mind after realizing that the toolbar ctrl does not need a bitmap that represents the "has focus" state of the buttons - there are bitmaps only for up, down, disabled and "mouse pointer over" states.

So, maybe I'll just give up the idea of navigating among the tb buttons, or I'll switch to bitmap buttons instead.

Thank you, anyway.