EDITOR: Number of lines
| Thu, 2005-11-24 10:21 | |
|
I am trying to find a way to know how many lines are being displayed in a richtextbox but no luck at all. Yeah, I know it's simple but I can't find any article about it.
Here is my code that will use it: Code: TKeyResponse CRTF_XMLContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ) { switch(aKeyEvent.iCode) { case EKeyUpArrow:{ if (intLineCounter > 0) { intLineCounter--; iRtEd->MoveDisplayL(TCursorPosition::EFLineUp); } break; } case EKeyDownArrow:{ //if (intLineCounter <= ??????? Â ) { // <-------- I will have to put it here intLineCounter++; iRtEd->MoveDisplayL(TCursorPosition::EFLineDown); //} break; } default: { // trip lang return iRtEd->OfferKeyEventL(aKeyEvent, aType); break; } } TBuf<255> msg; msg.AppendNum(intLineCounter); iEikonEnv->InfoMsg(msg); return EKeyWasNotConsumed; } Â Â It will be useful in validating if I should continue scrolling down the editor or just ignore any down key after the end of the lines. I hope somebody can help me this time. |
|






Forum posts: 34
iRtEd->MoveCursorL(TCursorPosition::EFLineDown, EFalse);
intMaxLines++;
}
This is perfectly handy when using a read only/display only rich text box and still want to have the usual functionality of your UP/DOWN arrows (similar to a browser app):
{
switch(aKeyEvent.iCode) {
case EKeyUpArrow:{
if (intLineCounter > 0) {
intLineCounter--;
iRtEd->MoveDisplayL(TCursorPosition::EFLineUp);
}
break;
}
case EKeyDownArrow:{
if (intLineCounter < intMaxLines ) {
intLineCounter++;
iRtEd->MoveDisplayL(TCursorPosition::EFLineDown);
} else {
iEikonEnv->InfoMsg(_L("Past end of line."));
}
break;
}
default: { // trip lang
return iRtEd->OfferKeyEventL(aKeyEvent, aType);
break;
}
}
TBuf<255> msg;
msg.AppendNum(intLineCounter);
msg.Append(_L("/"));
msg.AppendNum(intMaxLines);
iEikonEnv->InfoMsg(msg);
return EKeyWasNotConsumed;
}Â Â
Forum posts: 2006
Check our Playing with Edwin page for more.
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 29
Code:
TextLayout()->GetLineNumber(TextLength())
Check our Playing with Edwin page for more.
There is no such function in s60 or UIQ 2.x , i think it is only in Symbian os 9.1 SDK.
Forum posts: 2006
Code:
TextLayout()->GetLineNumber(TextLength())
Check our Playing with Edwin page for more.
There is no such function in s60 or UIQ 2.x , i think it is only in Symbian os 9.1 SDK.
Btw it'is in frmtlay.h...
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 1242
I did find it in S60, but not in UIQ 2.1, not in frmtlay.h nor in any other header file. The UIQ and the S60 versions of the header file frmtlay.h are identical over large parts, but just where the S60 header file shows GetLineNumber (just below ExtendFormattingToCoverPosL) there is nothing corresponding in the UIQ header file...
René Brunner
Forum posts: 672
I did find it in S60, but not in UIQ 2.1, not in frmtlay.h nor in any other header file. The UIQ and the S60 versions of the header file frmtlay.h are identical over large parts, but just where the S60 header file shows GetLineNumber (just below ExtendFormattingToCoverPosL) there is nothing corresponding in the UIQ header file...
I also thought a long time ago, that the generic UI components and classes (CEikXxx) are identical in UIQ and Series 60 (nowadays S60). But then I took a look at the S60 header files....