Changing Status pane text and icon
Article Metadata
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.libSource 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.


05 Sep
2009
Usually GUI applications require change in graphics in each screen, including icon and text of status pane. Text of a status pane (Title pane text) serve as a heading of page. This article describes how to set icon of status pane as well as how to set text of status pane. Article also describe how to set default status pane icon and text.