Solved

Changing the text colour of a single row in a TListView

Posted on 2004-08-30
4
267 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
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…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

829 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