Pergunta

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?

Foi útil?

Solução

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: ';
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top