You Are Here:

Community: Wiki

This page was last modified on 23 September 2009, at 15:24.

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

From Forum Nokia Wiki

Reviewer Approved   

Contents

Getting input from user

In every application one of the basic requirements, in case of a GUI, is some method to take input from user. There are several options available to get the input from user. One of the simplest options is Single Line Data query input dialog. In Carbide.c++, in the pallet you can see a section called Notes and Dialogs. Here you can find this input dialog.

The Example

The example when executed presents the user with an input dialog. Once user has entered some text and hit the menu application shows the same text back.

The step by step guide

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.

Image:Dialogs_1.JPG

Step 2 - Add Single Line Data Query

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

Image:Dialogs_3.JPG

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

Image:Dialogs_2.JPG

Step 3 - Delete the default

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

Image: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.

Image: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.

Image:Dialogs_6.JPG

Step 5 - Generated Code

Just notice that the IDE generated code for the function to show the data query dialog.

Remember not to tamper the code  between the tags called "generated code" 
this may stop auto generation of code.

Image: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.

Image:Dialogs_8.JPG

Image: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.

Image: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

Here you can visit the main page of tutorial

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia