If your custom control contains a scrollbar, you need to listen for touch events in the scrollbar.
For custom controls that override CCoeControl::HandleScrollEventL() , you must also call the base class implementation of the function.
For an implementation example, see below.
void CMyContainerControl::HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType )
{
if( !aScrollBar )
{
return;
}
TInt newPosition = aScrollBar->ThumbPosition();
switch( aEventType )
{
case EEikScrollUp: // Moving up one step
{
MoveFocusUpL();
break;
}
case EEikScrollDown: // Moving down one step
{
MoveFocusDownL();
break;
}
case EEikScrollThumbDragVert: // Drag started
case EEikScrollThumbReleaseVert: // Drag released
{
if( newPosition < iFocusedIndex )
{
MoveFocusUpL();
}
else if( newPosition > iFocusedIndex )
{
MoveFocusDownL();
}
break;
}
case EEikScrollPageUp:
{
while( newPosition < iFocusedIndex )
{
MoveFocusUpL();
}
break;
}
case EEikScrollPageDown:
{
while( newPosition > iFocusedIndex )
{
MoveFocusDownL();
}
break;
}
default:
{
break;
}
}
DrawNow();
}
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.