<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10607&amp;type=atom" />
	<updated>2023-03-12T20:23:02Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10607</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157138#p157138" />
			<content type="html"><![CDATA[<p><strong>vlad1986</strong>, можно, но довольно заморочно, готового кода пока нет.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2023-03-12T20:23:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157138#p157138</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157132#p157132" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> огромное спасибо за скрипт. Возможно ли его применить к gui с несколькими вкладками? (чтобы у каждой вкладки была своя прокрутка).</p>]]></content>
			<author>
				<name><![CDATA[vlad1986]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38788</uri>
			</author>
			<updated>2023-03-12T19:00:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157132#p157132</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95435#p95435" />
			<content type="html"><![CDATA[<p>Исправил.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-07-13T19:48:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95435#p95435</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95430#p95430" />
			<content type="html"><![CDATA[<p>Да, на 32 глючит, посмотрю.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-07-13T19:09:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95430#p95430</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95426#p95426" />
			<content type="html"><![CDATA[<p>А вот если запустить скрипт на х64 интерпретаторе, то норм.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-07-13T19:06:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95426#p95426</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95423#p95423" />
			<content type="html"><![CDATA[<p>Странно, WheelDown поднимает вверх.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-07-13T19:05:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95423#p95423</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95420#p95420" />
			<content type="html"><![CDATA[<p>У меня всё нормально.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-07-13T19:01:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95420#p95420</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95419#p95419" />
			<content type="html"><![CDATA[<p>По колёсику едет только вверх.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-07-13T19:00:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95419#p95419</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93686#p93686" />
			<content type="html"><![CDATA[<p>Совсем по-простому не получится, и для каждого случая свой расчёт координат, поэтому нужно понимать, как это работает.<br /></p><div class="codebox"><pre><code>global WS_VSCROLL := 0x200000, SIZE_MINIMIZED := 1, SIF_RANGE := 0x1, SIF_PAGE := 0x2
     , SB_VERT := 1, SB_LINEUP := 0, SB_LINEDOWN := 1, WM_VSCROLL := 0x115

Gui +%WS_VSCROLL% +Resize +hwndhGui
Gui, Margin, 10, 10
Loop 20
   Gui, Add, Edit, w200 h80
ScrollSize := 80*20 + 10*19 + 20
Gui, Show, h400

OnMessage(0x20A, Func(&quot;WM_MOUSEWHEEL&quot;).Bind(hGui))
OnMessage(0x5, Func(&quot;WM_SIZE&quot;).Bind(ScrollSize))
OnMessage(0x115, &quot;WM_VSCROLL&quot;)

UpdateScrollBar(hGui, ScrollSize, 400)
Return

GuiClose:
   ExitApp
   
WM_SIZE(ScrollSize, wp, lp, msg, hWnd)
{
   if (wp = SIZE_MINIMIZED)
      Return
   
   GuiWidth := lp &amp; 0xFFFF, GuiHeight := lp &gt;&gt; 16
   Loop 20
      GuiControl, Move, Edit%A_Index%, % &quot;w&quot; GuiWidth - 20
   UpdateScrollBar(hWnd, ScrollSize, GuiHeight)
}

WM_MOUSEWHEEL(hWnd, wp)
{
   Loop 4
      WM_VSCROLL(wp&gt;&gt;16 &amp; 0xFFFF &lt; 0x7FFF ? SB_LINEUP : SB_LINEDOWN, 0, WM_VSCROLL, hWnd)
}

UpdateScrollBar(hWnd, ScrollHeight, GuiHeight)
{
   VarSetCapacity(si, 28, 0)
   NumPut(28, si) ; cbSize
   NumPut(SIF_RANGE | SIF_PAGE, si, 4)
   NumPut(ScrollHeight, si, 12) ; nMax
   NumPut(GuiHeight, si, 16) ; nPage
   DllCall(&quot;SetScrollInfo&quot;, Ptr, hWnd, UInt, SB_VERT, Ptr, &amp;si, UInt, 1)
   
   GuiControlGet, Pos, %hWnd%: Pos, Edit1
   if (PosY = 10)
      Return
   
   top := PosY - 10
   GuiControlGet, Pos, %hWnd%: Pos, Edit20
   bottom := PosY + PosH + 10
   if (top &lt; 0 &amp;&amp; bottom &lt; GuiHeight)
   {
      y := (a := Abs(top)) &gt; (b := GuiHeight-bottom) ? b : a
      DllCall(&quot;ScrollWindow&quot;, Ptr, hWnd, Int, 0, Int, y, Ptr, 0, Ptr, 0)
   }
}

WM_VSCROLL(wParam, lParam, msg, hwnd)
{
   static SIF_ALL:=0x17, SCROLL_STEP:=10
   bar := msg=0x115 ; SB_HORZ=0, SB_VERT=1

   VarSetCapacity(si, 28, 0)
   NumPut(28, si, &quot;UInt&quot;) ; cbSize
   NumPut(SIF_ALL, si, 4, &quot;UInt&quot;) ; fMask
   if !DllCall(&quot;GetScrollInfo&quot;, Ptr, hwnd, Int, bar, Ptr, &amp;si)
     return

   VarSetCapacity(rect, 16)
   DllCall(&quot;GetClientRect&quot;, Ptr, hwnd, Ptr, &amp;rect)

   new_pos := NumGet(si, 20, &quot;UInt&quot;) ; nPos

   action := wParam &amp; 0xFFFF
   if action = 0 ; SB_LINEUP
     new_pos -= SCROLL_STEP
   else if action = 1 ; SB_LINEDOWN
     new_pos += SCROLL_STEP
   else if action = 2 ; SB_PAGEUP
     new_pos -= NumGet(rect, 12, &quot;Int&quot;) - SCROLL_STEP
   else if action = 3 ; SB_PAGEDOWN
     new_pos += NumGet(rect, 12, &quot;Int&quot;) - SCROLL_STEP
   else if (action = 5 || action = 4) ; SB_THUMBTRACK || SB_THUMBPOSITION
     new_pos := wParam&gt;&gt;16
   else if action = 6 ; SB_TOP
     new_pos := NumGet(si, 8, &quot;Int&quot;) ; nMin
   else if action = 7 ; SB_BOTTOM
     new_pos := NumGet(si, 12, &quot;Int&quot;) ; nMax
   else
     return

   min := NumGet(si, 8, &quot;Int&quot;) ; nMin
   max := NumGet(si, 12, &quot;Int&quot;) - NumGet(si, 16, &quot;UInt&quot;) ; nMax-nPage
   new_pos := new_pos &gt; max ? max : new_pos
   new_pos := new_pos &lt; min ? min : new_pos

   old_pos := NumGet(si, 20, &quot;Int&quot;) ; nPos

   y := old_pos-new_pos
   ; Scroll contents of window and invalidate uncovered area.
   DllCall(&quot;ScrollWindow&quot;, Ptr, hwnd, Int, 0, Int, y, UInt, 0, UInt, 0)

   ; Update scroll bar.
   NumPut(new_pos, si, 20, &quot;Int&quot;) ; nPos
   DllCall(&quot;SetScrollInfo&quot;, Ptr, hwnd, Int, bar, Ptr, &amp;si, Int, 1)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-04-28T13:47:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93686#p93686</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93673#p93673" />
			<content type="html"><![CDATA[<p>Можно ли такое сделать по-простому?<br />Проще, чем тут:<br /><a href="http://ahkscript.org/boards/viewtopic.php?f=6&amp;t=6316">http://ahkscript.org/boards/viewtopic.p … amp;t=6316</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-04-28T02:43:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93673#p93673</id>
		</entry>
</feed>
