1. I have one window owning control (assume oParent)
2. and a non window owning custom control whose associated parent is oParent.

The Compound control has one label control as a component.


CCompoundControl : public CCoeControl
{
ConstructL() ;
sizechanged();
Draw();
ComponentControls() ;
CountComponent() ;
...
...
..
private:
CEikLabel *poLabel
};

CCoeControl *oParent ;
oParent->CreateWindowL() ;

CCompoundControl *oCompoundControl ;
oCompoundControl->SetContainerWindow(*oParent) ;

CCompoundControl::Draw(TRect aRect)
{
CWindowGc &gc = SystemGc() ;
gc.SetClippingRect(aRect) ;
}

The parent control(window owning) is of ClientRect size and custom control is inside it.

The compound control is of size less than its associated window.

The label inside the custom control is bigger than the custom control.

The problem here is when the label is drawn, the label is drawn outside eventhough ClippingRect is set for CCompoundControl.

Why is this problem and how to clip the rect for non-window owning controls