03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

{<br />

public:<br />

. . .<br />

static CExampleHelloControl* NewL(const CCoeControl& aContainer,<br />

~CExampleHelloControl();<br />

const TRect& aRect);<br />

private:<br />

void ConstructL(const CCoeControl& aContainer, const TRect&<br />

aRect);<br />

private: // From CCoeControl<br />

void Draw(const TRect&) const;<br />

private:<br />

HBufC* iText;<br />

. . .<br />

};<br />

The essential change here is that I have to pass a CCoeControl& parameter to the control<br />

to tell it which CCoeControl to lodge in.<br />

The construction changes from:<br />

void CHelloGuiAppView::ConstructL(const TRect& aRect)<br />

{<br />

CreateWindowL();<br />

SetRectL(aRect);<br />

ActivateL();<br />

iHelloWorld = iEikonEnv-<br />

>AllocReadResourceL(R_HELLOGUI_TEXT_HELLO);<br />

}<br />

to:<br />

void CExampleHelloControl::ConstructL(const CCoeControl& aContainer,<br />

const TRect& aRect)<br />

{<br />

SetContainerWindowL(aContainer);<br />

SetRect(aRect);<br />

iView=CExampleHelloView::NewL();<br />

iText=iEikonEnv-<br />

>AllocReadResourceL(R_EXAMPLE_TEXT_HELLO_WORLD);<br />

iView->SetTextL(*iText);<br />

. . .<br />

ActivateL();<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!