Solved

TEMO With Line numbering on the left

Posted on 2003-10-28
12
460 Views
Last Modified: 2010-04-05
I need to display the linenumbers to the left of a TMEMO or something like that ...

Did some body have a component like that ...
0
Comment
Question by:gags03
  • 6
  • 3
  • 3
12 Comments
 
LVL 6

Expert Comment

by:GloomyFriar
Comment Utility
Memo1.Lines.Add(IntToStr(Memo1.Lines.Count) + ': ' + str);
0
 

Author Comment

by:gags03
Comment Utility
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 ...

0
 
LVL 6

Expert Comment

by:GloomyFriar
Comment Utility
Then try to use TStringGrid
0
 
LVL 6

Expert Comment

by:GloomyFriar
Comment Utility
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;
0
 
LVL 6

Expert Comment

by:GloomyFriar
Comment Utility
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;
0
 

Author Comment

by:gags03
Comment Utility
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 ) ...
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 4

Expert Comment

by:nestorua
Comment Utility
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.
0
 

Author Comment

by:gags03
Comment Utility
IT's a good idea, but did you have a way to have the corresponding line when the user move the scrollbar ?
0
 
LVL 6

Expert Comment

by:GloomyFriar
Comment Utility
Put both the memos on TScrollBox
0
 
LVL 4

Expert Comment

by:nestorua
Comment Utility
Or use SBM_GETSCROLLINFO and SBM_SETSCROLLINFO messages.
0
 
LVL 6

Expert Comment

by:GloomyFriar
Comment Utility
>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.
0
 
LVL 4

Accepted Solution

by:
nestorua earned 250 total points
Comment Utility
Try www.tmssoftware.com address.
You can find there the Memo component you want.
But I think it's not freeware.
If I remember more I'll inform you.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now