Page 8 of 8

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

Posted: 25 Apr 2021, 10:57
by JoeWinograd
Hi just me,

As you know, I've been using your LV_Colors class with great success for many years in an output-only LV that I call the "Processing Console"...thanks again for this terrific class!

I'm now trying to use it in an LV on the input side, where the user selects a color (or multiple colors) from a list with a large number of choices (will probably wind up in the 20-30 range). When clicking the checkbox, it looks fine. The issue I'm having is that when clicking the row, the text color changes to white and the background color changes to a shade of blue (0x0078D7). This happens regardless of the text color and background color that had been set (it also happens if the LV does not have a checkbox). Here's a simple example with three rows (yellow on red, black on green, pink on blue):

Code: Select all

#SingleInstance Force
Gui,Font,s12,Arial
Gui,Add,ListView,Checked xm r5 hwndSelectColorHandle,ColorLV
SelectColor:=New LV_Colors(SelectColorHandle,True,True,True)

ColorBack:="0xFF0000" ; Red
ColorText:="0xFFFF00" ; Yellow
RowNum:=LV_Add("","Red")
SelectColor.Row(RowNum,ColorBack,ColorText)

ColorBack:="0x00FF00" ; Green
ColorText:="0x000000" ; Black
RowNum:=LV_Add("","Green")
SelectColor.Row(RowNum,ColorBack,ColorText)

ColorBack:="0x0000FF" ; Blue
ColorText:="0xFFC0CB" ; Pink
RowNum:=LV_Add("","Blue")
SelectColor.Row(RowNum,ColorBack,ColorText)

Gui,Show
Return

GuiClose:
GuiEsc:
ExitApp

#Include Class_LV_Colors.ahk
Clicking on any row (not the checkbox) turns the colors into white on 0x0078D7. Then clicking on another row or at the empty space under the rows brings back the correct colors. Screenshots:

before clicking row.png
before clicking row.png (5.88 KiB) Viewed 2086 times
after clicking red.png
after clicking red.png (6 KiB) Viewed 2086 times

I've tried with StaticMode both True and False...same behavior. Is there any way to keep this from happening? Thanks much, Joe

Edit: Possible work-around that I'm considering: Use AltSubmit when adding the LV and at the g-label look for A_GuiEvent="Normal" then do something like this:

Code: Select all

RowNum:=A_EventInfo
If (RowNum=0)
  Return
LV_GetText(RowColor,RowNum)
NextChecked:=LV_GetNext(RowNum-1,"Checked")
If (RowNum=NextChecked)
  CheckStatus:="Check"
Else
  CheckStatus:="-Check"
LV_Delete(RowNum)
RowNum:=LV_Insert(RowNum,,RowColor)
LV_Modify(RowNum,CheckStatus)
That seems to solve the color problem. Regards, Joe

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

Posted: 26 Apr 2021, 05:13
by just me
Should be enough to remove the Select (and Focus) state.

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

Posted: 27 Apr 2021, 01:24
by JoeWinograd
just me wrote:
26 Apr 2021, 05:13
Should be enough to remove the Select (and Focus) state.
Works a charm! Thanks very much! Regards, Joe

Edit#1: Subsequent testing shows that it is enough to remove only Select. Thanks again!

Edit#2: Yet more testing shows that both need to be removed.

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

Posted: 01 Jun 2022, 07:52
by Chappier
just me, is possible to change the background color of the entire ListView?
I mean, when there are no rows yet, the background is fully white, possible to change it to another color?

Also, when i add the class to the listview, i cant resize it anymore, by resize i mean this:
image.png
image.png (1.22 KiB) Viewed 1836 times
Is this a 'bug' or a desired behavior?

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

Posted: 03 Jun 2022, 16:52
by list
@Chappier
1. You can just use the standard c and Background col options of a listview - https://www.autohotkey.com/docs/commands/ListView.htm#Options
2. By default the NoSizing is set to True, so change it to False (same goes for NoSort) - https://github.com/AHK-just-me/Class_LV_Colors/blob/master/Sources/Class_LV_Colors.ahk#L53

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

Posted: 24 Feb 2023, 13:59
by MetalHotkey5000
Hello,

Has anyone been able to set colors for both even and odd rows/columns? I can't figure out what is making the class only do even rows/columns.

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

Posted: 25 Feb 2023, 11:22
by list
Use AlternateRows(), you can omit the text colour if you wish.

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

Posted: 19 Mar 2023, 01:57
by BenRen
Is it possible to use LV_Colors with Autohotkey 2.0.2?

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

Posted: 05 Jun 2023, 11:46
by Rahl
Nice script; However, for some reson it does freeze my own script at some loop points!
No matter what I do, I can not finger the bug..

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

Posted: 05 Jun 2023, 12:35
by JoeWinograd
Rahl wrote:for some reason it does freeze my own script
Well, it could be a problem with LV_Colors, but it could be a problem with your script. For us to really help you, you'll have to post your script, or, if it's a large script, reproduce the problem in a small/test script and post that.

In the meantime, here's an idea for you. I wrote a script a few years back where my script with LV_Colors was freezing. just me helped me fix it with these suggestions:

(1) I was doing a GuiControl,+Redraw,%ConsoleHandle%. He said to remove it.

(2) I was doing LV_Modify(RowNumber,"Vis") BEFORE ColorConsole.Row(RowNumber,ColorBackground,ColorText). He said to reverse the order.

After making those two changes, my script no longer froze. Of course, your issue could be completely different. Regards, Joe

Re: [Class] LV_Colors - 1.1.05.00 (2024-03-16)

Posted: 16 Mar 2024, 05:58
by just me
With his last update for AHK 1.1 @lexikos ported a change from v2 which prevents scripts like Class_LV_Colors.ahk from freezing. Many thanks for this change.
Now this is my last update to Class_LV_Colors.ahk. Version 1.1.05.00 is available on GitHub.

Re: [Class] LV_Colors - 1.1.05.00 (2024-03-16)

Posted: 16 Mar 2024, 13:51
by KruschenZ
I m so happy, that he merged my pull request.
https://github.com/AutoHotkey/AutoHotkey/commit/dd9911bb5fe2b8189f9240265c00842df43858b3
Because, I used my branch a long time for that bug.