<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Выполнение действий в gui,2 в зависимости от control`ов gui,1.]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=12828&amp;type=atom" />
	<updated>2017-07-24T05:50:23Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=12828</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выполнение действий в gui,2 в зависимости от control`ов gui,1.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117558#p117558" />
			<content type="html"><![CDATA[<p>Тут следует уточнить слово &quot;поднимать&quot;.<br />Старую тему лучше не поднимать если вопрос слабо с ней связан. Если же он связан с ней напрямую, то предпочтительнее задать свой вопрос в старой теме, а не создавать тему-дубликат.</p><p>Когда идёт речь о визуальном поднятии заголовка темы в списке форума - такого запрета действительно нет. Но нельзя писать бессмысленные сообщения.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-07-24T05:50:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117558#p117558</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выполнение действий в gui,2 в зависимости от control`ов gui,1.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117556#p117556" />
			<content type="html"><![CDATA[<p>Четко прописан запрет поднятия старых тем. Но<br /></p><div class="quotebox"><blockquote><p>Любое сообщение обязано нести хоть какую-то полезную информацию. Запрещаются бессмысленные восклицания, одобряющие или осуждающие. Исключение составляют только восклицания благодарности за полезный ответ.</p></blockquote></div><p>Если модератор скажет, что сообщения Up и апдуте допустимы, готов принести извинения.</p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2017-07-23T20:35:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117556#p117556</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выполнение действий в gui,2 в зависимости от control`ов gui,1.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117555#p117555" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>stealzy пишет:</cite><blockquote><p>А вот поднимать тему запрещено правилами.</p></blockquote></div><p>Пруфлинк?</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-07-23T19:56:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117555#p117555</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выполнение действий в gui,2 в зависимости от control`ов gui,1.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117552#p117552" />
			<content type="html"><![CDATA[<p>Извините, не знал. Кажется разобрался, надо было сменить вкладку чтобы значение записывалось в переменную.. А я этого не делал и переменная оставалась пустая, поэтому не получалось. Вот что вышло:<br /></p><div class="codebox"><pre><code>global hGui1, moved

Tabs := [ &quot;1 вкладка&quot;
        , &quot;2 вкладка&quot;
        , &quot;3 вкладка&quot;
        , &quot;4 вкладка&quot; ]

Texts := [ &quot;Информация для первой вкладки&quot;
         , &quot;Информация для второй вкладки&quot;
         , &quot;Информация для третьей вкладки&quot;
         , &quot;Информация для четвёртой вкладки&quot; ]
		 
v := &quot;1 вкладка&quot;		 
1v := &quot;1 вкладка&quot;
2v := &quot;2 вкладка&quot;	 
3v := &quot;3 вкладка&quot;
4v := &quot;4 вкладка&quot;			 

Gui, +hwndhGui1 -Caption +ToolWindow
Gui, Color, 33CC33F
Gui, Add, Tab2, gButton vTab, % Tabs[1] &quot;|&quot; Tabs[2] &quot;|&quot; Tabs[3] &quot;|&quot; Tabs[4]
Gui, Add, CheckBox
Loop 4  {
   Gui, Tab, % A_Index
   Gui, Add, Button, x175 y40 w70 gButton vButton%A_Index%, % Chr(0x2192)
}

Gui, 2:+hwndhGui2 +owner1 -Caption +Border
Gui, 2:Add, Button, vInfo gButtonTab Center, % &quot;    &quot; Texts[1] &quot;    &quot;
VarSetCapacity(WI, 60)

OnMessage(0x3, &quot;WM_MOVE&quot;)
OnMessage(0x112, &quot;WM_MOVE&quot;)   ; WM_SYSCOMMAND = 0x112
return

$F1::
   Gui, 1: Show, % (a := !a) ? &quot;h95 w300&quot; : &quot;Hide&quot;
   if !i
      Return
   i := false

Button:
   DllCall(&quot;GetWindowInfo&quot;, Ptr, hGui1, Ptr, &amp;WI)
   ((InStr(A_GuiControl, &quot;Button&quot;) || (A_GuiControl = &quot;Tab&quot; &amp;&amp; i)) &amp;&amp; i := !i)
   Loop 4
      GuiControl,, Button%A_Index%, % Chr(0x2190|(i ? 0 : 2))
   
   if i
      Gui, 2:Show, % &quot;x&quot; NumGet(WI, 12, &quot;UInt&quot;) &quot; y&quot; NumGet(WI, 24, &quot;UInt&quot;) 
                  . &quot; h&quot; NumGet(WI, 32, &quot;UInt&quot;) - NumGet(WI, 24, &quot;UInt&quot;) &quot; hide&quot;
   DllCall(&quot;AnimateWindow&quot;, Ptr, hGui2, UInt, 400, UInt, 0x40000|(i ? 1 : 0x10002))
   
   if (A_GuiControl = &quot;Tab&quot;)  {  ; если меняется вкладка, меняем информацию в окне
      GuiControlGet, Tab
      for k, v in Tabs
         if (Tab = v)
            break
      GuiControl, 2:, Info, % Texts[k]
   }
   return

ButtonTab:
{
if (v = 1v)
    {
	msgbox 1
	return
    }
	    {   if (v = 2v)
	        {
		    msgbox 2
		    return
		    }   
			    {   if (v = 3v)
				    {
					msgbox 3
					return
					}
					    {   if (v = 4v)
						    {
							msgbox 4
							return
							}		     
                        }
                }
        }
}
return

WinMove()
{
    CoordMode, Mouse
    SetWinDelay, -1
    SetBatchLines, -1
    MouseGetPos, Start_X, Start_Y
    WinGetPos, X_Win, Y_Win,,, ahk_id %hGui1%
    While GetKeyState(&quot;RButton&quot;, &quot;P&quot;)
    {
        MouseGetPos, Current_X, Current_Y
        moved := (Current_X != Start_X || Current_Y != Start_Y) ? 1 : &quot;&quot;
        WinMove, ahk_id %hGui1%,, X_Win + Current_X - Start_X, Y_Win + Current_Y - Start_Y
        ;Sleep, 10
    }
}

~RButton::
    MouseGetPos,,, WinID
    if (WinID = hGui1)
        WinMove()
return
   

GuiClose:
   ExitApp
   
WM_MOVE(wp, lp, msg, hwnd)
{
   global hGui1, WI, i
   static k
   if (msg = 0x112)
   {
      if (wp = 0xF020 &amp;&amp; k := 1)   ; SC_MINIMIZE = 0xF020
         Gui, 2:Show, Hide
      
      if (wp = 0xF120 &amp;&amp; !(k := 0) &amp;&amp; i)   ; SC_RESTORE = 0xF120
         Gui, 2:Show
   }
   
   if (!i || hwnd != hGui1 || k = 1)
      return
   
   DllCall(&quot;GetWindowInfo&quot;, Ptr, hGui1, Ptr, &amp;WI)
   Gui, 2:Show, % &quot;x&quot; NumGet(WI, 12, &quot;UInt&quot;) &quot; y&quot; NumGet(WI, 24, &quot;UInt&quot;) 
               . &quot; h&quot; NumGet(WI, 32, &quot;UInt&quot;) - NumGet(WI, 24, &quot;UInt&quot;) &quot; NA&quot;
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[powercat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37884</uri>
			</author>
			<updated>2017-07-23T14:54:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117552#p117552</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выполнение действий в gui,2 в зависимости от control`ов gui,1.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117493#p117493" />
			<content type="html"><![CDATA[<p>Номер вкладки в данном примере пишется в переменную, используйте if/else в обработчике.<br />А вот поднимать тему запрещено правилами.</p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2017-07-23T00:34:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117493#p117493</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выполнение действий в gui,2 в зависимости от control`ов gui,1.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117490#p117490" />
			<content type="html"><![CDATA[<p>Up</p>]]></content>
			<author>
				<name><![CDATA[powercat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37884</uri>
			</author>
			<updated>2017-07-22T20:53:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117490#p117490</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выполнение действий в gui,2 в зависимости от control`ов gui,1.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117404#p117404" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong><br />Кнопка в Gui выдвигает слайдером Gui, 2&nbsp; вот в этом Gui,2 мне и нужно чтобы кнопка(из Gui,2) выполняла определенные действия в зависимости от того какая вкладка в первом Gui.<br /></p><div class="codebox"><pre><code>Gui, 2:Add, Button, vInfo gButtonTab Center, % &quot;    &quot; Texts[1] &quot;    &quot;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[powercat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37884</uri>
			</author>
			<updated>2017-07-19T18:54:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117404#p117404</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выполнение действий в gui,2 в зависимости от control`ов gui,1.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117403#p117403" />
			<content type="html"><![CDATA[<p>Есть куча вариантов, но у вас самого ответ уже есть: </p><div class="codebox"><pre><code>Gui, Add, Button, x175 y40 w70 gButton vButton%A_Index%</code></pre></div><p>почему бы не сделать так:<br /></p><div class="codebox"><pre><code>Gui, Add, Button, x175 y40 w70 gButton%A_Index% vButton%A_Index%</code></pre></div><p>и в метках Button1, Button2... выполнять что надо.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2017-07-19T18:38:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117403#p117403</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Выполнение действий в gui,2 в зависимости от control`ов gui,1.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117401#p117401" />
			<content type="html"><![CDATA[<p>Здравствуйте, на вашем форуме нашел очень хороший шаблон для GUI. В зависимости&nbsp; от того, какая вкладка сейчас активна, меняется название кнопки в gui 2. Но как сделать, чтобы для каждой вкладки кнопка в gui 2 выполняла свое действие?<br /></p><div class="codebox"><pre><code>global hGui1, moved

Tabs := [ &quot;1 вкладка&quot;
        , &quot;2 вкладка&quot;
        , &quot;3 вкладка&quot;
        , &quot;4 вкладка&quot; ]

Texts := [ &quot;Информация для первой вкладки&quot;
         , &quot;Информация для второй вкладки&quot;
         , &quot;Информация для третьей вкладки&quot;
         , &quot;Информация для четвёртой вкладки&quot; ]

Gui, +hwndhGui1 -Caption +ToolWindow
Gui, Color, 33CC33F
Gui, Add, Tab2, gButton vTab, % Tabs[1] &quot;|&quot; Tabs[2] &quot;|&quot; Tabs[3] &quot;|&quot; Tabs[4]
Gui, Add, CheckBox
Loop 4  {
   Gui, Tab, % A_Index
   Gui, Add, Button, x175 y40 w70 gButton vButton%A_Index%, % Chr(0x2192)
}

Gui, 2:+hwndhGui2 +owner1 -Caption +Border
Gui, 2:Add, Button, vInfo gButtonTab Center, % &quot;    &quot; Texts[1] &quot;    &quot;
VarSetCapacity(WI, 60)

OnMessage(0x3, &quot;WM_MOVE&quot;)
OnMessage(0x112, &quot;WM_MOVE&quot;)   ; WM_SYSCOMMAND = 0x112
Gui, show, w300 h300 Hide
return

$F1::
   Gui, 1: Show, % (a := !a) ? &quot;h70&quot; : &quot;Hide&quot;
   if !i
      Return
   i := false

Button:
   DllCall(&quot;GetWindowInfo&quot;, Ptr, hGui1, Ptr, &amp;WI)
   ((InStr(A_GuiControl, &quot;Button&quot;) || (A_GuiControl = &quot;Tab&quot; &amp;&amp; i)) &amp;&amp; i := !i)
   Loop 4
      GuiControl,, Button%A_Index%, % Chr(0x2190|(i ? 0 : 2))
   
   if i
      Gui, 2:Show, % &quot;x&quot; NumGet(WI, 12, &quot;UInt&quot;) &quot; y&quot; NumGet(WI, 24, &quot;UInt&quot;) 
                  . &quot; h&quot; NumGet(WI, 32, &quot;UInt&quot;) - NumGet(WI, 24, &quot;UInt&quot;) &quot; hide&quot;
   DllCall(&quot;AnimateWindow&quot;, Ptr, hGui2, UInt, 400, UInt, 0x40000|(i ? 1 : 0x10002))
   
   if (A_GuiControl = &quot;Tab&quot;)  {  ; если меняется вкладка, меняем информацию в окне
      GuiControlGet, Tab
      for k, v in Tabs
         if (Tab = v)
            break
      GuiControl, 2:, Info, % Texts[k]
   }
   ;msgbox %A_GuiControl%
   return

ButtonTab:
msgbox test
return

WinMove()
{
    CoordMode, Mouse
    SetWinDelay, -1
    SetBatchLines, -1
    MouseGetPos, Start_X, Start_Y
    WinGetPos, X_Win, Y_Win,,, ahk_id %hGui1%
    While GetKeyState(&quot;RButton&quot;, &quot;P&quot;)
    {
        MouseGetPos, Current_X, Current_Y
        moved := (Current_X != Start_X || Current_Y != Start_Y) ? 1 : &quot;&quot;
        WinMove, ahk_id %hGui1%,, X_Win + Current_X - Start_X, Y_Win + Current_Y - Start_Y
        ;Sleep, 10
    }
}

~RButton::
    MouseGetPos,,, WinID
    if (WinID = hGui1)
        WinMove()
return
   

GuiClose:
   ExitApp
   
WM_MOVE(wp, lp, msg, hwnd)
{
   global hGui1, WI, i
   static k
   if (msg = 0x112)
   {
      if (wp = 0xF020 &amp;&amp; k := 1)   ; SC_MINIMIZE = 0xF020
         Gui, 2:Show, Hide
      
      if (wp = 0xF120 &amp;&amp; !(k := 0) &amp;&amp; i)   ; SC_RESTORE = 0xF120
         Gui, 2:Show
   }
   
   if (!i || hwnd != hGui1 || k = 1)
      return
   
   DllCall(&quot;GetWindowInfo&quot;, Ptr, hGui1, Ptr, &amp;WI)
   Gui, 2:Show, % &quot;x&quot; NumGet(WI, 12, &quot;UInt&quot;) &quot; y&quot; NumGet(WI, 24, &quot;UInt&quot;) 
               . &quot; h&quot; NumGet(WI, 32, &quot;UInt&quot;) - NumGet(WI, 24, &quot;UInt&quot;) &quot; NA&quot;
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[powercat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37884</uri>
			</author>
			<updated>2017-07-19T15:43:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117401#p117401</id>
		</entry>
</feed>
