<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: LV_InsertCol - переход к заполнению новой колонки в ListView]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=11831</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11831&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: LV_InsertCol - переход к заполнению новой колонки в ListView».]]></description>
		<lastBuildDate>Sun, 24 Jul 2016 11:45:38 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: LV_InsertCol - переход к заполнению новой колонки в ListView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106322#p106322</link>
			<description><![CDATA[<p>От души! Прям &quot;E=MC2&quot;. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Sun, 24 Jul 2016 11:45:38 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106322#p106322</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: LV_InsertCol - переход к заполнению новой колонки в ListView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106316#p106316</link>
			<description><![CDATA[<div class="codebox"><pre><code>
	; https://autohotkey.com/boards/viewtopic.php?t=1081
	; https://raw.githubusercontent.com/AHK-just-me/Class_LV_Colors/master/Sources/Class_LV_Colors.ahk
	; https://github.com/AHK-just-me/Class_LV_Colors/blob/master/Sources/Class_LV_Colors.ahk
	
	
#SingleInstance Force
#NoEnv 
SetBatchLines, -1

fileCount := 10
 
Gui, Add, ListView, r15 w600 hwndHLV Grid

Loop % fileCount + (i := 0)
{
	LV_InsertCol(++i, &quot;&quot;, &quot;Имя&quot;)
	LV_InsertCol(++i, &quot;&quot;, &quot;Значение&quot;) 
	Random, R, 5, 15 
	Loop % R ; кол-во строк файла
	{ 
		Random, R, 10000, 20000
		LV_ModifyCell(A_Index, i - 1, (i+1)//2 &quot;-&quot; A_Index)
		LV_ModifyCell(A_Index, i, R)
	}
} 
Loop % LV_GetCount(&quot;Col&quot;)
	LV_ModifyCol(A_Index, &quot;AutoHdr&quot;)
Gui, Show, , Log result  

	; то что меньше 15000 в колонках &quot;Значение&quot;, станет красным.

Num := 15000
CLV := New LV_Colors(HLV)
GuiControl, -Redraw, %HLV%
Loop % LV_GetCount(&quot;Col&quot;)
{
	LV_GetText(ColText, 0, Col := A_Index)
	If ColText = Значение
		Loop % LV_GetCount()
		{
			LV_GetText(CellText, A_Index, Col)
			If (CellText + 0 != &quot;&quot; &amp;&amp; CellText &lt; Num)
				CLV.Cell(A_Index, Col, 0xEA5E2C, 0xFFFFFF) 
		}
}
GuiControl, +Redraw, %HLV%
Return

LV_ModifyCell(Row, Col, Text) {
	If (Row &gt; LV_GetCount())
		LV_Insert(Row, &quot;Col&quot; Col, Text)
	Else
		LV_Modify(Row, &quot;Col&quot; Col, Text)
}  
 
; ======================================================================================================================
; Namespace:      LV_Colors
; Function:       Individual row and cell coloring for AHK ListView controls.
; Tested with:    AHK 1.1.23.05 (A32/U32/U64)
; Tested on:      Win 10 (x64)
; Changelog:
;     1.1.04.01/2016-05-03/just me - added change to remove the focus rectangle from focused rows
;     1.1.04.00/2016-05-03/just me - added SelectionColors method
;     1.1.03.00/2015-04-11/just me - bugfix for StaticMode
;     1.1.02.00/2015-04-07/just me - bugfixes for StaticMode, NoSort, and NoSizing
;     1.1.01.00/2015-03-31/just me - removed option OnMessage from __New(), restructured code
;     1.1.00.00/2015-03-27/just me - added AlternateRows and AlternateCols, revised code.
;     1.0.00.00/2015-03-23/just me - new version using new AHK 1.1.20+ features
;     0.5.00.00/2014-08-13/just me - changed &#039;static mode&#039; handling
;     0.4.01.00/2013-12-30/just me - minor bug fix
;     0.4.00.00/2013-12-30/just me - added static mode
;     0.3.00.00/2013-06-15/just me - added &quot;Critical, 100&quot; to avoid drawing issues
;     0.2.00.00/2013-01-12/just me - bugfixes and minor changes
;     0.1.00.00/2012-10-27/just me - initial release
; ======================================================================================================================
; CLASS LV_Colors
;
; The class provides six public methods to set individual colors for rows and/or cells, to clear all colors, to
; prevent/allow sorting and rezising of columns dynamically, and to deactivate/activate the message handler for
; WM_NOTIFY messages (see below).
;
; The message handler for WM_NOTIFY messages will be activated for the specified ListView whenever a new instance is
; created. If you want to temporarily disable coloring call MyInstance.OnMessage(False). This must be done also before
; you try to destroy the instance. To enable it again, call MyInstance.OnMessage().
;
; To avoid the loss of Gui events and messages the message handler might need to be set &#039;critical&#039;. This can be
; achieved by setting the instance property &#039;Critical&#039; ti the required value (e.g. MyInstance.Critical := 100).
; New instances default to &#039;Critical, Off&#039;. Though sometimes needed, ListViews or the whole Gui may become
; unresponsive under certain circumstances if Critical is set and the ListView has a g-label.
; ======================================================================================================================
Class LV_Colors {
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; META FUNCTIONS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; ===================================================================================================================
   ; __New()         Create a new LV_Colors instance for the given ListView
   ; Parameters:     HWND        -  ListView&#039;s HWND.
   ;                 Optional ------------------------------------------------------------------------------------------
   ;                 StaticMode  -  Static color assignment, i.e. the colors will be assigned permanently to the row
   ;                                contents rather than to the row number.
   ;                                Values:  True/False
   ;                                Default: False
   ;                 NoSort      -  Prevent sorting by click on a header item.
   ;                                Values:  True/False
   ;                                Default: True
   ;                 NoSizing    -  Prevent resizing of columns.
   ;                                Values:  True/False
   ;                                Default: True
   ; ===================================================================================================================
   __New(HWND, StaticMode := False, NoSort := True, NoSizing := True) {
      If (This.Base.Base.__Class) ; do not instantiate instances
         Return False
      If This.Attached[HWND] ; HWND is already attached
         Return False
      If !DllCall(&quot;IsWindow&quot;, &quot;Ptr&quot;, HWND) ; invalid HWND
         Return False
      VarSetCapacity(Class, 512, 0)
      DllCall(&quot;GetClassName&quot;, &quot;Ptr&quot;, HWND, &quot;Str&quot;, Class, &quot;Int&quot;, 256)
      If (Class &lt;&gt; &quot;SysListView32&quot;) ; HWND doesn&#039;t belong to a ListView
         Return False
      ; ----------------------------------------------------------------------------------------------------------------
      ; Set LVS_EX_DOUBLEBUFFER (0x010000) style to avoid drawing issues.
      SendMessage, 0x1036, 0x010000, 0x010000, , % &quot;ahk_id &quot; . HWND ; LVM_SETEXTENDEDLISTVIEWSTYLE
      ; Get the default colors
      SendMessage, 0x1025, 0, 0, , % &quot;ahk_id &quot; . HWND ; LVM_GETTEXTBKCOLOR
      This.BkClr := ErrorLevel
      SendMessage, 0x1023, 0, 0, , % &quot;ahk_id &quot; . HWND ; LVM_GETTEXTCOLOR
      This.TxClr := ErrorLevel
      ; Get the header control
      SendMessage, 0x101F, 0, 0, , % &quot;ahk_id &quot; . HWND ; LVM_GETHEADER
      This.Header := ErrorLevel
      ; Set other properties
      This.HWND := HWND
      This.IsStatic := !!StaticMode
      This.AltCols := False
      This.AltRows := False
      This.NoSort(!!NoSort)
      This.NoSizing(!!NoSizing)
      This.OnMessage()
      This.Critical := &quot;Off&quot;
      This.Attached[HWND] := True
   }
   ; ===================================================================================================================
   __Delete() {
      This.Attached.Remove(HWND, &quot;&quot;)
      This.OnMessage(False)
      WinSet, Redraw, , % &quot;ahk_id &quot; . This.HWND
   }
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; PUBLIC METHODS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; ===================================================================================================================
   ; Clear()         Clears all row and cell colors.
   ; Parameters:     AltRows     -  Reset alternate row coloring (True / False)
   ;                                Default: False
   ;                 AltCols     -  Reset alternate column coloring (True / False)
   ;                                Default: False
   ; Return Value:   Always True.
   ; ===================================================================================================================
   Clear(AltRows := False, AltCols := False) {
      If (AltCols)
         This.AltCols := False
      If (AltRows)
         This.AltRows := False
      This.Remove(&quot;Rows&quot;)
      This.Remove(&quot;Cells&quot;)
      Return True
   }
   ; ===================================================================================================================
   ; AlternateRows() Sets background and/or text color for even row numbers.
   ; Parameters:     BkColor     -  Background color as RGB color integer (e.g. 0xFF0000 = red) or HTML color name.
   ;                                Default: Empty -&gt; default background color
   ;                 TxColor     -  Text color as RGB color integer (e.g. 0xFF0000 = red) or HTML color name.
   ;                                Default: Empty -&gt; default text color
   ; Return Value:   True on success, otherwise false.
   ; ===================================================================================================================
   AlternateRows(BkColor := &quot;&quot;, TxColor := &quot;&quot;) {
      If !(This.HWND)
         Return False
      This.AltRows := False
      If (BkColor = &quot;&quot;) &amp;&amp; (TxColor = &quot;&quot;)
         Return True
      BkBGR := This.BGR(BkColor)
      TxBGR := This.BGR(TxColor)
      If (BkBGR = &quot;&quot;) &amp;&amp; (TxBGR = &quot;&quot;)
         Return False
      This[&quot;ARB&quot;] := (BkBGR &lt;&gt; &quot;&quot;) ? BkBGR : This.BkClr
      This[&quot;ART&quot;] := (TxBGR &lt;&gt; &quot;&quot;) ? TxBGR : This.TxClr
      This.AltRows := True
      Return True
   }
   ; ===================================================================================================================
   ; AlternateCols() Sets background and/or text color for even column numbers.
   ; Parameters:     BkColor     -  Background color as RGB color integer (e.g. 0xFF0000 = red) or HTML color name.
   ;                                Default: Empty -&gt; default background color
   ;                 TxColor     -  Text color as RGB color integer (e.g. 0xFF0000 = red) or HTML color name.
   ;                                Default: Empty -&gt; default text color
   ; Return Value:   True on success, otherwise false.
   ; ===================================================================================================================
   AlternateCols(BkColor := &quot;&quot;, TxColor := &quot;&quot;) {
      If !(This.HWND)
         Return False
      This.AltCols := False
      If (BkColor = &quot;&quot;) &amp;&amp; (TxColor = &quot;&quot;)
         Return True
      BkBGR := This.BGR(BkColor)
      TxBGR := This.BGR(TxColor)
      If (BkBGR = &quot;&quot;) &amp;&amp; (TxBGR = &quot;&quot;)
         Return False
      This[&quot;ACB&quot;] := (BkBGR &lt;&gt; &quot;&quot;) ? BkBGR : This.BkClr
      This[&quot;ACT&quot;] := (TxBGR &lt;&gt; &quot;&quot;) ? TxBGR : This.TxClr
      This.AltCols := True
      Return True
   }
   ; ===================================================================================================================
   ; SelectionColors() Sets background and/or text color for selected rows.
   ; Parameters:     BkColor     -  Background color as RGB color integer (e.g. 0xFF0000 = red) or HTML color name.
   ;                                Default: Empty -&gt; default selected background color
   ;                 TxColor     -  Text color as RGB color integer (e.g. 0xFF0000 = red) or HTML color name.
   ;                                Default: Empty -&gt; default selected text color
   ; Return Value:   True on success, otherwise false.
   ; ===================================================================================================================
   SelectionColors(BkColor := &quot;&quot;, TxColor := &quot;&quot;) {
      If !(This.HWND)
         Return False
      This.SelColors := False
      If (BkColor = &quot;&quot;) &amp;&amp; (TxColor = &quot;&quot;)
         Return True
      BkBGR := This.BGR(BkColor)
      TxBGR := This.BGR(TxColor)
      If (BkBGR = &quot;&quot;) &amp;&amp; (TxBGR = &quot;&quot;)
         Return False
      This[&quot;SELB&quot;] := BkBGR
      This[&quot;SELT&quot;] := TxBGR
      This.SelColors := True
      Return True
   }
   ; ===================================================================================================================
   ; Row()           Sets background and/or text color for the specified row.
   ; Parameters:     Row         -  Row number
   ;                 Optional ------------------------------------------------------------------------------------------
   ;                 BkColor     -  Background color as RGB color integer (e.g. 0xFF0000 = red) or HTML color name.
   ;                                Default: Empty -&gt; default background color
   ;                 TxColor     -  Text color as RGB color integer (e.g. 0xFF0000 = red) or HTML color name.
   ;                                Default: Empty -&gt; default text color
   ; Return Value:   True on success, otherwise false.
   ; ===================================================================================================================
   Row(Row, BkColor := &quot;&quot;, TxColor := &quot;&quot;) {
      If !(This.HWND)
         Return False
      If This.IsStatic
         Row := This.MapIndexToID(Row)
      This[&quot;Rows&quot;].Remove(Row, &quot;&quot;)
      If (BkColor = &quot;&quot;) &amp;&amp; (TxColor = &quot;&quot;)
         Return True
      BkBGR := This.BGR(BkColor)
      TxBGR := This.BGR(TxColor)
      If (BkBGR = &quot;&quot;) &amp;&amp; (TxBGR = &quot;&quot;)
         Return False
      This[&quot;Rows&quot;, Row, &quot;B&quot;] := (BkBGR &lt;&gt; &quot;&quot;) ? BkBGR : This.BkClr
      This[&quot;Rows&quot;, Row, &quot;T&quot;] := (TxBGR &lt;&gt; &quot;&quot;) ? TxBGR : This.TxClr
      Return True
   }
   ; ===================================================================================================================
   ; Cell()          Sets background and/or text color for the specified cell.
   ; Parameters:     Row         -  Row number
   ;                 Col         -  Column number
   ;                 Optional ------------------------------------------------------------------------------------------
   ;                 BkColor     -  Background color as RGB color integer (e.g. 0xFF0000 = red) or HTML color name.
   ;                                Default: Empty -&gt; row&#039;s background color
   ;                 TxColor     -  Text color as RGB color integer (e.g. 0xFF0000 = red) or HTML color name.
   ;                                Default: Empty -&gt; row&#039;s text color
   ; Return Value:   True on success, otherwise false.
   ; ===================================================================================================================
   Cell(Row, Col, BkColor := &quot;&quot;, TxColor := &quot;&quot;) {
      If !(This.HWND)
         Return False
      If This.IsStatic
         Row := This.MapIndexToID(Row)
      This[&quot;Cells&quot;, Row].Remove(Col, &quot;&quot;)
      If (BkColor = &quot;&quot;) &amp;&amp; (TxColor = &quot;&quot;)
         Return True
      BkBGR := This.BGR(BkColor)
      TxBGR := This.BGR(TxColor)
      If (BkBGR = &quot;&quot;) &amp;&amp; (TxBGR = &quot;&quot;)
         Return False
      If (BkBGR &lt;&gt; &quot;&quot;)
         This[&quot;Cells&quot;, Row, Col, &quot;B&quot;] := BkBGR
      If (TxBGR &lt;&gt; &quot;&quot;)
         This[&quot;Cells&quot;, Row, Col, &quot;T&quot;] := TxBGR
      Return True
   }
   ; ===================================================================================================================
   ; NoSort()        Prevents/allows sorting by click on a header item for this ListView.
   ; Parameters:     Apply       -  True/False
   ;                                Default: True
   ; Return Value:   True on success, otherwise false.
   ; ===================================================================================================================
   NoSort(Apply := True) {
      If !(This.HWND)
         Return False
      If (Apply)
         This.SortColumns := False
      Else
         This.SortColumns := True
      Return True
   }
   ; ===================================================================================================================
   ; NoSizing()      Prevents/allows resizing of columns for this ListView.
   ; Parameters:     Apply       -  True/False
   ;                                Default: True
   ; Return Value:   True on success, otherwise false.
   ; ===================================================================================================================
   NoSizing(Apply := True) {
      Static OSVersion := DllCall(&quot;GetVersion&quot;, &quot;UChar&quot;)
      If !(This.Header)
         Return False
      If (Apply) {
         If (OSVersion &gt; 5)
            Control, Style, +0x0800, , % &quot;ahk_id &quot; . This.Header ; HDS_NOSIZING = 0x0800
         This.ResizeColumns := False
      }
      Else {
         If (OSVersion &gt; 5)
            Control, Style, -0x0800, , % &quot;ahk_id &quot; . This.Header ; HDS_NOSIZING
         This.ResizeColumns := True
      }
      Return True
   }
   ; ===================================================================================================================
   ; OnMessage()     Adds/removes a message handler for WM_NOTIFY messages for this ListView.
   ; Parameters:     Apply       -  True/False
   ;                                Default: True
   ; Return Value:   Always True
   ; ===================================================================================================================
   OnMessage(Apply := True) {
      If (Apply) &amp;&amp; !This.HasKey(&quot;OnMessageFunc&quot;) {
         This.OnMessageFunc := ObjBindMethod(This, &quot;On_WM_Notify&quot;)
         OnMessage(0x004E, This.OnMessageFunc) ; add the WM_NOTIFY message handler
      }
      Else If !(Apply) &amp;&amp; This.HasKey(&quot;OnMessageFunc&quot;) {
         OnMessage(0x004E, This.OnMessageFunc, 0) ; remove the WM_NOTIFY message handler
         This.OnMessageFunc := &quot;&quot;
         This.Remove(&quot;OnMessageFunc&quot;)
      }
      WinSet, Redraw, , % &quot;ahk_id &quot; . This.HWND
      Return True
   }
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; PRIVATE PROPERTIES  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   Static Attached := {}
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; PRIVATE METHODS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   On_WM_NOTIFY(W, L, M, H) {
      ; Notifications: NM_CUSTOMDRAW = -12, LVN_COLUMNCLICK = -108, HDN_BEGINTRACKA = -306, HDN_BEGINTRACKW = -326
      Critical, % This.Critical
      If ((HCTL := NumGet(L + 0, 0, &quot;UPtr&quot;)) = This.HWND) || (HCTL = This.Header) {
         Code := NumGet(L + (A_PtrSize * 2), 0, &quot;Int&quot;)
         If (Code = -12)
            Return This.NM_CUSTOMDRAW(This.HWND, L)
         If !This.SortColumns &amp;&amp; (Code = -108)
            Return 0
         If !This.ResizeColumns &amp;&amp; ((Code = -306) || (Code = -326))
            Return True
      }
   }
   ; -------------------------------------------------------------------------------------------------------------------
   NM_CUSTOMDRAW(H, L) {
      ; Return values: 0x00 (CDRF_DODEFAULT), 0x20 (CDRF_NOTIFYITEMDRAW / CDRF_NOTIFYSUBITEMDRAW)
      Static SizeNMHDR := A_PtrSize * 3                  ; Size of NMHDR structure
      Static SizeNCD := SizeNMHDR + 16 + (A_PtrSize * 5) ; Size of NMCUSTOMDRAW structure
      Static OffItem := SizeNMHDR + 16 + (A_PtrSize * 2) ; Offset of dwItemSpec (NMCUSTOMDRAW)
      Static OffItemState := OffItem + A_PtrSize         ; Offset of uItemState  (NMCUSTOMDRAW)
      Static OffCT :=  SizeNCD                           ; Offset of clrText (NMLVCUSTOMDRAW)
      Static OffCB := OffCT + 4                          ; Offset of clrTextBk (NMLVCUSTOMDRAW)
      Static OffSubItem := OffCB + 4                     ; Offset of iSubItem (NMLVCUSTOMDRAW)
      ; ----------------------------------------------------------------------------------------------------------------
      DrawStage := NumGet(L + SizeNMHDR, 0, &quot;UInt&quot;)
      , Row := NumGet(L + OffItem, &quot;UPtr&quot;) + 1
      , Col := NumGet(L + OffSubItem, &quot;Int&quot;) + 1
      , Item := Row - 1
      If This.IsStatic
         Row := This.MapIndexToID(Row)
      ; CDDS_SUBITEMPREPAINT = 0x030001 --------------------------------------------------------------------------------
      If (DrawStage = 0x030001) {
         UseAltCol := !(Col &amp; 1) &amp;&amp; (This.AltCols)
         , ColColors := This[&quot;Cells&quot;, Row, Col]
         , ColB := (ColColors.B &lt;&gt; &quot;&quot;) ? ColColors.B : UseAltCol ? This.ACB : This.RowB
         , ColT := (ColColors.T &lt;&gt; &quot;&quot;) ? ColColors.T : UseAltCol ? This.ACT : This.RowT
         , NumPut(ColT, L + OffCT, &quot;UInt&quot;), NumPut(ColB, L + OffCB, &quot;UInt&quot;)
         Return (!This.AltCols &amp;&amp; !This.HasKey(Row) &amp;&amp; (Col &gt; This[&quot;Cells&quot;, Row].MaxIndex())) ? 0x00 : 0x20
      }
      ; CDDS_ITEMPREPAINT = 0x010001 -----------------------------------------------------------------------------------
      If (DrawStage = 0x010001) {
         ; LVM_GETITEMSTATE = 0x102C, LVIS_SELECTED = 0x0002
         If (This.SelColors) &amp;&amp; DllCall(&quot;SendMessage&quot;, &quot;Ptr&quot;, H, &quot;UInt&quot;, 0x102C, &quot;Ptr&quot;, Item, &quot;Ptr&quot;, 0x0002, &quot;UInt&quot;) {
            ; Remove the CDIS_SELECTED (0x0001) and CDIS_FOCUS (0x0010) states from uItemState and set the colors.
            NumPut(NumGet(L + OffItemState, &quot;UInt&quot;) &amp; ~0x0011, L + OffItemState, &quot;UInt&quot;)
            If (This.SELB &lt;&gt; &quot;&quot;)
               NumPut(This.SELB, L + OffCB, &quot;UInt&quot;)
            If (This.SELT &lt;&gt; &quot;&quot;)
               NumPut(This.SELT, L + OffCT, &quot;UInt&quot;)
            Return 0x02 ; CDRF_NEWFONT
         }
         UseAltRow := (Item &amp; 1) &amp;&amp; (This.AltRows)
         , RowColors := This[&quot;Rows&quot;, Row]
         , This.RowB := RowColors ? RowColors.B : UseAltRow ? This.ARB : This.BkClr
         , This.RowT := RowColors ? RowColors.T : UseAltRow ? This.ART : This.TxClr
         If (This.AltCols || This[&quot;Cells&quot;].HasKey(Row))
            Return 0x20
         NumPut(This.RowT, L + OffCT, &quot;UInt&quot;), NumPut(This.RowB, L + OffCB, &quot;UInt&quot;)
         Return 0x00
      }
      ; CDDS_PREPAINT = 0x000001 ---------------------------------------------------------------------------------------
      Return (DrawStage = 0x000001) ? 0x20 : 0x00
   }
   ; -------------------------------------------------------------------------------------------------------------------
   MapIndexToID(Row) { ; provides the unique internal ID of the given row number
      SendMessage, 0x10B4, % (Row - 1), 0, , % &quot;ahk_id &quot; . This.HWND ; LVM_MAPINDEXTOID
      Return ErrorLevel
   }
   ; -------------------------------------------------------------------------------------------------------------------
   BGR(Color, Default := &quot;&quot;) { ; converts colors to BGR
      Static Integer := &quot;Integer&quot; ; v2
      ; HTML Colors (BGR)
      Static HTML := {AQUA: 0xFFFF00, BLACK: 0x000000, BLUE: 0xFF0000, FUCHSIA: 0xFF00FF, GRAY: 0x808080, GREEN: 0x008000
                    , LIME: 0x00FF00, MAROON: 0x000080, NAVY: 0x800000, OLIVE: 0x008080, PURPLE: 0x800080, RED: 0x0000FF
                    , SILVER: 0xC0C0C0, TEAL: 0x808000, WHITE: 0xFFFFFF, YELLOW: 0x00FFFF}
      If Color Is Integer
         Return ((Color &gt;&gt; 16) &amp; 0xFF) | (Color &amp; 0x00FF00) | ((Color &amp; 0xFF) &lt;&lt; 16)
      Return (HTML.HasKey(Color) ? HTML[color] : Default)
   }
} 

Escape:: ExitApp
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 24 Jul 2016 09:51:49 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106316#p106316</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: LV_InsertCol - переход к заполнению новой колонки в ListView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106311#p106311</link>
			<description><![CDATA[<p>А есть ли возможность изменить цвет текста ячейки уже после её создания и заполнения? Например, циклом найти все значения ниже порога и изменить их цвет, чтобы при изучении статистики их можно было сразу заметить.</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Sun, 24 Jul 2016 00:09:03 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106311#p106311</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: LV_InsertCol - переход к заполнению новой колонки в ListView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106277#p106277</link>
			<description><![CDATA[<p>Шикарно! Прямо в десяточку! Благодарю.</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Fri, 22 Jul 2016 14:17:20 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106277#p106277</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: LV_InsertCol - переход к заполнению новой колонки в ListView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106271#p106271</link>
			<description><![CDATA[<div class="quotebox"><cite>KusochekDobra пишет:</cite><blockquote><p>Но хочется то чтобы было как &quot;E=MC2&quot;!</p></blockquote></div><p>Хотя в любом из случаев думаю будет удобнее и понятнее просто указать строку и существующую колонку, чтобы изменить конкретную ячейку.</p><div class="codebox"><pre><code>LV_ModifyCell(Row, Col, Text)</code></pre></div><div class="codebox"><pre><code>
fileCount := 10
 
Gui, Add, ListView, r15 w600

Loop % fileCount + (i := 0)
{
	LV_InsertCol(++i, &quot;&quot;, &quot;Имя&quot;)
	LV_InsertCol(++i, &quot;&quot;, &quot;Значение&quot;) 
	Random, R, 5, 15 
	Loop % R ; кол-во строк файла
	{ 
		Random, R, 10000, 20000
		LV_ModifyCell(A_Index, i - 1, (i+1)//2 &quot;-&quot; A_Index)
		LV_ModifyCell(A_Index, i, R)
	}
} 
Loop % LV_GetCount(&quot;Col&quot;)
	LV_ModifyCol(A_Index, &quot;AutoHdr&quot;)
Gui, Show, , Log result 
Return

LV_ModifyCell(Row, Col, Text) {
	If (Row &gt; LV_GetCount())
		LV_Insert(Row, &quot;Col&quot; Col, Text)
	Else
		LV_Modify(Row, &quot;Col&quot; Col, Text)
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Fri, 22 Jul 2016 10:10:26 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106271#p106271</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: LV_InsertCol - переход к заполнению новой колонки в ListView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106270#p106270</link>
			<description><![CDATA[<p>Или такое?<br /></p><div class="codebox"><pre><code> 
Gui, Add, ListView, r15 w600

fileCount := 10

Loop % fileCount + (i := 0)
{
	LV_InsertCol(++i, &quot;&quot;, &quot;Имя&quot;)
	LV_InsertCol(++i, &quot;&quot;, &quot;Значение&quot;) 
	Random, R, 5, 15 
	Loop % R ; кол-во строк файла
	{ 
		Random, R, 10000, 20000 
		if (A_Index &gt; LV_GetCount())
			LV_Insert(A_Index, &quot;Col&quot; i - 1, A_Index, R)
		else
			LV_Modify(A_Index, &quot;Col&quot; i - 1, A_Index, R)
	}
} 
Loop % LV_GetCount(&quot;Col&quot;)
	LV_ModifyCol(A_Index, &quot;AutoHdr&quot;)
Gui, Show, , Log result
return
</code></pre></div><p>Когда пара созданных столбцов сразу заполняются.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Fri, 22 Jul 2016 09:25:24 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106270#p106270</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: LV_InsertCol - переход к заполнению новой колонки в ListView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106269#p106269</link>
			<description><![CDATA[<p>Вы про такое заполнение?<br /></p><div class="codebox"><pre><code>
Gui, Add, ListView, r15 w600

fileCount:= 10
Loop % fileCount + (i := 0)
	LV_InsertCol(++i, &quot;&quot;, &quot;Имя&quot;), LV_InsertCol(++i, &quot;&quot;, &quot;Значение&quot;) 
	
Loop % LV_GetCount(&quot;Col&quot;) // 2 + (i := -1) + 1
{
	Random, R, 5, 15
	i += 2
	Loop % R
	{ 
		Random, R, 10000, 20000 
		if (A_Index &gt; LV_GetCount())
			LV_Insert(A_Index, &quot;Col&quot; i, A_Index, R)
		else
			LV_Modify(A_Index, &quot;Col&quot; i, A_Index, R)
	}
	
} 
Loop % LV_GetCount(&quot;Col&quot;)
	LV_ModifyCol(A_Index, &quot;AutoHdr&quot;)  
	
Gui, Show, , Log result
return
</code></pre></div><p>Когда сначала созданы все столбцы, а потом заполняются.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Fri, 22 Jul 2016 09:17:58 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106269#p106269</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: LV_InsertCol - переход к заполнению новой колонки в ListView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106259#p106259</link>
			<description><![CDATA[<p>Поясню немного. Создал тему, потому как <a href="http://forum.script-coding.com/viewtopic.php?pid=106202#p106202">это обсуждение</a> плавно перетекло в ипостась с вопросами по &quot;ListView&quot;. В поиске новых знаний среди справочного материала не нашлось объяснения/описания, как перейти к первой строке вновь созданного столбца функцией &quot;LV_InsertCol()&quot;, который в свою очередь может создаваться по условию в работе сценария. То есть - может и НЕ создаваться тоже. Но если он всё таки создан, то как перейти к его заполнению данными? Прямо в течении заполнения &quot;ListView&quot; данными имеется в виду. Мне думается, что по аналогии с массивами и иже с ними, по ячейкам можно перемещать указатель, ведь он перемещается сверху вниз заполняя строками объект, значит и по столбцам можно так же перемещаться, но не тут то было.</p><p>Так то не сложно в домашних условиях, &quot;для себя&quot; так сказать, ручками сформировать длиннющую строку параметров для &quot;LV_Add()&quot;(в моём случае их 38 на данный момент) следующих после опций и в одном прогоне по циклу с максимальным количеством итераций заполнять, передавая туда данные предварительно проверяя на их существование как таковое и заполняя пустышками, если они отсутствуют. Но хочется то чтобы было как &quot;E=MC2&quot;! То есть, дошёл до того момента где заканчивается файл лога, создал для нового(если он имеется) новые столбцы, перешёл к их началу и повторил операцию. Да, с точки зрения &quot;варивших кашу в этом котле&quot;, может выглядеть и глупо и наивно. Когда-то и для меня это будет так-же, а пока пойду читать про <a href="https://autohotkey.com/docs/Objects.htm#Usage">объекты</a>, а то плохо представляя как оно работает сложно оценивать эффективность в моём случае.</p><p><strong>yalanne</strong>, за попытку спасибо!</p><p>Гифка - ОГОНЬ! <img src="//forum.script-coding.com/img/smilies/cool.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Thu, 21 Jul 2016 20:13:40 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106259#p106259</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: LV_InsertCol - переход к заполнению новой колонки в ListView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106256#p106256</link>
			<description><![CDATA[<p>Сделал вот такую функцию в которой можно задать имя столба и через push или insert указать нужные данные.</p><div class="codebox"><pre><code>Arr := {base:{__Get:Func(&quot;_GetArrIndex&quot;)}}

loop 14
{
	Arr[&quot;Имя&quot;].Push(&quot;name &quot; . A_Index)
	Random, r, 10, 20
	Arr[&quot;Значение&quot;].Push(r)
}

Gui, 1: +ToolWindow +Resize
Gui, 1: Font, s7 Bold
Gui, 1: Add, ListView, r20 w600 vListView1 , Имя|Значение

CreateLV_MultiColumn(Arr)

LV_ModifyCol()
Gui, 1: Show

Return
GuiClose:
ExitApp
Return

CreateLV_MultiColumn(obj)
{
	Gui,ListView,ListView1
	LV_Delete()
	Loop % LV_GetCount(&quot;Column&quot;)
	{
		LV_GetText(RetrievedText,0,A_Index),	indexColumn := A_Index
		for index,value in obj[	RetrievedText	]
			% (indexColumn = 1) ? LV_Add(&quot;&quot;,value)
			: LV_Modify(index,&quot;Col&quot; indexColumn,value)
	}
}

_GetArrIndex(_,value){
	Return _[value] := []
}</code></pre></div><p>CreateLV_MultiColumn(Arr) - обновит список.</p><p>Столбик <strong>значение</strong> можно заполнить раньше столбика <strong>имя</strong>, скрипт все ровно сформирует в том порядке в котором было указанно при создании контрола.<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;пример</div><div class="fancy_spoiler"><div class="codebox"><pre><code>Arr := {base:{__Get:Func(&quot;_GetArrIndex&quot;)}}

loop 14
{
	
	Random, r, 10, 20
	Arr[&quot;Значение&quot;].Push(r)
	Arr[&quot;Имя&quot;].Push(&quot;name &quot; . A_Index)
}

Gui, 1: +ToolWindow +Resize
Gui, 1: Font, s7 Bold
Gui, 1: Add, ListView, r20 w600 vListView1 , Имя|Значение

CreateLV_MultiColumn(Arr)

LV_ModifyCol()
Gui, 1: Show

Return
GuiClose:
ExitApp
Return

CreateLV_MultiColumn(obj)
{
	Gui,ListView,ListView1
	LV_Delete()
	Loop % LV_GetCount(&quot;Column&quot;)
	{
		LV_GetText(RetrievedText,0,A_Index),	indexColumn := A_Index
		for index,value in obj[	RetrievedText	]
			% (indexColumn = 1) ? LV_Add(&quot;&quot;,value)
			: LV_Modify(index,&quot;Col&quot; indexColumn,value)
	}
}

_GetArrIndex(_,value){
	Return _[value] := []
}</code></pre></div></div></div><p>Если указать в Arr несуществующий столб который должен быть первый, то нечего вообще не добавит,иначе просто игнорирует и добавляет что существует.</p>]]></description>
			<author><![CDATA[null@example.com (yalanne)]]></author>
			<pubDate>Thu, 21 Jul 2016 18:34:34 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106256#p106256</guid>
		</item>
		<item>
			<title><![CDATA[AHK: LV_InsertCol - переход к заполнению новой колонки в ListView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106216#p106216</link>
			<description><![CDATA[<p>Добра всем.<br />Подскажите пожалуйста, как правильно выглядит запись обеспечивающая переход к новой колонке добавленной &quot;LV_InsertCol&quot;, для заполнения её новыми строками строками &quot;LV_Add&quot;? Например:<br /></p><div class="codebox"><pre><code>
oneArr := []
twoArr := []
i := 1
while (i &lt; 15) {
	oneArr.Push(&quot;name &quot; . i)
	Random, r, 10, 20
	twoArr.Push(r)
	i++
}
Gui, 1: +ToolWindow +Resize
Gui, 1: Font, s7 Bold
Gui, 1: Add, ListView, r20 w600, Имя|Значение
i := 1
while (i &lt; 15) {
	LV_Add(&quot;&quot;, oneArr[i], twoArr[i])
	i++
}
LV_ModifyCol()
Gui, 1: Show

Return
GuiClose:
ExitApp
Return
</code></pre></div><p>Если я добавлю две колонки с аналогичными заголовками, то как мне в них пихнуть содержимое массивов &quot;oneArr&quot; и &quot;twoArr&quot;. Что-то всё читаю справку да не могу прицелиться поконкретнее. Нужная строка с мудростью уходит с радара раньше. =/</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Thu, 21 Jul 2016 00:58:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106216#p106216</guid>
		</item>
	</channel>
</rss>
