列表框CAknSingleStyleListBox 用法
来源:互联网 发布:c语言面试经常问的问题 编辑:程序博客网 时间:2024/06/06 00:46
CAknSingleStyleListBox
1.在头文件中定义
CAknSingleStyleListBox * iListBox;
CDesCArrayFlat* iListBoxArray;
2.在cpp文件中ConstructL()中
//创建列表
iListBox = new (ELeave) CAknSingleStyleListBox;
iListBox->SetContainerWindowL(*this);
//iListbox->SetMopParent(this);
iListBox->ConstructL(this, /*EAknListBoxSelectionList*/
EAknListBoxSelectionList | EAknListBoxLoopScrolling);
iListBox->SetExtent(TPoint(0, 0), TSize(aRect.Size().iWidth,
aRect.Size().iHeight));
//数据操作
iListBoxArray = new (ELeave) CDesCArrayFlat(10);
CTextListBoxModel* model = iListBox->Model();
model->SetItemTextArray(iListBoxArray);
model->SetOwnershipType(ELbmOwnsItemArray);
//添加滚动条
iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
for (TInt i = 0; i < 10; i++)
{
TBuf<32> sTmpBuf;
sTmpBuf.Append(_L("/t wangshenghu"));
iListBoxArray->AppendL(sTmpBuf);
}
3.在析构函数中
delete iListBox;
4.在CountComponentControls()函数中
return 1;
5.在ComponentControl()函数中
switch (aIndex)
{
case 0:
{
return iListBox;
}
default:
return NULL;
}
6.在OfferKeyEventL()函数中
TKeyResponse ret(EKeyWasNotConsumed);
if (iListBox)
{
ret = iListBox->OfferKeyEventL(aKeyEvent, aType);
return ret;
}
return ret;
1.在头文件中定义
CAknSingleStyleListBox * iListBox;
CDesCArrayFlat* iListBoxArray;
2.在cpp文件中ConstructL()中
//创建列表
iListBox = new (ELeave) CAknSingleStyleListBox;
iListBox->SetContainerWindowL(*this);
//iListbox->SetMopParent(this);
iListBox->ConstructL(this, /*EAknListBoxSelectionList*/
EAknListBoxSelectionList | EAknListBoxLoopScrolling);
iListBox->SetExtent(TPoint(0, 0), TSize(aRect.Size().iWidth,
aRect.Size().iHeight));
//数据操作
iListBoxArray = new (ELeave) CDesCArrayFlat(10);
CTextListBoxModel* model = iListBox->Model();
model->SetItemTextArray(iListBoxArray);
model->SetOwnershipType(ELbmOwnsItemArray);
//添加滚动条
iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
for (TInt i = 0; i < 10; i++)
{
TBuf<32> sTmpBuf;
sTmpBuf.Append(_L("/t wangshenghu"));
iListBoxArray->AppendL(sTmpBuf);
}
3.在析构函数中
delete iListBox;
4.在CountComponentControls()函数中
return 1;
5.在ComponentControl()函数中
switch (aIndex)
{
case 0:
{
return iListBox;
}
default:
return NULL;
}
6.在OfferKeyEventL()函数中
TKeyResponse ret(EKeyWasNotConsumed);
if (iListBox)
{
ret = iListBox->OfferKeyEventL(aKeyEvent, aType);
return ret;
}
return ret;
- 列表框CAknSingleStyleListBox 用法
- 列表框CAknSingleStyleListBox 用法
- 列表框用法CAknSingleGraphicStyleListBox控件的用法
- MFC下拉列表框的用法
- 【转】MFC下拉列表框的用法
- MFC下拉列表框的用法
- MFC下拉列表框的用法
- 列表框空间JList的用法演示
- 【转】MFC下拉列表框的用法
- 列表控件ListCtrl用法
- C # 函数用法列表
- ListView列表的用法
- CListCtrl 图标列表用法
- 列表树的用法。
- KeyEvent列表及用法
- 城市列表简单用法
- python之列表用法
- VS2010 下 MFC下拉列表框的用法
- java public protected friendly private比较
- man
- XCode帮助文档离线使用
- 通过drawable下的图片名获取图片的id
- boost::tokenizer
- 列表框CAknSingleStyleListBox 用法
- android中json数据的处理
- 使用AJAX要注意引号
- 【phpcms-v9】phpcms-v9中的两处分页代码
- 自省
- 第六章:Makefile中的变量
- 何为“地理围栏”
- 2012年10月当选微软MVP的CSDN会员名单揭晓!
- [转]Linux应用程序打包