WEB开发网
开发学院手机开发Symbian 开发 Symbian 中大段文本显示控件详解 阅读

Symbian 中大段文本显示控件详解

 2010-02-22 20:53:00 来源:WEB开发网   
核心提示:TEventCode aType){if((aType == EEventKeyDown) && (aKeyEvent.iScanCode == EStdKeyDownArrow)){if(iTotalLine >= iStartLine+iMaxDisplayLine){++iStartLine;}}else
TEventCode aType)

{

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;

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:Symbian 大段 文本

编辑录入:coldstar [复制链接] [打 印]
赞助商链接