We help IT Professionals succeed at work.

Is it possible to apply style, such as bold or color,  to a single line in TMemo1 control?

IT79637
IT79637 asked
on
For example, I have a memo1 field that has a list of files to process.  The files are processed sequentially from top to bottom.  I would like to indicate which file is currently processing by applying style to that file name (or line) while it processes.  When it is done, I would un-bold the line and bold the next file in the list which will process next.

Thanks.
Comment
Watch Question

That is not going to be possible with a TMemo.  You could do this with a TRichEdit though it’s going to involve a fair amount of code. Another approach would be to use a TListBox with the style set to OwnerDraw . Then you can control how text is displayed in the OnDrawItem event
Expert of the Quarter 2010
Expert of the Year 2010
Commented:
I'm with Steve.
If you have a list of files to process (you control the list), a TListBox with ownerdraw is the most appropriate.
If the list can be user entered, then it is a different thing, I can see how a TMemo makes sense.  But you could swap it for TRichEdit with minimal fuss and they can still cut and paste into it.

See the accepted solution for this Q for how to bold a specific line in a TRichEdit.

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_11453338.html
Commented:
Hi IT79637,

If You are looking for example of how to implement OwnerDraw procedure on TListBox, then I have one for You.
You could find it at: http://vitesoft.net/nowa/upload/ListBox%20OwnerDraw/
Commented:
TRichEdit its your solution!

Author

Commented:
Increased points to 500.