×
Namespaces

Variants
Actions

How to change the CAknPopupFieldText Dynamically

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: vasant21 (28 May 2007)
Last edited: hamishwillee (26 Jul 2012)
#include <badesca.h> 
#include <AknQueryValueText.h>
#include <AknPopupField.h>
 
Link Against :
avkon.lib
CAknPopupField* popup = STATIC_CAST(CAknPopupField*, ControlOrNull( EPopupID));
 
CDesCArray* itemarray = new (ELeave) CDesCArrayFlat( 6 );
 
itemarray->AppendL( _L("Item 1") );
itemarray->AppendL( _L("Item 2") );
itemarray->AppendL( _L("Item 3") );
itemarray->AppendL( _L("Item 4") );
 
CAknQueryValueTextArray* textArray = CAknQueryValueTextArray::NewLC();
 
textArray->SetArray( *itemarray );
 
CAknQueryValueText* queryVal = CAknQueryValueText::NewLC();
 
queryVal->SetArrayL( textArray );
 
queryVal->SetCurrentValueIndex( 0 );
 
popup->SetQueryValueL( queryVal );

Note  : Declare CAknQueryValueText* queryVal as class Member.

Example : Getting the Selected PopUp Item Index and Text.

TInt SelectedIndex  = queryVal->CurrentValueIndex();
HBufC* SelectedItemText = queryVal->CurrentValueTextLC();

in case it doesn't work, try this: http://www.developer.nokia.com/Community/Discussion/showthread.php?102293-pop-up-dialog-on-form&s=4f0d07e55ff730bd87626acfdf1609ca&p=323086

This page was last modified on 26 July 2012, at 05:35.
35 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.

×