Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 08:46, 22 November 2007.

Changing Status pane text and icon

From Forum Nokia Wiki

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.

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.

 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX