1. Colors for ListView Control
- Posted by Rad Jul 17, 2009
- 1086 views
Hi,
Is there any way one can change the background and/or text color of entire row in ListView control?
Or perhaps change text color for a cell depending on the value contained within?
Thanks & Regards, Rad.
2. Re: Colors for ListView Control
- Posted by ghaberek (admin) Jul 17, 2009
- 1097 views
This requires an owner-drawn control (LVS_OWNERDRAWFIXED). I'll see if I can whip up a demo. Maybe somebody else already has an example they can post...
-Greg
3. Re: Colors for ListView Control
- Posted by LarryMiller Jul 17, 2009
- 1073 views
Hi,
Is there any way one can change the background and/or text color of entire row in ListView control?
Or perhaps change text color for a cell depending on the value contained within?
Thanks & Regards, Rad.
The native ListView control does not directly support changing colors of individual items. However, this cas be done with custom draw. This involves handling notifications from the ListView control and setting appropriate values in a structure. Exactly how this would be done depends on your programming environment, Win32Lib, WxEuphoria, etc.
Larry Miller
4. Re: Colors for ListView Control
- Posted by Rad Jul 17, 2009
- 1017 views
I am using win32lib.
Thanks & Regards, Rad.
5. Re: Colors for ListView Control
- Posted by doncole2009 Jul 18, 2009
- 1014 views
I went through this before and came up with it couldn't be done.
I know this is of no help at all.
Don Cole
6. Re: Colors for ListView Control
- Posted by LarryMiller Jul 18, 2009
- 1022 views
I went through this before and came up with it couldn't be done.
I know this is of no help at all.
Don Cole
Different colors for individual items, and even different subitems, is certainly possible. This can be done with either ownerdraw or customdraw. Win32Lib does not directly support this but is flexible enough to make it possible by using the Windows API. Neither of these mehods are particularly difficult, if you are comfortable with using the API. Otherwise it will be difficult.
7. Re: Colors for ListView Control
- Posted by AndyDrummond Jul 18, 2009
- 1066 views
I wrote a list view control a while back, which is called FList.ew, and which is used in the IDE when a list of handlers is shown. It allows you to change foreground and background colours and attributes like Bold etc. It wasn't uploaded to the contribs but it is part of IDE. If you want to try it, send me an email (I don't often get here and specially not just at the moment) to andy hat kestreltele period com. You can get the FList.ew from the IDE but I also have some documentation for it. I haven't touched it for over a year so you'll have to have it as-is. But it works OK in IDE, so should be OK.
Andy
8. Re: Colors for ListView Control
- Posted by Rad Jul 21, 2009
- 1053 views
Hi Andy,
Got your FList.ew along with the document, and it works great.
It is a handy code for Combo/Drop-down List which I am planning to use in my application. Thanks for the same.
My current requirement was a bit different. Can this be done for a ListView (Multiple Rows/Columns), as I wanted the colour scheme for entire row and/or a specific column in that control.
Rad.
9. Re: Colors for ListView Control
- Posted by marky1124 Jul 28, 2009
- 1026 views
Hi Rad,
I'm looking to colour a single cell in a ListView depending on it's contents. Were you able to accomplish that with the information that Andy provided? Any chance of an example?
Thanks very much, Cheers, Mark
10. Re: Colors for ListView Control
- Posted by Rad Jul 28, 2009
- 1022 views
- Last edited Jul 29, 2009
Hi Mark,
No luck so far....
As I said in my previous post, Andy's FList.ew (also available with Judith Evans IDE) works nicely for Combo/Drop-down List. But I don't know how to make it work for a ListView. EuGrid.ew can handle column, row or cell coloration effectively though.
Maybe Andy can have a look at it whenever possible.
Thanks & Regards, Rad.