<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: VScroll/HScroll для GUI]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=11821</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11821&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: VScroll/HScroll для GUI».]]></description>
		<lastBuildDate>Wed, 20 Jul 2016 12:44:57 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: VScroll/HScroll для GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106202#p106202</link>
			<description><![CDATA[<p>Прошу прощения, подразобрался маленько, но застрял в финале:<br /></p><div class="codebox"><pre><code>
; Передает файл по номеру nmbrFile
TxtFileReturn(srchParam, nmbrFile, catalog) {
	FileList := &quot;&quot;
	Loop, %srchParam%
		FileList := % FileList A_LoopFileName &quot;`n&quot;
	Sort, FileList
	Loop, parse, FileList, &quot;`n&quot;
	{
		if A_LoopField := &quot;&quot;
			continue
		if (A_Index == nmbrFile)
			return % catalog A_LoopField
	}
}
; Размеры окна результирующего GUI
result_w := 610, result_h := 950

; Количество файлов лога
fileCount:= 19
Gui, 1: +ToolWindow +Resize +HwndResultH
Gui, 1: Font, s7 Bold
Gui, 1: Add, ListView, r53 w600, Имя|Значение

; Создаём столбцы для всех файлов
createCol := 3
while (createCol &lt; fileCount * 2) {
	LV_InsertCol(createCol,, &quot;Имя&quot;)
	LV_InsertCol(createCol + 1,, &quot;Значение&quot;)
	createCol += 2
}
logFileArr := []			; Массив с результирующими данными для извлечения в ListView
total := 1
while (total &lt;= fileCount) {
	
	logAdress := TxtFileReturn(&quot;*.txt&quot;, total, &quot;&quot;)	; получаем файл
	file := FileOpen(logAdress, &quot;r&quot;, &quot;UTF-8&quot;)
	line := file.ReadLine()
	lineCount := 1									; считаем кол-во строк
	while (true) {
		line := file.ReadLine()
		if (line != &quot;&quot;)
			lineCount++
		else
			break
	}
	file.Seek(0)									; возвращаемся в начало файла
	
	liner := 1										; помещаем нужные фрагменты строки в массив, массива logFileArr
	while (liner &lt;= lineCount) {
		line := file.ReadLine()
		logFileArr[total].Push(StrSplit(line, &quot;,&quot;, &quot;`r`n&quot;))
		liner++
	}
	file.Close()									; закрываем отработанный файл
	total++											; переход к следующему
}

; !!!!! И вот тут возникает проблема !!!!!

total := 1
while (total &lt;= fileCount) {
	
	total++	
}

LV_ModifyCol()
Gui, 1: Show, w%result_w% h%result_h%, Log result

Return
GuiClose:
ExitApp
Return
</code></pre></div><p>Последним циклом нужно сформировать весь объект &quot;ListView&quot;, передав ему через функцию &quot;LV_Add([Options, Field1, Field2, ...])&quot; все Field`ы. Там ещё немного помухлевать нужно для корректности, ибо массивы массива logFileArr будут иметь разное количество элементов, но суть не в этом. Как выполнить запись так, чтобы не ручками заполнять все параметры после Options?</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Wed, 20 Jul 2016 12:44:57 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106202#p106202</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: VScroll/HScroll для GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106200#p106200</link>
			<description><![CDATA[<p>Так по ссылке же пример даже есть:<br /></p><div class="codebox"><pre><code>Gui, Add, ListView, h100 w100, Icon &amp; Number|Description ; Создаем элемент управления ListView.
ImageListID := IL_Create(10) ; Создаем ImageList для десяти маленьких иконок.
LV_SetImageList(ImageListID) ; Присваиваем созданный ImageList текущему элементу управления ListView.
Loop 10 ; Загружаем из DLL в ImageList группу иконок.
    IL_Add(ImageListID, &quot;shell32.dll&quot;, A_Index) ; Опускаем путь к DLL, чтобы скрипт работал и на Windows 9x.
Loop 10 ; Добавляем в ListView строки (одну строку для каждой иконки, только в целях демонстрации).
    LV_Add(&quot;Icon&quot; . A_Index, A_Index, &quot;n/a&quot;)
LV_ModifyCol(&quot;Hdr&quot;) ; Автоматически подбираем ширину столбцов.
Gui Show
return</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Wed, 20 Jul 2016 12:17:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106200#p106200</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: VScroll/HScroll для GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106198#p106198</link>
			<description><![CDATA[<p><strong>ypppu</strong>, благодарю. Забрал в памятку для следующих экспериментов.<br /><strong>Malcev</strong>, а вот &quot;Listview&quot;, пожалуй, идеальный вариант. Но как в нём запилить вертикальную/горизонтальную прокрутку? Лог пока простенький и каждый файл содержит всего до 53 строк с именем и значением. Один файл легко размещается в двух столбиках GUI высотой 850 пикселей, но что если разместить все 19 в 38 столбцах, и/или количество строк вырастет? Не нашёл упоминаний в <a href="http://www.script-coding.com/AutoHotkey/ListView.html#viewmodes">справочном материале</a>, а автоматически скролл-бары не добавляются. =/</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Wed, 20 Jul 2016 10:18:58 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106198#p106198</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: VScroll/HScroll для GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106179#p106179</link>
			<description><![CDATA[<div class="quotebox"><cite>KusochekDobra пишет:</cite><blockquote><p>прикрутить VScroll/HScroll для GUI</p></blockquote></div><p><a href="https://autohotkey.com/board/topic/3528-how-to-create-a-scrollbar-in-a-guiwindow/">how to create a scrollbar in a guiwindow</a><br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><div class="codebox"><pre><code>#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
;---------------------------------------------------------------------------------------------------------------

;This creates a GUI main window a vertical scrollbar
Gui, +0x200000 				; 0x200000 = WS_VSCROLL

;This creates an Edit control with its own vertical scrollbar (with initial state affected by its choice of contents)
Gui, Add, Edit, VScroll h100 yp+20, 1`n2`n3`n4`n5`n6`n7`n8`n9`n10`n11`n12`n

;Provide a button to get the scrollbar&#039;s state - you can&#039;t properly set a control-based scrollbar&#039;s state using
;   SetScrollInfo.
Gui, Add, Button, gButtonQueryScrollbar xp+60 yp, Get Scrollbar`nState

Gui, Show, w300 h200


;Get main window&#039;s handle
Process, Exist
nThisScriptPID := ErrorLevel
WinGet, hMainGUIHwnd, ID, ahk_pid %nThisScriptPID%

;Get handle of Edit control
ControlGet, hEditControlHwnd, Hwnd, , Edit1, Copy of New AutoHotkey Script.ahk

;A user-choice for which window handle to use (Edit control&#039;s scrollbar or main window&#039;s scrollbar)
hHwnd := hMainGUIHwnd
;hHwnd := hEditControlHwnd

;Allocate and initialize SCROLLINFO structure
Gosub, CreateScrollInfo

;Initialize the scrollbar&#039;s state:  nMin, nMax, nPage, nPos
bSuccess := SetScrollBar(hHwnd, 0, 100, 10, 48)

;Set up message handler for scrollbar events
OnMessage(0x115, &quot;DoVScroll&quot;)		; WM_VSCROLL = 0x115

return

;---------------------------------------------------------------------------------------------------------------
CreateScrollInfo:
   ;Re-use this SCROLLINFO structure for get/set of scrollbar state

   VarSetCapacity(SCROLLBAR_INFO, 28, 0)	;Allocate SCROLLBAR_INFO structure and zero it
   NumPut(28, &amp;SCROLLBAR_INFO)			;Initialize its count-bytes parameter
   NumPut(0x17, &amp;SCROLLBAR_INFO + 4)		;Initialize the mask for what properties to get or set, SIF_ALL = 0x17
return
;---------------------------------------------------------------------------------------------------------------
/*
---------------------------------------------------------------------------------------------------------------
The WM_VSCROLL message is sent to a window when a scroll event occurs in the window&#039;s standard vertical scroll
   bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in
   the control. 

wParam
   The high-order word specifies the current position of the scroll box if the low-order word is
      SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, this word is not used.
   The low-order word specifies a scroll bar value that indicates the user&#039;s scrolling request. This parameter
      can be one of the following values:

  SB_BOTTOM = 7
    Scrolls to the lower right.
  SB_ENDSCROLL = 8
    Ends scroll.
  SB_LINEDOWN = 1
    Scrolls one line down.
  SB_LINEUP = 0
    Scrolls one line up.
  SB_PAGEDOWN = 3
    Scrolls one page down.
  SB_PAGEUP = 2
    Scrolls one page up.
  SB_THUMBPOSITION = 4
    The user has dragged the scroll box (thumb) and released the mouse button. The high-order word indicates
       the position of the scroll box at the end of the drag operation.
  SB_THUMBTRACK = 5
    The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse
       button. The high-order word indicates the position that the scroll box has been dragged to.
  SB_TOP = 6
    Scrolls to the upper left.

lParam
   If the message is sent by a scroll bar, this parameter is the handle to the scroll bar control. If the
      message is not sent by a scroll bar, this parameter is NULL. 

Return Value
   If an application processes this message, it should return zero.
---------------------------------------------------------------------------------------------------------------
*/
;---------------------------------------------------------------------------------------------------------------
DoVScroll(wParam, lParam, msg, hwnd)			;Window message handler for WM_VSCROLL
{
   global hHwnd		;Only handle messages for the window we want to scroll
   if (hwnd != hHwnd)
      return

   wParamWordLow := Mod(wParam, 0x10000)
   wParamWordHigh := (wParam - wParamWordLow) / 0x10000

   if (wParamWordLow = 5 or wParamWordLow = 8)		;SB_THUMBTRACK or SB_ENDSCROLL
      return 0

   QueryScrollBar(hwnd, nMin, nMax, nPage, nPos, nTrackPos)

   if (wParamWordLow = 7)				;SB_BOTTOM
      MsgBox, SB_BOTTOM
   else if (wParamWordLow = 6)				;SB_TOP
      MsgBox, SB_TOP
   else if (wParamWordLow = 1)				;SB_LINEDOWN
      SetScrollBar(hwnd, nMin, nMax, nPage, nPos+1)
   else if (wParamWordLow = 0)				;SB_LINEUP
      SetScrollBar(hwnd, nMin, nMax, nPage, nPos-1)
   else if (wParamWordLow = 3)				;SB_PAGEDOWN
      SetScrollBar(hwnd, nMin, nMax, nPage, nPos+nPage)
   else if (wParamWordLow = 2)				;SB_PAGEUP
      SetScrollBar(hwnd, nMin, nMax, nPage, nPos-nPage)
   else if (wParamWordLow = 4)				;SB_THUMBPOSITION
      SetScrollBar(hwnd, nMin, nMax, nPage, wParamWordHigh)

   return 0
}
;---------------------------------------------------------------------------------------------------------------
ButtonQueryScrollbar:
   QueryScrollBar(hHwnd, nMin, nMax, nPage, nPos, nTrackPos)
   MsgBox, nMin:%nMin%, nMax:%nMax%, nPage:%nPage%, nPos:%nPos%
return
;---------------------------------------------------------------------------------------------------------------
QueryScrollBar(hwnd, ByRef nMin, ByRef nMax, ByRef nPage, ByRef nPos, ByRef nTrackPos)
{
   ;Win32 API:   BOOL GetScrollInfo( HWND hwnd, int fnBar, LPSCROLLINFO lpsi )

   global SCROLLBAR_INFO

   bSuccess := DllCall(&quot;GetScrollInfo&quot;, UInt, hwnd, Int, 1, UInt, &amp;SCROLLBAR_INFO)	;SB_VERT = 1
   if (!bSuccess)
      return false

   nMin := NumGet(&amp;SCROLLBAR_INFO, 8)
   nMax := NumGet(&amp;SCROLLBAR_INFO, 12)
   nPage := NumGet(&amp;SCROLLBAR_INFO, 16)
   nPos := NumGet(&amp;SCROLLBAR_INFO, 20)
   nTrackPos := NumGet(&amp;SCROLLBAR_INFO, 24)

   return true
}
;---------------------------------------------------------------------------------------------------------------
SetScrollBar(hwnd, nMin, nMax, nPage, nPos)
{
   ;Win32 API:   int SetScrollInfo( HWND hwnd, int fnBar, LPCSCROLLINFO lpsi, BOOL fRedraw )

   global SCROLLBAR_INFO
   NumPut(nMin, &amp;SCROLLBAR_INFO + 8)		;Min
   NumPut(nMax, &amp;SCROLLBAR_INFO + 12)		;Max
   NumPut(nPage, &amp;SCROLLBAR_INFO + 16)		;Page
   NumPut(nPos, &amp;SCROLLBAR_INFO + 20)		;Pos
   iReturnPos := DllCall(&quot;SetScrollInfo&quot;, UInt, hwnd, Int, 1, UInt, &amp;SCROLLBAR_INFO, Int, true)	;SB_VERT = 1
   return (iReturnPos == nPos)
}
;---------------------------------------------------------------------------------------------------------------
GuiClose:
   ExitApp
return
;---------------------------------------------------------------------------------------------------------------</code></pre></div></div></div>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Tue, 19 Jul 2016 12:30:15 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106179#p106179</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: VScroll/HScroll для GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106178#p106178</link>
			<description><![CDATA[<p>А Listview не подходит?</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 19 Jul 2016 11:47:55 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106178#p106178</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: VScroll/HScroll для GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106177#p106177</link>
			<description><![CDATA[<p>Ясно, благодарю. Думалось, что есть более простое и изящное решение. Сделал через добавление вкладок, группами по 5 штук.</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Tue, 19 Jul 2016 10:58:31 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106177#p106177</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: VScroll/HScroll для GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106173#p106173</link>
			<description><![CDATA[<p><a href="http://forum.script-coding.com/viewtopic.php?id=10607">http://forum.script-coding.com/viewtopic.php?id=10607</a></p>]]></description>
			<author><![CDATA[null@example.com (Nikva)]]></author>
			<pubDate>Tue, 19 Jul 2016 06:37:51 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106173#p106173</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: VScroll/HScroll для GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106171#p106171</link>
			<description><![CDATA[<p>Почему бы в Edit текст не вставить, там же есть прокрутка.</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Tue, 19 Jul 2016 02:55:34 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106171#p106171</guid>
		</item>
		<item>
			<title><![CDATA[AHK: VScroll/HScroll для GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=106164#p106164</link>
			<description><![CDATA[<p>Всем добра.<br />Радуясь открывающимся перспективам, решил вместо постоянного просмотра текстового лога после работы программы, сделать общий просмотр сразу всей информации, удобно размещённой в окошке GUI. Но беда в том оказалась, что ровные вертикальные столбики, как в ряд, так и при расположении сверху вниз образуют поле гораздо большее разрешения экрана(статистика из 19-ти лог-файлов). Уважаемые форумчане, подскажите пожалуйста способ прикрутить аналог VScroll/HScroll для GUI.</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Mon, 18 Jul 2016 23:39:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=106164#p106164</guid>
		</item>
	</channel>
</rss>
