Win32- toggling multiple controls?
I'm having real problems with this one, the information available on Google is really confusing and incomplete.
Basically what I want is a bunch of controls grouped together under a panels, with several of these panels. I want to be able to switch between these panels easily.
Currently, I create a "static" window, with WndProc's HWND as the parent. I then add some buttons, with this "static" window as their parent. This means when I send the "static" window a hide message, all of its children (the buttons) are hidden. This is great. Except the buttons I added don't do anything, so they're useless. Surely any messages would be passed from the button to the its parent the "static" window, then from the static window to its parent the HWND object, ending up at WndProc as a WM_COMMAND message?
I'm really stuck with this and I feel crap for asking what is probably a quite routine question for you guys. Thanks for any help you can give.
The WM_COMMAND from the buttons will be sent to the static control which won't do anything. You either need to (1) subclass the static control, (2) use your own custom window class instead of a static control or (3) re-route the WM_COMMAND messages yourself in your message loop.
(3) is an awful idea: I just put it in there for completeness. Personally, I'd do (2) because you're not getting a lot of functionality out of a static control anyway, basically it just knows how to paint itself.
Here is an old thread in which I explain how to do (2).
(3) is an awful idea: I just put it in there for completeness. Personally, I'd do (2) because you're not getting a lot of functionality out of a static control anyway, basically it just knows how to paint itself.
Here is an old thread in which I explain how to do (2).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement