First and Last Line

  • Hello,

    which is the easiest way to know if the cursor is in the first or the last line of the whole text? Just somewhere in it.

    Background is, that I want to jump to the next control in the tab order if you press arrow up / down in the first / last line.

    Regards,
    Björn

    • Offizieller Beitrag

    This should help:

    Zitat

    if (WPRichText1.ActivePar.prev=nil) and (WPRichText1.CPLineNr=0) then
    ShowMessage('First Line');
    if (WPRichText1.ActivePar.next=nil) and
    (WPRichText1.ActivePar.LineOffset(WPRichText1.ActivePar.LineCount-1)<=WPRichText1.ActivePosInPar) then
    ShowMessage('Last Line');