<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=5689&amp;type=atom" />
	<updated>2014-01-07T15:38:43Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=5689</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78991#p78991" />
			<content type="html"><![CDATA[<p>Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-01-07T15:38:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78991#p78991</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78990#p78990" />
			<content type="html"><![CDATA[<p>Нужно, так уж работает в AutoHotkey элемент &quot;Radio&quot;. Когда группируются несколько, всё равно нужно задавать состояние каждого поотдельности.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2014-01-07T15:24:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78990#p78990</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78989#p78989" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Irbis пишет:</cite><blockquote><p>При переключении Radio одна переменная NLOnSay хранит значение номера активного пункта</p></blockquote></div><p> Но без %ch1% - %ch1000000% она не работает. В этом и был вопрос, нужно ли их все прописывать.</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-01-07T15:15:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78989#p78989</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78988#p78988" />
			<content type="html"><![CDATA[<p>По-моему, товарищу <strong>Foma</strong> не требуется так усложнять, он затрудняется сформулировать вопрос и разобраться с примером.</p><div class="codebox"><pre><code>IniRead, Chat_settings, Settings.ini, Options, Chat settings, 
Ch%Chat_settings% = Checked

GUI, Add, Radio, %Ch1% vMyRadio  , SayToAll
GUI, Add, Radio, %Ch2%           , SayToTeam
GUI, Add, Radio, %Ch3%           , SayToSquad
GUI, Add, Button,                , Save
Gui, Show
Return

ButtonSave:
GUI, Submit, NoHide
IniWrite, %MyRadio%, Settings.ini, Options, Chat settings
Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2014-01-07T14:20:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78988#p78988</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78986#p78986" />
			<content type="html"><![CDATA[<p>Читай пост выше. При переключении Radio одна переменная NLOnSay хранит значение номера активного пункта.</p><p>Вариант, когда есть множество переключателей, координаты и надписи к контролам вынесены в отдельный массив.</p><div class="codebox"><pre><code>NLOnSay := 3
Radio := [[  5, 20, 100, 20, &quot;SayToAll&quot;]
         ,[105, 20, 100, 20, &quot;SayToTeam&quot;]
         ,[205, 20, 100, 20, &quot;SayToSquad&quot;]]

Loop % Radio.MaxIndex()
Gui, Add, Radio, % ((A_Index = NLOnSay) ? &quot;Checked&quot; : &quot;&quot;) &quot; x&quot; . Radio[A_Index][1]
   . &quot; y&quot; Radio[A_Index][2] . &quot; w&quot; Radio[A_Index][3] . &quot; h&quot; Radio[A_Index][4]
   . &quot; gUPD&quot; ((A_Index = 1) ? &quot; vNLOnSay&quot; : &quot;&quot;), % Radio[A_Index][5]
Gui, Show
Return

Upd:
   Gui, Submit, NoHide
   msgbox %NLOnSay%
Return

GuiClose:
   ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2014-01-07T13:26:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78986#p78986</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78984#p78984" />
			<content type="html"><![CDATA[<p>Не существует способа не присваивая каждой Radio своей переменной, присвоить общей переменной нужный номер и получить отмеченное Radio с этим номером?</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-01-07T12:00:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78984#p78984</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78983#p78983" />
			<content type="html"><![CDATA[<p>Переменная <strong>NLOnSay</strong> общая. Если есть другое решение без доп.переменных, выкладывайте.</p><p>Можно, в случае большого количества переключателей, занести координаты контролов и подписи к ним в масссив, в цикле добавлять на форму. При равенстве считанной из ini переменной со встроенной переменной <strong>A_Index</strong>, контролу присваивается атрибут Checked.<br />Дольше описывать алгоритм, чем оформить на примере работающего кода. ))</p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2014-01-07T11:14:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78983#p78983</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78977#p78977" />
			<content type="html"><![CDATA[<p>Я говорил об одной общей переменной для всей группы.</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-01-07T09:03:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78977#p78977</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78971#p78971" />
			<content type="html"><![CDATA[<p>Вместо присвоения в первой строке можно значение переменной загрузить из ini-файла, суть не меняется.</p><div class="codebox"><pre><code>NLOnSay := 1 
Ch%NLOnSay% = Checked

Gui, 1:Add, Radio, %Ch1% x5 y20 w100 h20 gUPD vNLOnSay, SayToAll
Gui, 1:Add, Radio, %Ch2% x105 y20 w100 h20 gUPD, SayToTeam
Gui, 1:Add, Radio, %Ch3% x205 y20 w100 h20 gUPD, SayToSquad
Gui, Show
Return

Upd:
    Gui, Submit, NoHide
    msgbox %NLOnSay%
Return

GuiClose:
    ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2014-01-07T01:45:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78971#p78971</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78967#p78967" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>YMP пишет:</cite><blockquote><p> Вот так работает у меня:</p></blockquote></div><p>&nbsp; А если мне надо сохранить, а потом загрузить? У меня 10 переключателей в группе.&nbsp; Сохраняю по нажатию на &quot;Ок&quot;. Тут всё получается, единственная переменная на группу, которая содержит номер помеченной кнопки передаёт номер в ini.&nbsp; При старте переменная точно получает номер из ini, но это никак не влияет на кнопки - все получаются неотмеченными.&nbsp; Это переменная что, только в одну сторону только работает? Как тогда отметить нужную кнопку при загрузке?</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-01-07T00:22:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78967#p78967</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=47328#p47328" />
			<content type="html"><![CDATA[<p>Всё заработало, спасибо за совет.</p>]]></content>
			<author>
				<name><![CDATA[Glebis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25766</uri>
			</author>
			<updated>2011-04-03T08:14:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=47328#p47328</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=47327#p47327" />
			<content type="html"><![CDATA[<p>GuiControlGet не переведена на русский. Вот так работает у меня:<br /></p><div class="codebox"><pre><code>Gui, 1:Add, Radio, x5 y20 w100 h20 gUPD vNLOnSay, SayToAll
Gui, 1:Add, Radio, x105 y20 w100 h20 gUPD, SayToTeam
Gui, 1:Add, Radio, x205 y20 w100 h20 gUPD, SayToSquad
Gui, Show
Return

Upd:
    Gui, Submit, NoHide
    msgbox %NLOnSay%
Return

GuiClose:
    ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2011-04-03T08:00:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=47327#p47327</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Почему переменная не содержит номера выбранного Radio?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=47325#p47325" />
			<content type="html"><![CDATA[<p>Вопрос про Radio элемент управления.<br /></p><div class="codebox"><pre><code>Gui, 1:Add, Radio, x5 y20 w100 h20 gUPD vNLOnSay, SayToAll
Gui, 1:Add, Radio, x105 y20 w100 h20 gUPD, SayToTeam
Gui, 1:Add, Radio, x205 y20 w100 h20 gUPD, SayToSquad
Gui, Show

Upd:
{
GuiControlGet, NLOnSay
msgbox %NLOnSay%
}</code></pre></div><p>В случае, если выбрано радио &quot;SayToAll&quot;, то &quot;NLOnSay&quot; равняется 1. Тут всё нормально.<br />Я на несколько раз прочитал про <a href="http://www.script-coding.com/AutoHotkey/GUIControls.html#radio">Radio</a>. Исходя из слов в статье:&quot;Однако если только у одной кнопки из группы есть переменная, ей будет присвоен номер выбранной в данный момент кнопки: 1 - номер первой кнопки (в порядке их создания), 2 - второй и т.д&quot;. <br />Т.е. если выбрано радио SayToTeam, то переменная NLOnSay должна содержать номер выбранного радио, т.е. равняться 2. На деле же NLOnSay содержит 0, показывая лишь состояние 1го радио. <br />Вопрос: как сделать,&nbsp; чтобы NLOnSay содеражал номер выбранного радио? или я опять плохо понял мат часть?</p><p>З.Ы. Статьи про GuiControlGet я так и не нашёл.</p>]]></content>
			<author>
				<name><![CDATA[Glebis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25766</uri>
			</author>
			<updated>2011-04-03T07:43:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=47325#p47325</id>
		</entry>
</feed>
