Dynamically changing CAknPopupFieldText

Login to reply to this topic.
Fri, 2006-02-03 21:25
Joined: 2004-05-29
Forum posts: 149
Does anyone know how to change the items in a CAknPopupFieldText or EAknCtPopupFieldText?  I am at a lost... this is what I'm trying now:

Code:
CAknPopupFieldText* field = static_cast <CAknPopupFieldText*>(ControlOrNull(EPopupFieldId));
const MDesCArray* array = field->MdcArray();
array->MdcaPoint(i); // does nothing

CAknPopupFieldText does not have any members for changing the text.  I am doing this from my CAknForm's PreLayoutDynInitL().  If it matters, here is the resource code:

Code:
RESOURCE FORM r_the_form
{
flags = EEikFormEditModeOnly | EAknDialogSelectionList;

items =
{
// The service
DLG_LINE
{
id = EPopupFieldId;
type = EAknCtPopupFieldText;
prompt = "Popup Field";
itemflags = EEikDlgItemSeparatorBefore | EEikDlgItemTakesEnterKey;
control = POPUP_FIELD_TEXT
{
popupfield = POPUP_FIELD { width = 32; };
textarray = r_the_textarray;
active = 0;
};
}
};
}

So if I use resources to make a popup field on a form, am I out of luck or what?

-euroq

Tue, 2006-02-07 21:02
Joined: 2004-05-29
Forum posts: 149
Re: Dynamically changing CAknPopupFieldText
To anyone who is curious what the answer is, you have to use a CAknQueryValueTextArray.  You'll probably want to look at the following classes.

Code:
CDesCArrayFlat
RArray<TInt>
CAknQueryValueTextArray
CAknQueryValueText

-euroq
Mon, 2006-04-17 15:41
Joined: 2006-04-13
Forum posts: 7
Re: Dynamically changing CAknPopupFieldText
Did you still call it from PreLayoutDynInitL()?
Tue, 2007-04-17 14:21
Joined: 2007-01-14
Forum posts: 7
Re: Dynamically changing CAknPopupFieldText
Quote from: euroq
To anyone who is curious what the answer is, you have to use a CAknQueryValueTextArray.  You'll probably want to look at the following classes.

Code:
CDesCArrayFlat
RArray<TInt>
CAknQueryValueTextArray
CAknQueryValueText

-euroq




For more details about the way to do it, here is the code:
CAknPopupField* mypopup=
STATIC_CAST(
CAknPopupField*,
ControlOrNull( EPopupID ) ) ;

CDesCArray* array = new (ELeave) CDesCArrayFlat( 8 );
   array->AppendL( _L("January") );
   array->AppendL( _L("February") );
   array->AppendL( _L("March") );
   array->AppendL( _L("April") );
   array->AppendL( _L("May") );
   array->AppendL( _L("June") );
CAknQueryValueTextArray* textArray =
               CAknQueryValueTextArray::NewLC();

   textArray->SetArray( *array );

   CAknQueryValueText* queryVal = CAknQueryValueText::NewLC();
      queryVal->SetArrayL( textArray );
                  queryVal->SetCurrentValueIndex( 0 );               mypopup->SetQueryValueL( queryVal );
Mon, 2007-07-23 12:30
Joined: 2007-07-23
Forum posts: 1
Re: Dynamically changing CAknPopupFieldText

Hi, I am using the previous code, but I have a problem:

In the last line:

mypopup->SetQueryValueL(queryVal);

I have this problem:

illegal access from 'CAknPopupFieldText' to protected/private member 'CAknPopupFieldText::SetQueryValueL(MAknQueryValue *)'

Does someone know which is the problem?

Thanks in advance

Tue, 2007-07-24 06:10
Joined: 2006-04-03
Forum posts: 80
Re: Dynamically changing CAknPopupFieldText

Use the base class CAknPopupField to set the query value

// Get the handle to control //
CAknPopupField* accountNameEditor = static_cast(ControlOrNull(EOppFormPopUpCtrlId));

CDesCArray* array = new (ELeave) CDesCArrayFlat( 2 );

TBuf16<100> temp16;
temp16.Copy(_L("Vasant"));
array->AppendL( temp16 );

textArray = CAknQueryValueTextArray::NewL();
textArray->SetArray( *array );

queryVal = CAknQueryValueText::NewL();
queryVal->SetArrayL( textArray );


// Sets the query values set //
accountNameEditor->SetQueryValueL( queryVal );


Vasant Patel.
Sr. Software Engineer.
S60 2nd Ed., S60 3rd Ed., Win32.

  • Login to reply to this topic.