Symbian 中大段文本显示控件详解
2010-02-22 20:53:00 来源:WEB开发网{
if((aType == EEventKeyDown) && (aKeyEvent.iScanCode == EStdKeyDownArrow))
{
if(iTotalLine >= iStartLine+iMaxDisplayLine)
{
++iStartLine;
}
}
else if((aType == EEventKeyDown) && (aKeyEvent.iScanCode == EStdKeyUpArrow))
{
if(iStartLine > 0)
{
--iStartLine;
}
}
iSBFrame->MoveVertThumbTo(iStartLine);//绝对坐标
iSBFrame->DrawScrollBarsNow();
DrawNow();
return EKeyWasConsumed;
}
void CTextDisplay::SetDisplayContent(const TDesC& aContent,TBool aUseFlag)
{
if(aContent.Length() == 0)
{
return ;
}
if (iDisplayContent)
{
iDisplayContent->ResetAndDestroy();
delete iDisplayContent;
iDisplayContent = NULL;
}
iDisplayContent = new RPointerArray
HBufC *CopyText = aContent.Alloc();
if(aUseFlag)
{
TBuf<6> bufBeginTag(KLineStart);
TBuf<7> bufEndTag(KLineEnd);
while(CopyText->Length())
{
TInt posBegin = CopyText->Find(bufBeginTag)+bufBeginTag.Length();
TInt posEnd = CopyText->Find(bufEndTag);
if(posBegin!=KErrNotFound&&posEnd!=KErrNotFound)
{
TPtrC ptrPerson = CopyText->Mid(posBegin,posEnd-posBegin);
HBufC *HText = ptrPerson.Alloc();
iDisplayContent->Append(HText);
if(CopyText->Length() > posEnd+bufEndTag.Length()+1)
{
CopyText->Des().Copy(CopyText->Des().Right(CopyText->Length()-posEnd-bufEndTag.Length()));
}
else
{
break;
更多精彩
赞助商链接