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.

You can set a control's position and size. Here are the declarations related to position and<br />

size:<br />

class CCoeControl : public CBase<br />

{ m<br />

public:<br />

...<br />

IMPORT_C void SetExtentL(const TPoint& aPosition, const TSize&<br />

aSize);<br />

IMPORT_C void SetSizeL(const TSize& aSize);<br />

IMPORT_C void SetPosition(const TPoint& aPosition);<br />

IMPORT_C void SetRectL(const TRect& aRect);<br />

IMPORT_C void SetExtentToWholeScreenL();<br />

...<br />

IMPORT_C TSize Size() const;<br />

IMPORT_C TPoint Position() const;<br />

IMPORT_C TRect Rect() const;<br />

IMPORT_C TPoint PositionRelativeToScreen() const;<br />

...<br />

IMPORT_C virtual void SizeChangedL();<br />

IMPORT_C virtual void PositionChanged();<br />

IMPORT_C void SetCornerAndSizeL(TCoeAlignment aCorner, const<br />

TSize&<br />

aSize);<br />

IMPORT_C void SetSizeWithoutNotificationL(const TSize& aSize);<br />

...<br />

protected:<br />

...<br />

TPoint iPosition;<br />

TSize iSize;<br />

...<br />

};<br />

Position and size are stored in iPosition and iSize. You can interrogate them with<br />

Position(), Size(), or Rect() and change them with SetExtentL(),<br />

SetPosition(), SetSizeL(), and SetRectL().<br />

Changing the size of a control could, in rare cases, cause memory to be allocated, which<br />

could fail – so all functions that change size are potentially leaving. SetPosition() does<br />

not change size so it cannot leave.<br />

� When a control's size is changed, its virtual SizeChangedL()function is called.<br />

� A position change is notified by PositionChanged().

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

Saved successfully!

Ooh no, something went wrong!