S60 设置ListBox控件滚动条位置
我创建 ListBox,并创建了ScrollBar,设置 ListBox 的位置后,但是ScrollBar 的位置确不能跟ListBox的位置变动,是否哪有步骤遗留呢?
代码段如下:
--------------------------------------
void CListBoxTestAppView::ConstructL( const TRect& aRect )
{
CreateWindowL();
CreateListBox();
SetRect( aRect );
ActivateL();
}
void CListBoxTestAppView::SizeChanged()
{
iTestListBox->SetExtent(TPoint(0, 80), TSize(240, 120));
}
void CListBoxTestAppView::CreateListL()
{
// First phase construction
iTestListBox= new (ELeave)CAknSingleStyleListBox;
iTestListBox->SetContainerWindowL(*this);
// Second Phase Construction
TResourceReader reader;
iEikonEnv->CreateResourceReaderLC(reader, R_TEST_LISTBOX);
iTestListBox->ConstructFromResourceL(reader);
CleanupStack::PopAndDestroy(); // reader
// Setup the ScrollBar
SetupScrollBarsL();
}
void CListBoxTestAppView::SetupScrollBarsL()
{
iTestListBox->CreateScrollBarFrameL(ETrue);
iTestListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
}
--------------------------------------
[解决办法]
有问题请先GOOGLE,BAIDU