You Are Here:

Community: Wiki

This page was last modified on 13 May 2009, at 09:27.

Update dialog cba

From Forum Nokia Wiki


The following example shows how to update the CBA of a custom dialog depending upon a given conditon. There are lot of times when we want to bring up a dialog and then change the CBA depending upon certain conditons, i.e. text inputted in the dialog/state of the application etc.

Header file required:

#include <aknquerydialog.h>

No rss is provided as the standard rss for a query dialog would work fine.

Add following lines in .h file.

class CYourDialog : public CAknTextQueryDialog
{
public:
 
static CYourDialog* NewL(
TDes& aText, TTone aTone = ENoTone)
{
CYourDialog* self =
new (ELeave) CYourDialog(aText, aTone);
return self;
}
 
protected:
 
CYourDialog(TDes& aText, const TTone& aTone):CAknTextQueryDialog(aText, aTone)
{
// No implementation required
}
 
protected: // from CAknTextQueryDialog
 
void UpdateLeftSoftKeyL(); //This function would be called everytime something is entered in the dialog
};

Add following lines in .cpp file.

// In your container/view class
TBuf<20> myText;
iYourDialog = CYourDialog::NewL(myText);
iYourDialog->PrepareLC(/*Resource def from rssi file*/);
iYourDialog->RunLD();
 
 
/**
* Over-ridden function from CAknTextQueryDialog, allows us to change the
* text of the LSK depending on some condition
*/

void CYourDialog::UpdateLeftSoftKeyL()
{
CEikButtonGroupContainer& cba = ButtonGroupContainer();
cba.SetCommandSetL(R_AVKON_SOFTKEYS_OK_CANCEL);
TInt posOk = cba.PositionById(EAknSoftkeyOk);
HBufC* textResource = NULL;
 
MakeLeftSoftkeyVisible(ETrue); //Even if there is nothing, shows the LSK
if(CheckIfEntryTextOk()) // in case something is entered
{
if(/*Your Condition 1*/)
{
// My Condition 1 met, leme update
textResource = StringLoader::LoadLC(/*Text resource from rss*/);
cba.SetCommandL(posOk, EAknSoftkeyOk, *textResource);
}
else if(/*Your Condition 2*/)
{
// My Condition 2 met, leme update
textResource = StringLoader::LoadLC(/*Text resource from rss*/);
cba.SetCommandL(posOk, EAknSoftkeyOk, *textResource);
}
}
else
{
// No text is there, lets put something else
textResource = StringLoader::LoadLC(/*Text resource from rss*/);
cba.SetCommandL(posOk, EAknSoftkeyOk, *textResource);
}
if(textResource != NULL)
{
CleanupStack::PopAndDestroy( textResource );
cba.DrawNow();
}
}

Now with this code, your RSK would be changed to show something else depending on what you want instead of the simple Ok which could be confusing to the user on conditional states in your application.

Added by - Mayank on 12/05/2009

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fHowE5ftoE5fimplementE5ftouchE5fimageE5fscrollingE5finE5fJavaE5fME45X qdcZpublisherQUxhttpE3aE2fE2fswE2enokiaE2ecomE2fidE2fc764fd1cE2d8b06E2d499aE2d9a6aE2d17c3903d5a65E2fforumE5fnokiaE5fcrawlerE5fagentX qdcZtitleQSxHowE20toE20implementE20touchE20imageE20scrollingE20inE20JavaE20ME45E20E2dE20ForumE20NokiaE20WikiX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qrssZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qfnZdistributionQUxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2fX qfnZtopicQUqfnTopicZjavaQRqdcZtypeQUqrdfsZE52esourceQRqmarsZrelevanceQNx100X qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZupdatedQDx2008E2d10E2d05X qfnZuserE5ftagQSxjavaX qmarsZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ