×
Namespaces

Variants
Actions

Carbide.c++ Tutorial 1 - Helloworld

From Nokia Developer Wiki
Jump to: navigation, search

This tutorial provides a basic Symbian C++ "hello world" example. It demonstrates all the steps necessary to develop a helloword GUI based Symbian C++ application and how to use UI designer. The example code is also available #Source Code.

Article Metadata
Code ExampleArticle
Created: vdharankar (17 Aug 2009)
Last edited: hamishwillee (17 Jul 2012)

Contents

Introduction

Carbide.c++ is Nokia's IDE for developing application on various platforms, like Symbian C++, Open C/C++, Qt, etc. Symbian C++ development has really become easy (to good extent) after the invent of the IDEs. Carbide.c++ comes with a unique tool called as UI designer, allowing faster prototyping and deployment. This tutorial mainly deals with UI designer and it can be followed on all editions of Carbide.C++.

This tutorial assumes that S60 SDK and Carbide.c++ is already installed and setup. Check SDK and Carbide.c++ installation guide for more information.

Step 1 - Create new project

  1. Start with a new Symbian C++ project using file menu of carbide c++.
  2. Next select GUI application with UI designer as an option on next screen as shown in screenshot.
    This step enables the GUI editor for the project.
    Hello step1.JPG

Step 2 - Enable UI designer

  • Next enter the desired name of project. As a basic user, select the default location.

Once you get some expertise you can select any other workspace. Basically carbide.c++ manages the projects using workspaces. Workspace is a collection of projects. One can group relevant projects in one workspace. In carbide it is possible to switch between multiple workspaces. One can set the default location and can explore more there.

Hello step2.JPG

Step 3 - Select the build configuration

In the next step, the wizard asks to select the build configurations to be added for the project. Usually, by default, all the configurations are selected.

  • For this project and for most of the projects, Emulator debug (WINSCW) and one Phone release configuration is required.

Once this is confirmed click on next.

  • Hello step3.JPG

Step 4 - Application properties

In the next step, you will be prompted to enter few application properties.

  • Enter the application name here as Helloworld. You can keep rest of the things as default.
    Hello step4.JPG

Step 5 - Select the view type

In the next step, the wizard prompts to select a view type for the application.

  • For our application select an empty container as we will not have any control in it.
  • Hello step5.JPG

Step 6 - Select name for the view

  • The next step involves naming the container class and the type of the class, as shown in figure.
    One more important thing that is selected in this step is the support for view switching ability.
    Hello step6.JPG

Step 7 - Some more properties

In the next step, we will need to input some more information like UID .

  • If you are not aware of these concepts you can leave the defaults and go to next step.
    Hello step7.JPG

Step 8 - Select / change project directories.

  • Accept default suggestion for directories in the next step. Finish the wizard by clicking the finish button.
    Hello step8.JPG

Step 9 - Changing title of application window

Now we will have the UI designer window which showcases the application window in it.

  • Double click the title of the application window and change it to Helloworld or anything else that you wish.
    Hello step9.JPG

Step 10 - Building the application

Now following these steps, you can run your first Helloworld application.

  1. Go to Project Explorer window right click your own project name.
  2. From the popup menu select the Build Project option.
    If everything goes well you will have no errors in bottom output window.
    Hello step10.JPG

Step 11 - Running the application

Once the build is successful, run the application with the help of pop up menu.

  1. To get the popup, right click on the project as show in the figure.

One this is done, Carbide launches the emulator and the application is started in the emulator.

  1. Hello step11.JPG

Step 12 - Emulator output

The application usually starts in the emulator (S60 3rd FP2 onwards), once run option is selected. If not then it can be started manually from installation menu in the emulator. When you start to run the application it asks for the process to run make sure that it is name of the process is the one which we want to run.

Hello step12.JPG

The output can be observed in the emulator.

Hello step13.JPG

Step 13 - Add a menu option

Now we have the basic Symbian C++ helloworld application running, doing nothing great.

  1. Further, click on options menu in the bottom window. It will bring up the menu in the main application window.
    Hello step14.JPG
  2. Next, in the menu type down the name as shown in figure.
    This will add a new menu option to the "Option" menu.
    Hello step15.JPG
  3. Next, right click on the menu option itself and a pop will appear.
  4. From this pop up select the option called "Handle Selected Event".
    Hello step16.JPG
    This should bring up the code window, where you can edit the code for the event. This is basically a method which will get called when the menu will be selected.
    Hello step17.JPG
  5. In the event handler function/method type down the code from the screenshot.
    Hello step18.JPG
  6. Now, save the file and run the application the way described above.
    This should give the output as below.
    Hello step19.JPG

Conclusion

This way, a basic helloworld application can be developed using Carbide c++. Few steps are unnecessary in the wizard but sometimes they turn to be useful. Following the same steps one can develop his own application. This tutorial can be followed by any person with minimal knowledge of Symbian. But for further things a good tutorial on Symbian C++ is necessary.

Source Code

File:Carbid tut1 Helloworld.zip

Back to the tutorial

This page was last modified on 17 July 2012, at 08:57.
259 page views in the last 30 days.
×