[Class] LV_Colors - 1.1.04.01 (2016-05-03)

Post your working scripts, libraries and tools
just me
Posts: 4685
Joined: 02 Oct 2013, 08:51
Location: Germany

[Class] LV_Colors - 1.1.04.01 (2016-05-03)

20 Dec 2013, 07:09

Primarily released on old forum: /board/topic/88699-class-lv-colors-coloured-rowscells-in-gui-listviews/.

Change History

This is just another attempt to support individual background and/or text colours for a GUI ListView's cells or rows.

Class_LVColors.ahk (v1.1.04.01):

Code: [Select all] [Expand] [Download] (Class_LVColors.ahk)GeSHi © Codebox Plus


How to use:
  • First create a new instance of LV_Colors with MyInstance := New LV_Colors(HLV) passing the HWND of your ListView.
  • Then call MyInstance.Cell() or MyInstance.Row() to setup colours for individual cells and/or rows.
  • That's all you have to do for colouring.
  • If you finally don't want the colours to be shown any more, use MyInstance := "" to restore the ListView's default behaviour.
  • For more detailed informations look at the inline documentation, please.

Credits::


View sources on GitHub:
:arrow: https://github.com/AHK-just-me/Class_LV_Colors/
 
Download sources from GitHub:
:arrow: https://github.com/AHK-just-me/Class_LV_Colors/archive/master.zip

Previous releases on GitHub:
:arrow: https://github.com/AHK-just-me/Class_LV_Colors/releases
Last edited by just me on 03 May 2016, 09:57, edited 12 times in total.
Remaining with AHK 1.1.25.02 until v2 will become beta.
User avatar
joedf
Posts: 5819
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: [Class] LV_Colors - individual colors for ListView items

21 Feb 2014, 00:18

great! :D
tmplinshi
Posts: 1087
Joined: 01 Oct 2013, 14:57

Re: [Class] LV_Colors - individual colors for ListView items

21 Feb 2014, 07:11

The "static mode" is really useful, thanks a lot!
tmplinshi
Posts: 1087
Joined: 01 Oct 2013, 14:57

Re: [Class] LV_Colors - individual colors for ListView items

13 Aug 2014, 03:26

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus


Is this a bug? row 1 and row 2 changes to same color (0x80FF00).
just me
Posts: 4685
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [Class] LV_Colors - individual colors for ListView items

13 Aug 2014, 07:32

I won't consider this to be a bug. As the name implies, static mode is intended to be used with static ListViews. ;)

But I've already considered to change the internal handling of the 'static mode'. Since you're apparently using this mode, would you please test this version?

Edit: Removed test code, it's available on GitHub now.
Last edited by just me on 13 Aug 2014, 10:58, edited 1 time in total.
Remaining with AHK 1.1.25.02 until v2 will become beta.
tmplinshi
Posts: 1087
Joined: 01 Oct 2013, 14:57

Re: [Class] LV_Colors - individual colors for ListView items

13 Aug 2014, 10:20

Thank you! This is the way I wanted. Tested and worked!
just me
Posts: 4685
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [Class] LV_Colors - individual colors for ListView items

13 Aug 2014, 10:59

Thank you for testing. I've updated the script on GitHub.
Remaining with AHK 1.1.25.02 until v2 will become beta.
User avatar
oldbrother
Posts: 134
Joined: 23 Oct 2013, 05:08

Re: [Class] LV_Colors - individual colors for ListView items

15 Aug 2014, 17:45

Hi Just me,

I have an old script using both your classes Class_LV_Colors and Class_LV_InCellEdit. About 2 years ago, your wrote the Message Handler function MyMessageHandler() for me (please see the code below. Many thanks :) ). It worked perfectly. Recently, I updated Class_LV_InCellEdit to the latest version, everything was fine. Yesterday, I was trying to update Class_LV_Colors to the new version, but it failed. After I replaced the old Class_LV_Colors.php with the new one, the script cannot work properly. The Listview even my computer is frozen everytime when I run the script.

I'm wondering if you can help me again?

Thanks a lot!!!

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

just me
Posts: 4685
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [Class] LV_Colors - individual colors for ListView items

16 Aug 2014, 00:20

Hi oldbrother,

ATM I've no idea. Did you update LV_Colors from v0.4 to v0.5? Hopefully, the only changes in v0.5 are related to the 'static mode'. Do you use it?

In most of my tests with ListViews and WM_NOTIFY message handlers I get into troubles with frozen ListViews or whole GUIs. Since I use Critical, 500 in the message handlers like you do, it's more rare, but it still happens. I couldn't recognise any consistent reason as yet. All I know is that the script is consuming a whole processor here. It seems to loop very fast in the background. But my computer is still working in either case, though a bit delayed.
Remaining with AHK 1.1.25.02 until v2 will become beta.
User avatar
oldbrother
Posts: 134
Joined: 23 Oct 2013, 05:08

Re: [Class] LV_Colors - individual colors for ListView items

16 Aug 2014, 07:41

Hi Just Me,

Both V0.4 and V0.5 are not working for me. I'm still using V3.0. Luckily I kept all the versions :) .
just me
Posts: 4685
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [Class] LV_Colors - individual colors for ListView items

17 Aug 2014, 01:32

Hi oldbrother,

I've checked the changes from 0.3 to 0.4 again und found nothing not related to the new 'static mode'. It was realised by implementing a new additional second parameter for LV_Colors.Attach().

I've never used the combination of LV_InCellEdit and LV_Colors, so I have to ask you:

Which OS version are you running?
Did you adjust the LV_Colors.Attach() call?
Remaining with AHK 1.1.25.02 until v2 will become beta.
User avatar
oldbrother
Posts: 134
Joined: 23 Oct 2013, 05:08

Re: [Class] LV_Colors - individual colors for ListView items

17 Aug 2014, 08:02

I just adjusted LV_Colors.Attach() to LV_Colors.Attach(MyLV,1,0,0). The script works now. I didn't read your update notice carefully. How stupid I am!

The only thing now is I feel the program is a little bit sluggish. My OS is XP SP3, and my laptop is 4 year old. Probably I need a new computer.

Thanks a lot!!!
list
Posts: 80
Joined: 26 Mar 2014, 14:03
Contact:

Re: [Class] LV_Colors - individual colors for ListView items

16 Mar 2015, 15:34

Edit: fixed it I think with the GuiControl, +Redraw...

Hi just me,

I'm thinking about adding color to my listview and in principle it works, but when I scroll through my listview the color is gone - perhaps I'm doing something wrong? I use a trick to scroll using up & down arrow keys while remaining in an edit control - I've prepared a short example to illustrate the problem. I've tested this on Windows 7 (32bit, unicode) and Windows 8 (64bit). Is there a solution?

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

list
Posts: 80
Joined: 26 Mar 2014, 14:03
Contact:

Re: [Class] LV_Colors - individual colors for ListView items

17 Mar 2015, 12:32

The GuiControl, +Redraw does seem to have done the trick, tested on both systems again and the colours remain.
just me
Posts: 4685
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [Class] LV_Colors - new version on 2015-03-24

24 Mar 2015, 07:15

*new version*
Remaining with AHK 1.1.25.02 until v2 will become beta.
User avatar
empardopo
Posts: 335
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: [Class] LV_Colors - new version on 2015-03-24

25 Mar 2015, 03:42

just me wrote:*new version*


Is it necesary update to the last version of AKH. Now, I am using the 1.1.19.03 version and I get this error

Greetings.
Attachments
error.png
Everything is possible!
list
Posts: 80
Joined: 26 Mar 2014, 14:03
Contact:

Re: [Class] LV_Colors - new version on 2015-03-24

25 Mar 2015, 15:39

@empardopo - Yes. In the first post it says about the latest update "New version using the new features of AHK 1.1.12+:" but I think that is a typo, as in the source code of Class_LV_Colors.ahk it says "new version using new AHK 1.1.20+ features"

Using 1.1.20.03 I can confirm it works, but you have to modify your code as indicated in the readme here https://github.com/AHK-just-me/Class_LV_Colors and study the new example script as well.
just me
Posts: 4685
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [Class] LV_Colors - new version on 2015-03-24

25 Mar 2015, 16:00

list is right, it was a typo and should be 1.1.20+.
Remaining with AHK 1.1.25.02 until v2 will become beta.
User avatar
TLM
Posts: 1141
Joined: 01 Oct 2013, 07:52

Re: [Class] LV_Colors - new version on 2015-03-24

25 Mar 2015, 16:10

Thanks for this :D
Image
just me
Posts: 4685
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [Class] LV_Colors - update on 2015-03-27

27 Mar 2015, 04:25

*update*
Remaining with AHK 1.1.25.02 until v2 will become beta.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 13 guests