UIQ Technology
 Developer Library

UIQ 3 SDK

UIQ developer portal

FEEDBACK 

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



How to create a minimal application view class

A UIQ application's view occupies the application space, which is most of the screen area.

It contains controls which the user can interact with. It is owned and constructed by the application UI class.

The view also handles pointer events and user commands. It is also possible to pass on the commands that are not applicable to the App UI.

To create a minimal view class:

The following code fragment shows a minimal view-class definition.

class CExampleView : public CQikViewBase
    {
private:
    void ConstructL();
protected:
     TVwsViewId ViewId()const;
  void ViewContructL();
    };

The following code fragment shows the minimal implementation of NewLC() in the class. Note that the function leaves the class on the cleanup stack.

CExampleView* CExampleView::NewLC(CQikAppUi& aAppUi, const TVwsViewId aParentViewId, CExampleModel& aModel)
    {
    CExampleView* self = new(ELeave) CExampleView(aAppUi, aParentViewId, aModel);
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
    }

The following code fragment shows the minimal implementation of first-phase constructor.

CExampleView::CExampleView(CQikAppUi& aAppUi, const TVwsViewId aParentViewId, CExampleModel& aModel)
    : CQikViewBase(aAppUi, aParentViewId), iExampleModel(aModel), iCmdManager(CQikCommandManager::Static())
    {
    
    }

The following code fragment shows the minimal implementation of second-phase constructor. This is a standard pattern for a view control.

void CExampleAppView::ConstructL(const TRect& aRect)
    {
    CQikViewBase::BaseConstructL();
    }

The following code fragment shows the implementation of ViewId() function.

void CExampleAppView::ViewId()const
    {
    return TVwsViewId(KUidExampleApp, KUidExampleAppView);
    }

The following code fragment shows a minimal implementation of ViewConstructL() function. It reads a resource struct from the resource file and constructs the view.

void CExampleAppView::ViewConstructL()
    {
    ViewConstructFromResourceL(R_EXAMPLEAPP_LISTVIEW_UI_CONFIGURATIONS);
    }

Terms and conditions of use of the material