<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=10607</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10607&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов».]]></description>
		<lastBuildDate>Sun, 12 Mar 2023 20:23:02 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157138#p157138</link>
			<description><![CDATA[<p><strong>vlad1986</strong>, можно, но довольно заморочно, готового кода пока нет.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 12 Mar 2023 20:23:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157138#p157138</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157132#p157132</link>
			<description><![CDATA[<p><strong>teadrinker</strong> огромное спасибо за скрипт. Возможно ли его применить к gui с несколькими вкладками? (чтобы у каждой вкладки была своя прокрутка).</p>]]></description>
			<author><![CDATA[null@example.com (vlad1986)]]></author>
			<pubDate>Sun, 12 Mar 2023 19:00:48 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157132#p157132</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=95435#p95435</link>
			<description><![CDATA[<p>Исправил.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Mon, 13 Jul 2015 19:48:40 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=95435#p95435</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=95430#p95430</link>
			<description><![CDATA[<p>Да, на 32 глючит, посмотрю.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Mon, 13 Jul 2015 19:09:29 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=95430#p95430</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=95426#p95426</link>
			<description><![CDATA[<p>А вот если запустить скрипт на х64 интерпретаторе, то норм.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Mon, 13 Jul 2015 19:06:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=95426#p95426</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=95423#p95423</link>
			<description><![CDATA[<p>Странно, WheelDown поднимает вверх.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Mon, 13 Jul 2015 19:05:38 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=95423#p95423</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=95420#p95420</link>
			<description><![CDATA[<p>У меня всё нормально.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Mon, 13 Jul 2015 19:01:22 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=95420#p95420</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=95419#p95419</link>
			<description><![CDATA[<p>По колёсику едет только вверх.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Mon, 13 Jul 2015 19:00:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=95419#p95419</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93686#p93686</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 28 Apr 2015 13:47:55 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93686#p93686</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Создать вертикальную прокрутку для n-ого кол-ва контролов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=93673#p93673</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 28 Apr 2015 02:43:24 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=93673#p93673</guid>
		</item>
	</channel>
</rss>
