1. Colors for ListView Control

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.

new topic     » topic index » view message » categorize

2. Re: Colors for ListView Control

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: Colors for ListView Control

Rad said...

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: Colors for ListView Control

I am using win32lib.

Thanks & Regards, Rad.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Colors for ListView Control

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

new topic     » goto parent     » topic index » view message » categorize

6. Re: Colors for ListView Control

doncole2009 said...

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.

new topic     » goto parent     » topic index » view message » categorize

7. Re: Colors for ListView Control

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

new topic     » goto parent     » topic index » view message » categorize

8. Re: Colors for ListView Control

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.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Colors for ListView Control

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? blink

Thanks very much, Cheers, Mark

new topic     » goto parent     » topic index » view message » categorize

10. Re: Colors for ListView Control

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.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu