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.

How to find out the correct location for softkey labels

From Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): All (S60)
CompatibilityArticle
Keywords: CbaLocation
Created: User:Technical writer 2 (February 8, 2007
Last updated November 26, 2009)
Last edited: hamishwillee (01 Aug 2012)

Overview

The Command Button Array (CBA) is usually located at the bottom of the screen in S60 devices. If a device supports switching between portrait and landscape orientations, the location of the CBA is not fixed (in relation to the screen). While the control pane in the S60 UI is always positioned correctly, scalable applications that draw their own custom labels for softkeys should be aware of the correct location for the CBA.

Detailed description

In some phones (such as the Nokia E70, Nokia E90, Nokia N93, Nokia N95), the softkeys will be on the right or left side of the screen when in landscape mode. If an application needs to adjust its UI (softkey positions) based on orientation, the CBA location can be retrieved with AknLayoutUtils::CbaLocation()

Solution

The return value of AknLayoutUtils::CbaLocation() is one of the following:

    enum TAknCbaLocation
{
EAknCbaLocationBottom, // landscape and portrait
EAknCbaLocationRight, // only landscape
EAknCbaLocationLeft // only landscape
};

When the CBA is located at the bottom, the positive (OK/Options) softkey is always on the left-hand side, and the negative (Cancel/Back) on the right-hand side. When the CBA is on either side of the screen, most devices have the positive softkey at the bottom. As an exception, the Nokia E90 Communicator (when open) has the positive softkey on top. There is no API for directly resolving the order of softkeys. However, the position of the softkey controls can be checked as follows:

  TBool IsOptionsButtonOnTop()
{
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
if( !cba )
{
return EFalse;
}
 
// Assumes that CBA has Options and Exit commands
CCoeControl* options = cba->ControlOrNull( EAknSoftkeyOptions );
CCoeControl* exit = cba->ControlOrNull( EAknSoftkeyExit );
 
if( options && exit )
{
if( options->Position().iY < exit->Position().iY )
{
return ETrue;
}
}
return EFalse;
}
This page was last modified on 1 August 2012, at 04:40.
222 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.

×