Dynamic window contents
I am trying to implement a very common interface theme such as a properties sheet, where you have a "category list" that allows the user to pick from certain categories, each category showing its own list of controls. Essentially, what I need to do is clear the window of all controls and only show the controls pertinent to the current category selected. What I've implemented so far is in an EnumChildWindowProc that goes through all child windows and disables and hides them if they are not pertinent to the current category. However, there are some controls (particularly all my comboBoxEx's) that do not seem to like being hidden via ShowWindow(SW_HIDE), and do not display properly when I try to reshow them, plus manually iterating through every window seems a bit cumbersome and I thought there might be a better way (i.e. like the properties sheet control). I would have actually just used a properties sheet control, but I wanted a more customized approach, using a TreeView for category browsing instead of tabs.
So my question is really twofold:
1) Am I approaching this with the right solution (i.e. EnumWindows/show & hide)?
2) If so, why are some controls become corrupted after hiding and reshowing them, is there another function I should be using to disable and hide controls?
Thanks for any suggestions!
On a whim, I played around with the CBEM_GETCOMBO/EDITCONTROL message, and seemed to solve problem 2 by explicitly re-enabling the comboboxex's children controls (Since disabling and hiding a window implicitly disables and hides its children, I would've have figured it logical to have it behave the same way while re-enabling them... but I guess thats winapi for ya !)