UIQ Technology
Symbian OS Library

UIQ 3.1 SDK        UIQ developer portal

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



UIQ Controls - Calendar


1. Introduction

This guide explains the UIQ control Calendar (CEikCalendar). The Calendar control allows the user to select a date. The control displays a one-month overview and provides numeric input fields for entering year, month and day.

The CEikCalendar should be used to show a generic calendar or the calendar preferred by the system. By default the gregorian calendar is used but other calendars can be implemented and used.

The Calendar control is an exception to how you create controls. Instead of using one of the ordinary ways, you simply launch it.

Calendar is often used in combination with the Date Editor, but it can also be used on its own.

Calendar control showing the default cal...

Calendar control showing the default calendar, the Gregorian calendar


1.1 Further Reference

See the API documentation for Calendar CEikCalendar.

The Calendar control is similar to the Gregorian Calendar control and it can use the Date Editor control. See the How To guides for Gregorian Calendar and Date Editor.

See even the API documentation for Gregorian Calendar (CQikGregorianCalendar) and the Date Editor (CQikDateEditor).

[Top]


2. Architecture

Calendar inherits from CEikBorderedControl.

High-level architecture of Calendar

High-level architecture of Calendar

[Top]


3. Using the Control

This section explains how Calendar is launched and used.


3.1 Includes

Use the following #include directive:

#include <eikcal.h>

Use the following LIBRARY directive in the project's mmp-file:

LIBRARY eikctl.lib


3.2 Resource Structure

No resource structure is defined for Calendar. For structures used when creating the Gregorian Calendar, see Gregorian Calendar.


3.3 Construction

The Calendar control is not like an ordinary control. You cannot create it in one of the four ordinary ways, which are construction with view framework using data from a resource file, construction with your own C++ code using data from a resource file, construction solely from C++ code and construction with the dialog framework using data from a resource file.

Instead, the Calendar control is used to create a Calendar Pop-out using the Gregorian calendar or another calendar of your choice. The default calendar is the Gregorian calendar.


3.4 Using the Calendar

This section covers the most common functions used for interacting with Calendar.

3.4.1 How to Launch a Calendar

To launch a calendar using the Calendar control, use the code below. Note that the observer, which needs to inherit from MEikCalendarObserver, has to be set before calling ExecuteLD.

The ExecuteLD function will launch the calendar pop-out. When execution is completed, the pop-out will be deleted as indicated by the D suffix of the ExcecuteLD function name.

This code launches the default calendar, the Gregorian calendar.

CEikCalendar* calendar = new (ELeave)CEikCalendar();
calendar->SetCalendarObserver(this);
calendar->ExecuteLD();

3.4.2 How to Change the Type of Calendar to Launch

To change the type of calendar being launched, call the function below. It writes the type of calendar to be used in an ini-file which is then used by ExecuteLD to launch the customized calendar.

calendar->SetCalendarTypeInFileL(calendarControlId);


3.5 Destruction

Not applicable.

[Top]


4. Subclassing

Subclassing Calendar is not recommended.