Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

removing last blank line in memo

Tags:

delphi

memo

i searched google but can't seem to find a working solution.

the situation is unique. i need to "add" lines with a comment at various times. whenever i press the F9 key, a line number will dispaly followed by a colon ":" char and then i enter some comments at the line number and cursor position.

the running output should look like this:

001: startup time
002: watched tv
003: |

where "|" is the last cursor position at runtime, waiting for me to enter some text.

but instead, when i run the program and press the F9 key, i get this:

001: 
002: 
003: 
|

where "|" is the last cursor position at runtime, waiting for me to enter some text.

how can remove that (last) blank line in a memo?

like image 300
johnm2 Avatar asked Jan 07 '13 02:01

johnm2


1 Answers

Add() inserts a line break after the inserted text. If you do not want the line break, then use the SelText property instead, eg;

Memo1.SelStart := Memo1.GetTextLen;
Memo1.SelLength := 0;
Memo1.SelText := '003: ';
like image 157
Remy Lebeau Avatar answered Oct 18 '22 21:10

Remy Lebeau