* * *

Author Topic: What is the proper way to scroll to the bottom of KMemo?  (Read 213 times)

RedOctober

  • Full Member
  • ***
  • Posts: 106
What is the proper way to scroll to the bottom of KMemo?
« on: February 14, 2018, 01:06:03 am »
Platform: Windows Server Essentials 2016, Lazarus 1.8.1 "Fix", FPC 3.0.5, KControls 1.7.1

//  This doesnt' work:
     kemLog.ScrollBy(0, 14);

// SendMessage is not native to FPC (as far as I know, so this is not good)
            txt_blk := kemLog.Blocks.AddTextBlock(lyn);
            kemLog.Blocks.AddParagraph;
            kemLog.SelStart := Length(kemLog.Text);
            SendMessage(kemLog.Handle, EM_SCROLLCARET, 0, 0);

KMemo is not like TRichEdit or TMemo, so all the example on the Internet are not applicable.

dbannon

  • Full Member
  • ***
  • Posts: 163
Re: What is the proper way to scroll to the bottom of KMemo?
« Reply #1 on: February 14, 2018, 04:44:22 am »
Without trying it myself, I'd suggest you start by looking at things like -
Code: Pascal  [Select]
  1. KMemo1.ExecuteCommand(ecEditorBottom);

There are a large number of commands like ecEditorBottom (which moves caret to bottom of doc).  What you need will depend on if you want to move the caret or just move the viewport. Anyway, in Lazarus, hover your mouse over the ecEditorBottom and follow the link to KEditCommon and choose your combination !

When you get it working nicely, consider documenting it on http://wiki.freepascal.org/KControls/KmemoNotes - KMemo is a great component but deserves better documentation !

Davo

Lazarus 1.8, Linux (and reluctantly Win10, OSX)

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus