UIQ Technology
Symbian OS Library

UIQ 3.1 SDK        UIQ developer portal

[Index] [Spacer] [Previous] [Next]



How to create the application UI class

The role of the application UI is to create and initialize the application views. Application UI has support for categories.

To create a minimal application UI class:

The definition and implementation of a minimal App UI class is given below.


Class definition

The class implements a second-phase constructor. It also has a pointer to a view object, which is constructed in ConstructL().

class CExampleAppUi : public CQikAppUi
    {
public:
    // Second-phase constructor.
    void ConstructL();

private:
    CExampleAppView* iAppView;
    };

[Top]


AppUI second-phase constructor

The implementation of the second-phase constructor ConstructL() is as follows:

  1. The constructor calls CQikAppUi::ConstructL() to load the application's resource file and create its menu.

  2. Create and allocate any application specific resources. Note that this task can also be handled in the View's ViewConstructL(), depending on the situation.

  3. Create and register views; see "How to construct and register views" below.

[Top]


Destructor

Destruction is not needed in UIQ 3 since the framework takes care of deleting the views that are registered.

[Top]


How to construct and register views

Views should be created, that is first-stage construction, and registered in the App UI ConstructL() function. Additionally, you can call the view's second constructor, ConstructL(), also in the App UI's ConstructL() function.

The first view that is registered becomes the standard view in the application.

To construct and register a view you need to derive your new view class from CQikViewBase. You must implement ViewId and ViewConstructL. You may also implement ViewActivatedL and HandleCommandL. ViewId should just return the UID for this view.

In your App UI you need to construct an instance of this view. Call AddViewL(CQikViewBase &aView) to add and register the view aView in the view server and create a new control stack for it

Example:

    //Create the ListView and attach it.
 //This will become the default view since we add it first

    CExampleAppView* iListView = CExampleApptView::NewLC(*this, KNullViewId, Model);
    AddViewL(*iListView);
    CleanupStack::Pop(iListView);