×
Namespaces

Variants
Actions

Changing Status pane text and icon

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: symbianyucca (30 Mar 2007)
Last edited: hamishwillee (30 May 2013)

The status pane icon and title are a good way of showing the current status inside the application. The following code samples illustrate how you can change the status pane icon and text on run time to help users determine the current status of the application.

Headers required:

#include <eikspane.h>
#include <akncontext.h>

Library required:

LIBRARY        eikcoctl.lib

Source File:

void ChangePaneIconL(const TDesC& aIconFile, TInt aIndex, TInt aMask)
{
CEikStatusPane* sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane();
if (sp)
{
CAknContextPane* ContextPane = (CAknContextPane*)
sp->ControlL(TUid::Uid(EEikStatusPaneUidContext));
if (ContextPane)
{
ContextPane->SetPictureFromFileL(aIconFile,aIndex,aMask);
}
}
}
 
void ChangePaneIconDefaultL(void)
{
CEikStatusPane* sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane();
if (sp)
{
CAknContextPane* ContextPane = (CAknContextPane*)
sp->ControlL(TUid::Uid(EEikStatusPaneUidContext));
if(ContextPane)
{
ContextPane->SetPictureToDefaultL();
}
}
}

ChangePaneIconL() function is used to change the current icon. The aIconFile can be either an MBM or MIF file and should include the full file name (i.e. drive+path+name+extension). aIndex is the index to the icon image and aMask is the index to the mask image used with the image.

ChangePaneIconDefaultL() function is used to change the default icon back.

void ChangePaneTextL(const TDesC& aText)
{
CEikStatusPane* sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane();
if (sp)
{
CAknTitlePane* TitlePane = STATIC_CAST(CAknTitlePane*,
sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
if (TitlePane)
{
TitlePane->SetTextL(aText);
}
}
}
 
void ChangePaneTextDefaultL(void)
{
CEikStatusPane* sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane();
if (sp)
{
CAknTitlePane* TitlePane = STATIC_CAST(CAknTitlePane*,
sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
if (TitlePane)
{
TitlePane->SetTextToDefaultL();
}
}
}

ChangePaneTextL() function is used to change the status pane text and the ChangePaneTextDefaultL() function is used to change the status pane text back to its default text.

This page was last modified on 30 May 2013, at 07:37.
55 page views in the last 30 days.
×