×
Namespaces

Variants
Actions
Revision as of 06:30, 14 February 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Carbide.c++ Tutorial 6 - A dialog example

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Code Example
Source file: Media:Dialogs2.zip
Article
Created: vdharankar (28 Sep 2009)
Last edited: hamishwillee (14 Feb 2012)

Tutorial 2 discusses how an input can be acquired from a user. In this example we have seen how a SingleLineDataQuery dialog can be used. Tutorial 2 explains use of one of the frequently needed dialog. In this tutorial we will see another frequently needed dialog, the wait dialog.

Contents

Example Overview

Example is a step by step guide to show how a wait dialog can be added to an application using UI designer. If you have not followed the tutorial trail then you might be interested in knowing how basic application can be developed using Carbide.c++ then see it here. This tutorial assumes that S60 SDK and Carbide.c++ is already installed and setup. Check here for more information.

The step by step guide

Step 1 - Create new project

1) Start with a new S60 3rd edition project with UI designer support. Refer to tutorial 1 for this.
2) Give some suitable name to the project. I am calling this "Dialog2" as first dialog example was tutorial 2.

Dialogs are located under "Notes and Dialogs" section of control palette.

3) Locate "wait dialog" under palette.
4) Drag the wait dialog to the design.

Dialog2 1.JPG

The resultant screen should look like as follows

Dialog2 2.JPG

Step 2 - Changing the properties

As soon as the wait dialog is added to the design, code is generated for the dialog by Carbide.c++.

Dialog2 6.JPG

The wait dialog can be configured for its behavior using properties. Infact all the dialogs can be configured

in same way using UI designer.

To check the properties

1) Select the dialog in design.
2) Right click and select properties.
3) Properties window should be brought in foreground at the bottom of UI designer(if you have not changed its location).

Dialog2 3.JPG

You can change properties here and save the design. Code gets modified behind the scene.

Step 3 - Change the title

The title of the wait dialog can be changed from UI designer as well as from properties window. To change from design

Double click on title

Dialog2 4.JPG

Step 4 - Add a test menu

Add a test menu to options menu. This we will use to test the wait dialog. 

You can refer earlier tutorials to know how menus can be added and related event handling such as this tutorial Carbide.c++ Tutorial 1 - Helloworld.

Add following code to the event handler of the menu.

Dialog2 7.JPG

Step 5 - Run the example

Now run the example and you should see following output.

Dialog2 8.JPG

Step 6 - Removing cancel button

In the output you can see that the dialog is displayed with a cancel button. Usually with wait dialog we do not show cancel button, not to let user cancel the important activity. This can be done by editing code from a resource file as shown.

Edit the ".rssi" file , remove the CANCEL button

Dialog2 9.JPG

Now run the example and see that the cancel button disappears.

All the dialogs can be altered in this way by editing code. But remember that if a new design change is made 
to this file then UI designer removes the modifications you made. So you should go with this alternative with 
a great care.

Dialog2 10.JPG

Cancel button can not be removed from UI designer.

Conclusion

The UI designer lets us design the applications with dialogs visually, which is quite easy. Sometimes UI designer doesn't let user change the control behavior the way we want, in this situation the design behind code can be edited. But the edited code may get removed if the visual design is altered. So such alterations should be done at the end of development.

Source Code

File:Dialogs2.zip

Back to the tutorial

Carbide.c++ Tutorials

This page was last modified on 14 February 2012, at 06:30.
135 page views in the last 30 days.
×