×
Namespaces

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

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

Carbide.c++ Tutorial 2 - Getting Input from user

From Nokia Developer Wiki
Jump to: navigation, search

This code example shows how to use the Carbide.c++ designer to create a single line data query input dialog. The example presents the user with an input dialog: once the user enters text and selects the OK softkey the entered text is displayed to the user.

Article Metadata
Code Example
Source file: Media:Dialogs.zip
Article
Created: vdharankar (27 Aug 2009)
Last edited: hamishwillee (14 Feb 2012)

The input dialog is in the Carbide.c++ designers's Notes and Dialogs section.

Contents

Prerequisite

See this tutorial first in order to understand basics of creating and running an application: Helloworld tutorial

Step 1 - Start a new project

  1. Start with a new project using Carbide.c++ IDE.
  2. Call it dialogs ( or whatever you like).

Once you are done with all basic steps you will see this window.

Dialogs 1.JPG

Step 2 - Add Single Line Data Query

Now add the Single Line Data Query input dialog to the form.

Dialogs 3.JPG

When selected from control pane, it would appear as below.

Dialogs 2.JPG

Step 3 - Delete the default

Now delete the default text appearing in the text area of the dialog.

Dialogs 4.JPG

Step 4 - Add event handler

  1. Add one menu item in the options menu.
    Refer to the above mentioned hello-world tutorial.
  2. Call this menu item as "Get Input".
  3. Now add an event handler to the menu item.
    Dialogs 5.JPG

In the event handler the add the code for

  1. Show the dialog.
  2. Read the text from dialog.
  3. Show it back.
    Dialogs 6.JPG

Step 5 - Generated Code

Notice that the IDE generated code for the function to show the data query dialog. Remember not to tamper with the code between the tags called "generated code" this may stop auto generation of code.

Dialogs 7.JPG

Step 6 - Executing the application

Now we are done with the code and design part. Run the application to text it in emulator and following should be the output.

Dialogs 8.JPG
Dialogs 9.JPG

Step 7 - Changing the properties

The properties of the dialog can be altered visually in GUI designer. Right click the dialog and then select "Show properties view" option.

Dialogs 10.JPG

Conclusion

This way we can develop the GUI based application using Carbide.C++ very quickly. Once the basic idea of using dialogs with the IDE is clear, one can go for other dialogs in the application.

Source code

File:Dialogs.zip

Back to the tutorial

This page was last modified on 14 February 2012, at 05:13.
114 page views in the last 30 days.
×