Solved

Changing the text colour of a single row in a TListView

Posted on 2004-08-30
4
263 Views
Last Modified: 2013-11-17
I am writing a serial comms chat program and I need to have the outgoing messages a different colour to the incoming messages.  I am using a TListView in Borland C++ Builder 6 to display the messages.  Whenever I have a new message come in with the different colour it changes all of the rows in the TListView to that colour, I just want to change that one row.  Do you know how I can change the text colour of each row seperately without modifying the text colour of the whole ListView?.. I am getting very close to the end of this project and didn't realise that the TListView had this restriction until now, any help would be greatly appreciated.....
0
Comment
Question by:sabrE7
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:George Tokas
ID: 11929592
I suppose that you change the color property when you are getting a message from a TSocket and you are about to display it to the TListView component.
Question:
Is the TListView component needed or you can use another component to do the job?
If it is not needed then you can use a TMemo instead and there (as I know of) the functonality you want will work without any code changes.

gtokas.
0
 
LVL 1

Author Comment

by:sabrE7
ID: 11929768
I change the colour property when I receive/transmit a message to/from a mySQL database.  The TListView is definately required as there is a few column's required for each message, these columns hold the Time RX/TX and whether the message has been acknowledged.  The TListView is now firmly entrenched in the code in for both the Main Message Log and for viewing database queries.  I have all of the TListView functionality accessible from a seperate class, so it will be simple to modify.  I require each of the messages to be distinctly seperated, the TListView allows this in 'vsReport' mode with the grid pattern.  
0
 
LVL 16

Accepted Solution

by:
George Tokas earned 500 total points
ID: 11929854
I understand all those and I can see how you have worked with your project.
The fact is that you can not change the font or color of a TListItem inside the TListView.
So you have to think how you will display the message with the properties you want (color or something else). I suggest to use a TMemo to display the message with all those you want. The Lines property of TMemo is an AnsiString and so you can modify the appearance.
Also you can add the information you want (time, ack, etc.) in front or trailing on the AnsiString to be displayed.

gtokas.
0
 
LVL 1

Author Comment

by:sabrE7
ID: 11931032
Well that certainly darkens my day....I have played around with the TMemo component and it would work though I would have to rewrite a considerable amount of code.  I have found a component that is designed for Delphi 7 which would do what I want, though would I be able to use this component in BCB 6, because as I understand it, most of the BCB6 components are originally written in Pascal.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

746 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

10 Experts available now in Live!

Get 1:1 Help Now