What do you consider if you find a howto like this on the web? You consider that it’ll work. Especially when it is the same example which is also used in the API documentation.

But this example won’t neither work for 3rd nor for the 5th edition of the SDK and it will be hard to find the error when you’re new to the API… as new as my very person.

You’ll be able to solve the problem when you know that the label has a width and height equal to zero because then you’ll find a function called CalcMinimumSize.

Please Nokians, when you know that your S60 API is crap (and you know it, otherwise you wouldn’t torture the Qt guys to port Qt to S60), why aren’t you be more careful with your API docu?

Please start with the example I mentioned above and change it accordingly:


void CMyViewContainer::ConstructL(const TRect& aRect)
{
TSize size;
TPtrC text = _L("Testing Compound controls in symbian.");
CreateWindowL();
//Creates a CEikLabel object, which is a class that supports the display of text in the parent window.
iLabel = new (ELeave) CEikLabel;
iLabel->SetContainerWindowL(*this);
//Sets a text for the label.
iLabel->SetTextL( text );
size = iLabel->CalcMinimumSize(text);
size.iHeight += 5; // this is because the API isn't even
// able to compute the right bounding box
iLabel->SetSize(size);
//In affect calls the SizeChange() of the Control
SetRect(aRect);
//Sets the control as ready to be drawn.
ActivateL();
}

Thanks! That’s the least I could contribute to your S60 stuff. I for myself hope to never ever get in touch with this again… .