?
Solved

Changing the text colour of a single row in a TListView

Posted on 2004-08-30
4
Medium Priority
?
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

649 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