<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10764&amp;type=atom" />
	<updated>2015-07-13T20:53:51Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10764</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95439#p95439" />
			<content type="html"><![CDATA[<p>Иногда можно так:<br /></p><div class="codebox"><pre><code>
Gui, -DPIScale
Gui, Add, Tab, vTab1 gTab1, Tab1|Tab2|Tab3|Tab4|Tab5  
Gui, Tab, 1
Gui, Add, Button, x111 y111, Button Tab1
Gui, Tab, 3
Gui, Add, Button, x222 y111, Button Tab3
Gui, Add, Tab2, x0 y0 w0 h0 vTab2, |  
Gui, Add, Radio, xp+40 yp+80  vRadio Checked, A
Gui, Add, Radio, xp yp+20, B
Gui, Add, Radio, xp yp+20, C  
Gui, Show, , Tab test
Return
 
Tab1:
    Guicontrolget, Tab1
    GuiControl, % &quot;Show&quot; (Tab1 ~= &quot;^(Tab1|Tab2|Tab3)$&quot;), Tab2
    GuiControl, Show, Tab1 
    Return
</code></pre></div><p>Особенно удобно на больших группах контролов.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-07-13T20:53:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95439#p95439</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95436#p95436" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Gui, Add, Tab,vTab gTabG, Tab1|Tab2|Tab3|Tab4|Tab5
Gui, Tab, Tab1
Gui, Tab, Tab2
Gui, Tab, Tab3
Gui, Tab, Tab4
Gui, Tab, Tab5
Gui, Tab
    Gui, Add, Radio, x20 y40  vRadio Checked ,A
    Gui, Add, Radio, xp yp+20 ,B
    Gui, Add, Radio, xp yp+20 ,C
Gui, +HwndidGUI
Gui, Show, 
return


TabG:
Guicontrolget,Tab
SH := ((Tab = &quot;Tab1&quot;) or (Tab = &quot;Tab2&quot;)) ? &quot;Show&quot; : &quot;Hide&quot;
loop 3
Control %SH%, , Button%A_Index%, ahk_id %idGUI%</code></pre></div>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2015-07-13T19:56:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95436#p95436</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95434#p95434" />
			<content type="html"><![CDATA[<p><strong>yalanne</strong>, подобное сделать у меня получалось (разные вкладки - разные Radio), но это немного не то. Может быть я не до конца разобрался в коде, но скорее всего я плохо объяснил, что мне хотелось бы сделать и ты меня не так не понял.</p><p>В твоём коде, Radio для Tab1 и для Tab 2 не одно и то же, как я понимаю, вводится переменная Radio и Radio2. Т.е. переключатель на Tab2 отображает не то же самое, что и переключатель на Tab1 - не сохраняется положение переключателя (A, B, C), переменным Radio и Radio2, присваивать действие, или как-то группировать всё это дело.</p><p>Хотелось бы реализовать, что бы, например, на Tab1, Tab 2, Tab 3, был переключатель, как при<br /></p><div class="codebox"><pre><code>Gui, Tab
Gui, Add, Radio, x662 y289 w100 h30 vRadio Checked, A
Gui, Add, Radio, x552 y289 w100 h30 , B</code></pre></div><p>То есть изменив переключатель во вкладке Tab1, он так же сохранял бы положение в Tab2. При Gui, Tab, Radio переключатель один и тот же на всех вкладках Tab. Как можно сделать такой же эффект, только не для всех вкладок, что бы часть вкладок имела один и тот же переключатель, а другая другой.</p>]]></content>
			<author>
				<name><![CDATA[Remelibo]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32496</uri>
			</author>
			<updated>2015-07-13T19:29:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95434#p95434</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95398#p95398" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Gui, Add, Tab, vTab, Tab1|Tab2|Tab3|Tab4|Tab5

Gui, Tab, Tab1
    Gui, Add, Radio, x20 y40 w100 vRadio Checked ,A
    Gui, Add, Radio, xp yp+20 w100 ,B
    Gui, Add, Radio, xp yp+20 w100 ,C
Gui, Tab, Tab2
    Gui, Add, Radio, x20 y40 w100 vRadio2 Checked ,A
    Gui, Add, Radio, xp yp+20 w100 ,B
    Gui, Add, Radio, xp yp+20 w100 ,C
Gui, Tab, Tab3
Gui, Tab, Tab4
Gui, Tab, Tab5
    Gui, Tab
Gui, Show, 
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2015-07-13T17:01:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95398#p95398</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95394#p95394" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong>, спасибо.</p><p>Появился небольшой вопрос относительно вкладок (Tab) и Radio переключателя. Думаю, отдельная тема для вопроса не нужна, спрошу здесь.</p><p>Имею созданные вкладки:<br /></p><div class="codebox"><pre><code>Gui, Add, Tab, x2 y-1 w780 h470 , Tab1|Tab2|Tab3|Tab4|Tab5</code></pre></div><p>Имею переключалку типа:<br /></p><div class="codebox"><pre><code>Gui, Tab
Gui, Add, Radio, x662 y289 w100 h30 vRadio Checked, A
Gui, Add, Radio, x552 y289 w100 h30 , B
Gui, Add, Radio, x442 y289 w100 h30 , C</code></pre></div><p>Код Gui, Tab добавляет Radio во все вкладки, а как возможно реализовать отображение Radio, например, только на первой и второй вкладке, а на остальных не отображать (другое Radio на них хотелось бы сделать)?</p>]]></content>
			<author>
				<name><![CDATA[Remelibo]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32496</uri>
			</author>
			<updated>2015-07-13T16:41:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95394#p95394</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95222#p95222" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Remelibo пишет:</cite><blockquote><p>В чём проблема - слишком много пунктов в gui и хотелось бы уменьшить объём кода</p></blockquote></div><p>Для сокращения портянки условий, используйте массив:<br /></p><div class="codebox"><pre><code>
Gui, Add, Button, x2 y20 w100 h35 gLabel, One Two Three
Gui, Add, Button, x112 y20 w100 h35 gLabel, qwe
Gui, Add, Button, x222 y20 w100 h35 gLabel, 789
Gui, Add, Radio, x22 y249 w100 h30 vRadio Checked, A
Gui, Add, Radio, x122 y249 w100 h30, B
Gui, Add, Radio, x222 y249 w100 h30, C 
Gui, Show, x555 y400 h280 w325, GUI
Return

Label:
    Gui, Submit, NoHide 
    MsgBox, % {&quot;One Two Three&quot;:123,&quot;qwe&quot;:&quot;кьювэе&quot;,789:789}[A_GuiControl] 
        . &quot; : &quot; ([&quot;A&quot;,&quot;B&quot;,&quot;C&quot;][Radio])
    Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-07-10T10:42:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95222#p95222</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95195#p95195" />
			<content type="html"><![CDATA[<p><strong>YMP</strong>, ещё раз спасибо, выручил!</p>]]></content>
			<author>
				<name><![CDATA[Remelibo]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32496</uri>
			</author>
			<updated>2015-07-09T19:13:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95195#p95195</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95192#p95192" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
Gui, Add, Button, x2 y20 w100 h35 g123 , One Two Three 
Gui, Add, Button, x112 y20 w100 h35 gqwe, qwe
Gui, Add, Button, x222 y20 w100 h35 g789, 789
Gui, Add, Radio, x22 y249 w100 h30 vRadio, A
Gui, Add, Radio, x122 y249 w100 h30, B
Gui, Add, Radio, x222 y249 w100 h30, C

Gui, Show, x555 y400 h280 w325, GUI
return

123:
    var = 123
    Goto, abc
qwe:
    var = qwe
    Goto, abc
789:
    var = 789
abc:
    Gui, Submit, NoHide
    If Radio = 1
        MsgBox, %var% A
    Else If Radio = 2
        MsgBox, %var% B
    Else If Radio = 3
        MsgBox, %var% C
    Else
        MsgBox, %var%
    Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-07-09T18:38:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95192#p95192</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95166#p95166" />
			<content type="html"><![CDATA[<p><strong>YMP</strong> и <strong>teadrinker</strong>, большое спасибо!</p><p>Появился ещё 1 небольшой вопрос (надо было его заранее продумать, конечно...) - хотелось бы реализовать 3 разных действия при нажатии на кнопку в GUI, а не одно. Вроде через функцию Radio это возможно реализовать задуманное - было бы идеально, если бы через 3 чекбокса у уголке переключалось действие.</p><p>В теории, я представляю себе это как-то так (а вот на практике - знаний не хватает):<br /></p><div class="codebox"><pre><code>Gui, Add, Button, x2 y20 w100 h35 g123 , One Two Three 
Gui, Add, Button, x112 y20 w100 h35 gqwe, qwe
Gui, Add, Button, x222 y20 w100 h35 g789, 789
Gui, Add, Radio, x222 y249 w100 h30 , C
Gui, Add, Radio, x122 y249 w100 h30 , B
Gui, Add, Radio, x22 y249 w100 h30 , A

Gui, Show, x555 y400 h280 w325, GUI
return

123:
    var = 123
    Goto, abc
qwe:
    var = qwe
    Goto, abc
789:
    var = 789
abc:
    MsgBox, %var%
    Return
</code></pre></div><p>Возможно ли в abc: задать уловие, что-то вроде if A - выполняется такое-то действие, If B - другое, If C - третье?</p>]]></content>
			<author>
				<name><![CDATA[Remelibo]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32496</uri>
			</author>
			<updated>2015-07-09T14:56:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95166#p95166</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95156#p95156" />
			<content type="html"><![CDATA[<p>А проще так:<br /></p><div class="codebox"><pre><code>Gui, Add, Button, vMyButton1 gLabel, Кнопка 1
Gui, Add, Button, vMyButton2 gLabel, Кнопка 2
Gui, Add, Button, vMyButton3 gLabel, Кнопка 3
Gui, Show, w200 h100
Return

Label:
   MsgBox, % A_GuiControl
   Return</code></pre></div><p>Или даже так:</p><div class="codebox"><pre><code>Gui, Add, Button, gLabel, Кнопка 1
Gui, Add, Button, gLabel, Кнопка 2
Gui, Add, Button, gLabel, Кнопка 3
Gui, Show, w200 h100
Return

Label:
   MsgBox, % A_GuiControl
   Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-07-09T12:02:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95156#p95156</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95155#p95155" />
			<content type="html"><![CDATA[<p>Можно так:<br /></p><div class="codebox"><pre><code>
Gui, Add, Button, x2 y20 w100 h35 g123 , One Two Three 
Gui, Add, Button, x112 y20 w100 h35 gqwe, qwe
Gui, Add, Button, x222 y20 w100 h35 g789, 789
Gui, Show, x142 y93 h70 w325, GUI
return

123:
    var = 123
    Goto, abc
qwe:
    var = qwe
    Goto, abc
789:
    var = 789
abc:
    MsgBox, %var%
    Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-07-09T11:56:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95155#p95155</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Вопос по кнопкам GUI (присвоение переменной)]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95153#p95153" />
			<content type="html"><![CDATA[<p>Прошу помощи с простеньким скриптом, завязанным на GUI. Что требуется: при нажатии на кнопку в GUI, выполняется </p><p>определённое действие.<br /></p><div class="codebox"><pre><code>Gui, Add, Button, x2 y20 w100 h35 g123 , One Two Three 
Gui, Add, Button, x112 y20 w100 h35 gqwe, qwe
Gui, Add, Button, x222 y20 w100 h35 g789, 789
Gui, Show, x142 y93 h70 w325, GUI
return

123:
MsgBox 123 ; и т.д. строк на 10
return

qwe:
MsgBox qwe ; и т.д. строк на 10
return

789:
MsgBox 789 ; и т.д. строк на 10
return</code></pre></div><p>В чём проблема - слишком много пунктов в gui и хотелось бы уменьшить объём кода. Код одинаков для всех кнопок, меняется лишь один параметр, хотелось бы значительно уменьшить код, создав для каждой кнопки свою переменную (типа var), которая бы подставлялась в код (%var%). Заранее спасибо.</p>]]></content>
			<author>
				<name><![CDATA[Remelibo]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32496</uri>
			</author>
			<updated>2015-07-09T10:35:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95153#p95153</id>
		</entry>
</feed>
