静态&动态form pop item

静态在form的资源DLG_LINE中添加EAknCtPopupFieldText实现弹出 选项。选项的内容由r_lv_list_popup_items 中静态指定,创建form对话框时直接从资源创建。

 

1.

RESOURCE DIALOG r_lv_dialog

{

 

flags =EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | EEikDialogFlagCbaButtons ;

//EEikDialogFlagWait |EEikDialogFlagCbaButtons;

buttons =R_AVKON_SOFTKEYS_OPTIONS_CANCEL;

form = r_lv_form;

 

}

 

 

 

//找回号码窗体

RESOURCE FORM r_lv_form

{

flags = EEikFormUseDoubleSpacedFormat|EEikFormEditModeOnly;//EEikFormEditModeOnly;//|EEikFormUseDoubleSpacedFormat ;

       DLG_LINE

           {

           type = EAknCtPopupFieldText;

           prompt = "Popup field text";

           id = EMyAppControlIdPopupFieldText;

           itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;

           control = POPUP_FIELD_TEXT

               {

              

               popupfield = POPUP_FIELD 

                {width = 30 ;};

               textarray = r_lv_list_popup_items;

               active = 0;

               };

           }

};

}

RESOURCE ARRAY r_lv_list_popup_items
    {
    items =
        {
        LBUF { txt = qtn_bawlist_rules1; },
        LBUF { txt = qtn_bawlist_rules2; },
        LBUF { txt = qtn_bawlist_rules3; }
        };
    }
2.可以通过在PreLayoutDynInitL 中设置新的列表项实现新的条目,具体如   http://wiki.forum.nokia.com/index.php/Tips_of_CAknForm所示。
 
iPopupCtrl = static_cast <CAknPopupFieldText*> (ControlOrNull(EMyAppControlIdPopupFieldText));
CAknPopupField* popupFieldText = iPopupCtrl;
if (popupFieldText)
{
iItemArray = new (ELeave) CDesCArrayFlat( 6 );
iItemArray->AppendL(_L("NewItem1"));
iItemArray->AppendL(_L("NewItem2")); 
iItemArray->AppendL(_L("NewItem3")); 
iItemArray->AppendL(_L("NewItem4")); 
 
iTextArray = CAknQueryValueTextArray::NewL(); 
iTextArray->SetArray( *iItemArray ); 
iQueryValText = CAknQueryValueText::NewL(); 
iQueryValText->SetArrayL( iTextArray ); 
iQueryValText->SetCurrentValueIndex( 0 ); 
 
popupFieldText->SetQueryValueL( iQueryValText ); 
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值