Carbide.c++ Tutorial 6 - A dialog example
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.
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.
The resultant screen should look like as follows
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++.
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).
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
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.
Step 5 - Run the example
Now run the example and you should see following output.
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
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.
Cancel button can not be removed from UI designer.
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.