×
Namespaces

Variants
Actions

监听滚动条事件

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

文章
hoolee 在 03 Jul 2008 创建
最后由 hamishwillee 在 15 Dec 2011 编辑

CS000884


  • 开发伙伴平台:

S60 3rd Edition


  • 详细描述

该代码片段演示了如何监听滚动条事件。注意:代码中的MEikScrollBarObserver::HandleScrollEventL()使用需要触摸UI支持。该代码可以通过自签名执行。

MMP文件

需要下列链接库

LIBRARY  eikcoctl.lib


头文件

#include <coecntrl.h>  // CCoeControl
#include <eiksbobs.h> // MEikScrollBarObserver
 
class CMyContainer : public CCoeControl, public MEikScrollBarObserver
{
// ...
 
private: // Functions from base classes
/**
* From MEikScrollBarObserver.
*/
void HandleScrollEventL(CEikScrollBar* aScrollBar,
TEikScrollEvent aEventType);
};


源文件

#include <eiksbfrm.h>  // CEikScrollBarFrame/**
* From MEikScrollBarObserver.
*/
void CMyContainer::HandleScrollEventL(CEikScrollBar* aScrollBar,
TEikScrollEvent aEventType)
{
if (!aScrollBar)
{
return;
}
 
switch (aEventType)
{
case EEikScrollLeft:
{
// Moving left one step
break;
}
case EEikScrollRight:
{
// Moving right one step
break;
}
 
case EEikScrollUp:
{
// Moving up one step
break;
}
case EEikScrollDown:
{
// Moving down one step
break;
}
 
case EEikScrollPageLeft:
{
// Moving left one page
break;
}
case EEikScrollPageRight:
{
// Moving right one page
break;
}
 
case EEikScrollPageUp:
{
// Moving up one page
break;
}
case EEikScrollPageDown:
{
// Moving down one page
break;
}
 
case EEikScrollThumbDragHoriz:
{
// Horizontal drag started
break;
}
case EEikScrollThumbReleaseHoriz:
{
// Horizontal drag released
break;
}
 
case EEikScrollThumbDragVert:
{
// Vertical drag started
break;
}
case EEikScrollThumbReleaseVert:
{
// Vertical drag released
break;
}
 
case EEikScrollHome:
{
// Scrolled to the beginning (horiz.)
break;
}
case EEikScrollEnd:
{
// Scrolled to the end (horiz.)
break;
}
 
case EEikScrollTop:
{
// Scrolled to the top (vert.)
break;
}
case EEikScrollBottom:
{
// Scrolled to the bottom (vert.)
break;
}
 
default:
{
break;
}
}
}
This page was last modified on 15 December 2011, at 08:45.
114 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×