Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
Beginners
(Moderators:
FPK
,
Tomas Hajny
) »
Getting the first VISIBLE line-index of a Memo
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
System.Now gives timestam...
by
Kays
[
Today
at 08:14:04 pm]
open dialog - default dir...
by
Nicole
[
Today
at 08:02:40 pm]
Installing and using Vamp...
by
Odacir
[
Today
at 07:58:22 pm]
Multidimensional arrays a...
by
Kays
[
Today
at 07:36:57 pm]
Demo Scene Picture sinwav...
by
circular
[
Today
at 07:27:02 pm]
Demo Scene Bitmap Font Sc...
by
KodeZwerg
[
Today
at 07:21:14 pm]
what's difference between...
by
ASerge
[
Today
at 07:09:52 pm]
splitting an image
by
KodeZwerg
[
Today
at 07:07:21 pm]
Debugger error
by
bobonwhidbey
[
Today
at 07:03:07 pm]
How to: create DLL file f...
by
paule32
[
Today
at 07:02:31 pm]
Your best UI design - con...
by
circular
[
Today
at 06:48:12 pm]
Web Applications with Pas...
by
1HuntnMan
[
Today
at 06:44:00 pm]
Converting a string/index...
by
1HuntnMan
[
Today
at 06:35:19 pm]
Drawing grid lines on a t...
by
KodeZwerg
[
Today
at 05:42:19 pm]
Compile/Convert Delphi pr...
by
Martin_fr
[
Today
at 05:29:03 pm]
Lazarus features in a non...
by
Lutz Mändle
[
Today
at 05:26:34 pm]
Lazarus for Windows on aa...
by
msintle
[
Today
at 05:03:57 pm]
AI, NLP and CAI: Text Gen...
by
indydev
[
Today
at 04:51:00 pm]
Parameter passing odditie...
by
KodeZwerg
[
Today
at 03:41:49 pm]
Surf Units in Text Mode I...
by
mosquito
[
Today
at 01:58:21 pm]
Ho Ho Ho IntraWeb in Laza...
by
Thaddy
[
Today
at 01:55:52 pm]
Generics - correct syntax
by
Thaddy
[
Today
at 01:48:32 pm]
FpDebug questions
by
440bx
[
Today
at 01:22:53 pm]
leetcode doesn’t support ...
by
codeninja
[
Today
at 01:16:43 pm]
Can function be used for ...
by
Joanna
[
Today
at 12:48:19 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Getting the first VISIBLE line-index of a Memo (Read 4401 times)
justnewbie
Sr. Member
Posts: 292
Getting the first VISIBLE line-index of a Memo
«
on:
April 11, 2018, 06:47:55 pm »
Hi,
Is it possible to get the index of the topmost VISIBLE line of a TMemo component?
If yes, how?
Logged
howardpc
Hero Member
Posts: 4144
Re: Getting the first VISIBLE line-index of a Memo
«
Reply #1 on:
April 11, 2018, 07:14:57 pm »
For a Windows solution see
https://forum.lazarus.freepascal.org/index.php?topic=29667.msg187529#msg187529
Logged
justnewbie
Sr. Member
Posts: 292
Re: Getting the first VISIBLE line-index of a Memo
«
Reply #2 on:
April 11, 2018, 07:40:42 pm »
Thank you! Linux version would be also great.
Logged
justnewbie
Sr. Member
Posts: 292
Re: Getting the first VISIBLE line-index of a Memo
«
Reply #3 on:
April 17, 2018, 01:30:09 pm »
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.
«
Last Edit: April 17, 2018, 01:31:52 pm by justnewbie
»
Logged
Handoko
Hero Member
Posts: 5158
My goal: build my own game engine using Lazarus
Re: Getting the first VISIBLE line-index of a Memo
«
Reply #4 on:
April 17, 2018, 02:13:42 pm »
Quote from: justnewbie on April 17, 2018, 01:30:09 pm
How can I go through a Memo's text character by character?
This works for me:
Code: Pascal
[Select]
[+]
[-]
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
.
Logged
justnewbie
Sr. Member
Posts: 292
Re: Getting the first VISIBLE line-index of a Memo
«
Reply #5 on:
April 17, 2018, 02:54:58 pm »
@Handoko
: thank you!
Logged
jamie
Hero Member
Posts: 6131
Re: Getting the first VISIBLE line-index of a Memo
«
Reply #6 on:
April 18, 2018, 01:43:05 am »
I would of thought the Windows solution would work since using Messages is a norm for talking to
common controls?
Since these widgets support the common controls don't they also support the messages that go with them?
Logged
The only true wisdom is knowing you know nothing
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
Beginners
(Moderators:
FPK
,
Tomas Hajny
) »
Getting the first VISIBLE line-index of a Memo
TinyPortal
© 2005-2018