The control

File: inc\MyAppView.h
File: src\MyAppView.cpp

Our control class is called MyAppView (NB: this is not a view in the sense of a view-based AppUi architecture). Two function are interasting in this class - the ConstructL and the Draw

In the first one we start by calling CreateWindowL. This will create a system resource RWindow for our control. This will be a window-owning control. There are also non-window-owning control that uses the RWindow from their parent control and are created with SetContainerWindowL. If possible the non-window-owning controls should be used as they use less system resources but our control don't have a parent, so a window-owning control is the only option.

The second statement is the SetRect which sets the size of the control and then we call ActivateL to make the control appear on the screen.

The DrawL function is called if the whole control or an area of it needs to be redrawn. We simply clear the whole rect without drawing anything.

Another function which is often overwritten (however not in this example) is OfferKeyEventL which is called if a key was pressed and our control is on the controls stack (see AppUi).