在navi pane上显示箭头

使用ui designer创建gui项目之后,添加了若干个ui design,并通过tabs group上的tab来切换不同的view,至此都是ui designer完成的。接下来希望可以在tabs group两侧显示箭头,来切换被隐藏的tab,在ui的constructL里添加

void CUIDesignerTestAppUi::ConstructL() { // [[[ begin generated region: do not modify [Generated Contents] BaseConstructL( EAknEnableSkin | EAknEnableMSK ); InitializeContainersL(); // ]]] end generated region [Generated Contents] // the following codes should be called each time the controls and views change. if( iNaviTabs1 && iNaviDecorator_) { iNaviDecorator_->MakeScrollButtonVisible( ETrue ); iNaviTabs1->MakeVisible( ETrue ); iNaviDecorator_->DrawDeferred(); } }  

如此一来,程序启动以后,就可以看见tabs group右侧有一个箭头,但是光这样还不够,这时候如果点一下箭头,视图是切换了,但也仅限于此,因为箭头不见了,它默认是隐藏的。

解决方法如注释所述,if语句应该在每次控件和视图发生变化的时候被调用,由于navi tab pane是添加到ui类的,因此,试着将这段代码添加到HandleViewDeactivation函数中

void CUIDesignerTestAppUi::HandleViewDeactivation( const TVwsViewId& aViewIdToBeDeactivated, const TVwsViewId& aNewlyActivatedViewId ) { CAknViewAppUi::HandleViewDeactivation( aViewIdToBeDeactivated, aNewlyActivatedViewId ); // [[[ begin generated region: do not modify [Generated Contents] if ( aNewlyActivatedViewId.iAppUid == KUidUIDesignerTestApplication ) { SetActiveTabByViewId( aNewlyActivatedViewId.iViewUid ); } // ]]] end generated region [Generated Contents] // the following codes should be called each time the controls and views change. if( iNaviTabs1 && iNaviDecorator_) { iNaviDecorator_->MakeScrollButtonVisible( ETrue ); iNaviTabs1->MakeVisible( ETrue ); iNaviDecorator_->DrawDeferred(); } }

实验结果是:这样可以:)

你可能感兴趣的:(Symbian,:,Basic)