Forum > Beginners
Getting the first VISIBLE line-index of a Memo
justnewbie:
Hi,
Is it possible to get the index of the topmost VISIBLE line of a TMemo component?
If yes, how?
howardpc:
For a Windows solution see
https://forum.lazarus.freepascal.org/index.php?topic=29667.msg187529#msg187529
justnewbie:
Thank you! Linux version would be also great. :)
justnewbie:
How can I go through a Memo's text character by character?
In other words: I want to get every single string-character from 0 position to the end of the text.
Handoko:
--- Quote from: justnewbie on April 17, 2018, 01:30:09 pm ---How can I go through a Memo's text character by character?
--- End quote ---
This works for me:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Forms, Controls, StdCtrls; type { TForm1 } TForm1 = class(TForm) Edit1: TEdit; Label1: TLabel; Label2: TLabel; Memo1: TMemo; procedure Edit1Change(Sender: TObject); end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Edit1Change(Sender: TObject);var Index: Integer;begin TryStrToInt(Edit1.Text, Index); Label2.Caption := ''; if (Index <= 0) or (Index > Memo1.Lines.Text.Length) then Exit; Label2.Caption := 'Char #' + Index.ToString + ' is ' + Memo1.Text[Index];end; end.
Navigation
[0] Message Index
[#] Next page