This striked me as quite a surprise. A Wx::MenuItem and also a Wx::Menu is not a subclass of Wx::Window. This means you can't query a menu's position, nor its size. Since that's not possible, I can't draw a box around a selected menu item to indicate (for a switch user) that it's selected.
Quite a disappointment, and I have no clue whatsoever how to solve it. I've dug in the wxWidgets sources, and it uses the platform-specific calls to create window menus, so there's no easy way to get around this.
I'm afraid I'm left with only two choices: either code my own menus and replace the wxWidget's menus (which is not an appealing option), or I'll drop the accessibility of menus (not attractive either).
Suggestions welcome!
You don't really need the absolute position on the screen, all you need is a drawing area, AKA a canvas. That needn't have a known absolute position on the screen, as long as the underlying GUI library knows where to draw it.
Re:Can you do owner-drawn menus?
jouke on 2006-07-06T08:22:16
Owner drawn is probably (I've looked at it, but can't say I grasp all of it yet) still the same as drawing your own menus. Which automatically means sacrificing the native OS look of your menus.
What I need is a menu, and a menuitem that "owns" its position and size. The purpose of it all is to be able to draw a box around it on the screen to indicate what you're about to select (for the people who can't use a mouse, but use switches).
Re:the direct (but not necessarily fastest) route?
jouke on 2006-07-06T08:27:13
Of course that is an option. However, I don't expect much of that, since it's an "enhancement" that is only useful in my specific situation. Why else would you want to know where a menu item exists on the screen?
wxWidgets is of course a generic, platform independent GUI toolkit, being (in lots of cases) a wrapper around platform-specific calls. Menus are supported on all platforms, and therefore they call the platform-specific API to draw a menu somewhere. If the platform doesn't provide that information, the whole "menu handling" should be rewritten...I think it's too much hassle for an audience that's not large enough......but still I'll consider asking ;-)