gags03
asked on
TEMO With Line numbering on the left
I need to display the linenumbers to the left of a TMEMO or something like that ...
Did some body have a component like that ...
Did some body have a component like that ...
Memo1.Lines.Add(IntToStr(M emo1.Lines .Count) + ': ' + str);
ASKER
oups it's not exactly want I want ...
I don't want to add the number in the text ...
I want to do a small editor with the line numbering in the left, I don't want to modfify the text ...
Cause I used Memo1.lines.loadfromfile ... or savetofile ... Then if I do like you said, I will save the line numbering ...
I don't want to add the number in the text ...
I want to do a small editor with the line numbering in the left, I don't want to modfify the text ...
Cause I used Memo1.lines.loadfromfile ... or savetofile ... Then if I do like you said, I will save the line numbering ...
Then try to use TStringGrid
procedure SaveToFile
var i: integer;
begin
for i:=0 to pred(Memo1.Lines.Count) do begin
Delete(Memo1.Lines[i], 1, Pos(':', Memo1.Lines[i]) + 1);
end;
Memo1.lines.savetofile ;
end;
var i: integer;
begin
for i:=0 to pred(Memo1.Lines.Count) do begin
Delete(Memo1.Lines[i], 1, Pos(':', Memo1.Lines[i]) + 1);
end;
Memo1.lines.savetofile ;
end;
procedure LoadFromFile;
var i: integer;
begin
Memo1.lines.loadfromfile;
for i:=0 to pred(Memo1.Lines.Count) do begin
Memo1.Lines[i] := IntToStr(i) + ': ' + Memo1.Lines[i];
end;
end;
var i: integer;
begin
Memo1.lines.loadfromfile;
for i:=0 to pred(Memo1.Lines.Count) do begin
Memo1.Lines[i] := IntToStr(i) + ': ' + Memo1.Lines[i];
end;
end;
ASKER
GloomFriar : You are funny ...
For 250 points I expected an answer better than a for lop with modified text ...
Your grid answer was not to bad, but I'm probably not the only one who need to show a line number in a memo component ...
I search more a component or an easy way to show the line number ( none modifiable by the user ) ...
For 250 points I expected an answer better than a for lop with modified text ...
Your grid answer was not to bad, but I'm probably not the only one who need to show a line number in a memo component ...
I search more a component or an easy way to show the line number ( none modifiable by the user ) ...
HI,
If you want to place numbers in Memo area or simply right to the left but outside its area. If the second then you could place another memo to the left from the main memo and write there numbers exactly the same font you use in your main memo and exactly as many as number of lines in your main memo.
Sincerely,
Serhiy.
If you want to place numbers in Memo area or simply right to the left but outside its area. If the second then you could place another memo to the left from the main memo and write there numbers exactly the same font you use in your main memo and exactly as many as number of lines in your main memo.
Sincerely,
Serhiy.
ASKER
IT's a good idea, but did you have a way to have the corresponding line when the user move the scrollbar ?
Put both the memos on TScrollBox
Or use SBM_GETSCROLLINFO and SBM_SETSCROLLINFO messages.
>GloomFriar : You are funny ...
>I'm probably not the only one who need to show a line number in a memo component
I've never seen the editor made in a similar way.
Usually in the status the bar is injected number of current line.
You've asked how "to show a line number in a memo component" and I has shown you a way to do that.
>I'm probably not the only one who need to show a line number in a memo component
I've never seen the editor made in a similar way.
Usually in the status the bar is injected number of current line.
You've asked how "to show a line number in a memo component" and I has shown you a way to do that.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.