Page 3 of 3
Re: Class LV_Colors v2.0 - 2023-01-04
Posted: 13 Mar 2023, 06:50
by fenchai
just me wrote: ↑13 Mar 2023, 03:41
Currently you might need to call
BgCLV.UpdateProps() after you changed the LVs contents.
I added BgCLV.UpdateProps() before and after main.Show() but it still does not change any color. Am I out of luck?
Re: Class LV_Colors v2.0 - 2023-01-04
Posted: 13 Mar 2023, 17:06
by fenchai
I found a solution, I removed .ShowColors(), used updateProps() then apply the .row() coloring before showing the GUI. the steps position matters.
Re: Class LV_Colors v2.0 - 2023-01-04
Posted: 15 Mar 2023, 06:24
by just me
@fenchai,
you created the LV_Colors object with an empty ListView, so the internal RowCount property was set to 0. That's why BgCLV.Row(1, 0x00FF00, 0x000080) failed. With the current version of the class you need to call UpdateProps() after adding rows to the ListView before you can access newly added rows.
Re: Class LV_Colors v2.0 - 2023-01-04
Posted: 15 Mar 2023, 07:23
by fenchai
thanks for letting me know!
Re: Class LV_Colors v2.0 - 2023-01-04
Posted: 04 May 2023, 02:46
by iPhilip
just me wrote: ↑19 Aug 2021, 08:41
Code: Select all
Return (HTML.HasOwnProp(Color) ? HTML[Color] : Default)
I think the above line in the original post should be:
Code: Select all
Return (HTML.HasOwnProp(Color) ? HTML.%Color% : Default)
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 06 May 2023, 05:44
by just me
@iPhilip, of course, i fixed it, thanks.
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 10 Jul 2023, 12:24
by iPhilip
I used this class to study the
GetSysColor function. What I learned is that the
GetSysColor function returns values in BGR format, not RGB as specified in the
documentation page.
In contrast, registry entries under
Computer\HKEY_CURRENT_USER\Control Panel\Colors or
Computer\HKEY_CURRENT_USER\Control Panel\Desktop\Colors are in the form of R G B values between 0 and 255.
Here's the script:
Code: Select all
#Requires AutoHotkey v2.0.1
#Include Class_LV_Colors.ahk
DisplayElements := ['COLOR_SCROLLBAR'
, 'COLOR_DESKTOP'
, 'COLOR_ACTIVECAPTION'
, 'COLOR_INACTIVECAPTION'
, 'COLOR_MENU'
, 'COLOR_WINDOW'
, 'COLOR_WINDOWFRAME'
, 'COLOR_MENUTEXT'
, 'COLOR_WINDOWTEXT'
, 'COLOR_CAPTIONTEXT'
, 'COLOR_ACTIVEBORDER'
, 'COLOR_INACTIVEBORDER'
, 'COLOR_APPWORKSPACE'
, 'COLOR_HIGHLIGHT'
, 'COLOR_HIGHLIGHTTEXT'
, 'COLOR_3DFACE'
, 'COLOR_3DSHADOW'
, 'COLOR_GRAYTEXT'
, 'COLOR_BTNTEXT'
, 'COLOR_INACTIVECAPTIONTEXT'
, 'COLOR_3DHILIGHT'
, 'COLOR_3DDKSHADOW'
, 'COLOR_3DLIGHT'
, 'COLOR_INFOTEXT'
, 'COLOR_INFOBK'
, 'N/A'
, 'COLOR_HOTLIGHT'
, 'COLOR_GRADIENTACTIVECAPTION'
, 'COLOR_GRADIENTINACTIVECAPTION'
, 'COLOR_MENUHILIGHT'
, 'COLOR_MENUBAR']
MyGui := Gui('-DPIScale', 'GetSysColor Test')
MyGui.MarginX := MyGui.MarginY := 0
MyGui.SetFont('s11', 'Consolas')
LV := MyGui.Add('ListView', 'w525 R31 Grid', StrSplit('No.|R|G|B|BGR|Color|Display Element', '|'))
CLV := LV_Colors(LV)
for Element in DisplayElements {
BGR := DllCall('GetSysColor', 'Int', A_Index - 1, 'UInt')
R := BGR & 0xFF, G := (BGR & 0xFF00) >> 8, B := BGR >> 16
LV.Add( , A_Index - 1, R, G, B, Format('0x{:06X}', BGR), , Element)
CLV.UpdateProps()
CLV.Cell(A_Index, 6, (R << 16) | (G << 8) | B)
}
LV.ModifyCol(1, 'AutoHdr Integer Center')
LV.ModifyCol(2, 'Auto Integer Center')
LV.ModifyCol(3, 'Auto Integer Center')
LV.ModifyCol(4, 'Auto Integer Center')
LV.ModifyCol(5, 'Auto Center')
LV.Move( , , 600)
MyGui.Show()
Here is an image of the resulting Gui:
- GetSysColor Results.png (64.2 KiB) Viewed 2408 times
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 22 Aug 2023, 08:11
by Spitzi
Hi @just me. Always a pleasure to use your classes!! Thanks.
Just a note: when deleting all rows from a listview and then repopulating the rows using LV.Add, I had to call UpdateProps() before Row(), for colors to show in the listview. Is that an intended/explainable behaviour?
One more wish: could you publish your LV_Colors_V2 Class under a license on github?
And: do you have a "buy me a coffee" account?
Greets Spitzi
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 22 Aug 2023, 10:14
by just me
Spitzi wrote:
Just a note: when deleting all rows from a listview and then repopulating the rows using LV.Add, I had to call UpdateProps() before Row(), for colors to show in the listview. Is that an intended/explainable behaviour?
It depends on how you delete the rows from the listview. Do you call the
Clear() method? Does the number of newly added rows exceed the previous number of rows?
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 23 Aug 2023, 02:49
by Spitzi
Hi @just me. I currently use LV.Delete. The number of added rows is the same as the previously deleted.
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 23 Aug 2023, 03:15
by just me
I cannot reproduce it here. Please show the relevant code.
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 02 Oct 2023, 11:23
by theyakutoo
How do you change the header colors?
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 03 Oct 2023, 05:23
by just me
The header control is a separate control within the list-view area. It sends own
NM_CUSTOMDRAW notifications which can be intercepted to change the colors.
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 27 Nov 2023, 03:45
by denis_q2
It seems that 'NoSort' is ignored by LV.Opt().
AHK v2.0.10
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 27 Nov 2023, 04:32
by just me
'NoSort' is an AHK specific option and must be handled by the script. Seems to be a bug!
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 29 Jan 2024, 11:27
by Spitzi
Hello @just me.
I want to declare all my external libraries/classes in my script. I am also (very frequently) using your LV_Colors_V2 class, which is great, thank you again for that. Would it be possible for you to put the code for V2 on github, too, so I could link to it?? I don't want to link to a autohokey-forum-thread (feels a little to DIY, if you know what I mean)
Thanks for considering... Spitzi
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 29 Jan 2024, 11:56
by just me
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 29 Jan 2024, 15:32
by Spitzi
Hi
@just me Thank you! There is one ore piece of code of yours that I use, from
viewtopic.php?f=83&t=94046, LVICE_XXS. Would you be willing to put it in a repository on github as well?
And a side note: can your RichTextEdit control be used to display javascript code with syntax highlighting?
Thanks for your help and greets Spitzi
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 31 Jan 2024, 09:35
by just me
Spitzi wrote:
There is one ore piece of code of yours that I use, from viewtopic.php?f=83&t=94046, LVICE_XXS. Would you be willing to put it in a repository on github as well?
I will do it till weekend.
Spitzi wrote:
And a side note: can your RichTextEdit control be used to display javascript code with syntax highlighting?
It is theoretically feasible. But I don't know any existing solution. Most probably you'll have to do the whole stuff on your own
Re: Class LV_Colors v2.0 - 2023-05-06
Posted: 31 Jan 2024, 22:22
by kczx3
You could probably use
viewtopic.php?t=35119 at least as a starting point.