Queries

A query is a state where the software waits for user input. Queries are used in situations with more than one ways to proceed, when the application needs data from the user, or when it is necessary to make sure the user knows what is happening. A query must be exited before the application can proceed.

Queries are displayed in pop-up windows. The following query types can be used:

Query types

Description

Confirmation query

A question or notice with one or two possible responses.

List query

A question with a selection of more than two possible (pre-defined) responses in a list.

Grid query

A question with a selection of more than two possible (pre-defined) responses in a grid.

Multi-selection list query

Presents a list of items; the user can select any number of them.

Data query

Used for numeric or textual input.

Message query

Used for various purposes in queries that are longer than one screen.

Using queries in applications

The APIs to use for queries are the Queries API, Dialogs API, and the Popups API. For implementation information, see Using the Dialogs API.

Query dialogs are dialogs that can be used to require user input or user selection. All query dialogs derive from CAknQueryDialog, which inherits CAknDialog. There are two types of queries: local and global queries. Local query dialogs are local to a certain application. That means they are only displayed within this application. Global query dialogs are system-wide queries, and are shown topmost even when another application moves to the foreground. Query dialogs require resource definitions when they are used in your code.

Note: To have a header pane, the AVKON_HEADING component should be specified as the first dialog line in the resource description.

At runtime, the dialog's header pane (CAknPopupHeadingPane) can be obtained by calling the method CAknQueryDialog::QueryHeading().

The following parts are available for modification from the class CAknQueryDialog:

  • Data query

    • Header text

    • Header image/animation

    • Prompt text

    • Edit indicator (can be removed)

  • Confirmation query

    • Prompt text

    • Image/animation

  • List query

    • Header text

    • Header image/animation

    • List type (Single, SingleHeading, SingleGraphic, SingleGraphicHeading)

The following example illustrates the resource definition for the Secret Editor Query, which contains a Secret Editor, resides inside the dialog. The values for flags, type, id, and control are specific to the query dialog. These values are enumerated in the file avkon.hrh, which is in the ./epoc32/include folder.

RESOURCE DIALOG r_aknexquery_code_query
    {
    flags = EGeneralQueryFlags
    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
    items =
        {
        DLG_LINE
            {
            type = EAknCtQuery;
            id = EGeneralQuery;
            control = EGeneralQueryFlags
                {
                layout = ECodeLayout;
                label = label_text;
                control = SECRETED
                    {
                    num_letters = 8;
                    };
                };
            }
        };
    }

The query in the above example includes a secret editor. For information on implementing secret editors, see the Editors API.

See also: