I added BgCLV.UpdateProps() before and after main.Show() but it still does not change any color. Am I out of luck?
Class LV_Colors v2.0 - 2023-05-06
Re: Class LV_Colors v2.0 - 2023-01-04
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
@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.
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
thanks for letting me know!
Re: Class LV_Colors v2.0 - 2023-01-04
I think the above line in the original post should be:just me wrote: ↑19 Aug 2021, 08:41Code: Select all
Return (HTML.HasOwnProp(Color) ? HTML[Color] : Default)
Code: Select all
Return (HTML.HasOwnProp(Color) ? HTML.%Color% : Default)
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
Re: Class LV_Colors v2.0 - 2023-05-06
@iPhilip, of course, i fixed it, thanks.
Re: Class LV_Colors v2.0 - 2023-05-06
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:
Here is an image of the resulting Gui:
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:
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
Re: Class LV_Colors v2.0 - 2023-05-06
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
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
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?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?
Re: Class LV_Colors v2.0 - 2023-05-06
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
I cannot reproduce it here. Please show the relevant code.
-
- Posts: 14
- Joined: 09 Sep 2023, 11:15
Re: Class LV_Colors v2.0 - 2023-05-06
How do you change the header colors?
Re: Class LV_Colors v2.0 - 2023-05-06
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
It seems that 'NoSort' is ignored by LV.Opt().
AHK v2.0.10
AHK v2.0.10
Re: Class LV_Colors v2.0 - 2023-05-06
'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
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
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
Hi @Spitzi, AHK2_LV_Colors.
Re: Class LV_Colors v2.0 - 2023-05-06
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
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
I will do it till weekend.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?
It is theoretically feasible. But I don't know any existing solution. Most probably you'll have to do the whole stuff on your ownSpitzi wrote: And a side note: can your RichTextEdit control be used to display javascript code with syntax highlighting?
Re: Class LV_Colors v2.0 - 2023-05-06
You could probably use viewtopic.php?t=35119 at least as a starting point.
Return to “Scripts and Functions (v2)”
Who is online
Users browsing this forum: No registered users and 54 guests