Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Navigating controls on up and down keys

From Wiki
Jump to: navigation, search
Article Metadata
Article
Created: vdharankar (09 May 2009)
Last edited: hamishwillee (25 Jul 2012)

This article discusses how to add the navigation to a GUI application which is created using Container, where there is no form navigation support. In such cases we have to add navigation ourselves.

This example assumes using Carbide.c++ UI designer for the project.

Contents

Create the Symbian C++ GUI project with Designer support

Name this project "navigation".


NavStep1.JPG


Select the GUI design as Empty container

NavStep2.JPG

Accept all the defaults and then you will land up in the GUI designer

NavStep3.JPG

Now drag two Labels change their text to Edit1 and Edit2.

Now drag two texteditors from Editors palette, the screen looks like this:

NavStep4.JPG

Now select the container and right click

Now select "Show event view option" from menu. After this events window will show up. In this window double click on offerKeyEvent event and this should take the editor to the body of the event handler.

In this even handler write the following code:

if (aType == EEventKey && aKeyEvent.iScanCode ==  EStdKeyDownArrow)
{
this->iEdit1->SetFocus(false,EDrawNow);
this->iEdit2->SetFocus(true,EDrawNow);
this->iFocusControl = iEdit2;
}
if(aType == EEventKey && aKeyEvent.iScanCode == EStdKeyUpArrow)
{
this->iEdit2->SetFocus(false,EDrawNow);
this->iEdit1->SetFocus(true,EDrawNow);
this->iFocusControl = iEdit1;
}
this->iFocusControl->OfferKeyEventL(aKeyEvent,aType);

Now you should be able to navigate from the one edit box to second and from second to first on pressing up and down arrow keys

The basic idea is to handle these key events and then change the focus from one control to the second control.

This page was last modified on 25 July 2012, at 05:59.
37 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×