I’m having a problem working with lodger controls. I wrote my application with each control having its own window by calling CreateWindowL() in each control’s constructor.
I have a main control which implements the main screen, and occupies the entire client rectangle. This main control obviously has to be window owning. I then have a variety of other controls some of which occupy the entire client rectangle completely obscuring the main control, and others which are smaller, and only partially obscure the main control.
I experimented with one of these small controls, changing its constructor from CreateWindowL() to SetContainerWindowL(), and modifying the main control so it returns the sub control through CountComponentControls(), and ComponentControl().
When the sub control calls gc.Clear() in its Draw() procedure it clears the entire client rectangle, not just the rectangle it occupies, so I only see the sub control, not the sub control sitting on top of the main control. When the sub control had its own window, gc.Clear() used to clear only the rectangle occupied by the sub control.
Furthermore, when I destroy the sub control, and CountComponentControls(), and ComponentControl() do not return the sub control, Draw() in the main control is not called. If I pull up the options menu, and escape from it, Draw() is then called and the screen finally looks the way it should.
Again when the sub control was window owning, destroying the sub control automatically caused the main control it was obscuring to be redrawn.