<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16282&amp;type=atom" />
	<updated>2021-04-24T12:53:44Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16282</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147496#p147496" />
			<content type="html"><![CDATA[<p>Новичок, которому нужно научиться, увидев новую команду, изучит её.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2021-04-24T12:53:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147496#p147496</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147495#p147495" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>__Михаил__ пишет:</cite><blockquote><p>Далее спор считаю бессмысленным.</p></blockquote></div><p>Это мощный аргумент, конечно. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Давайте, я тоже им воспользуюсь:<br />А новички знают что такое global? Я думаю нет.<br />Далее спор считаю бессмысленным.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-04-24T12:45:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147495#p147495</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147494#p147494" />
			<content type="html"><![CDATA[<p>А новички знают что такое static? Я думаю нет.<br />Далее спор считаю бессмысленным.</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2021-04-24T12:39:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147494#p147494</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147491#p147491" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>__Михаил__ пишет:</cite><blockquote><p>Глобальные переменные это в первую очередь удобно, во вторую понятно для примера новичку.</p></blockquote></div><p>А чем удобнее в сравнении со static?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-04-23T23:02:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147491#p147491</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147490#p147490" />
			<content type="html"><![CDATA[<p>Спасибо, вроде заработало:<br /></p><div class="codebox"><pre><code>Gui, +AlwaysOnTop
Gui, Add, CheckBox, x10 y15 checked0 gOnCheck, Отображать буфер обмена
Gui, Add, Edit, xp y+10 w450 h250 hwndhEdit
Gui, Show
OnClipboardChange(&quot;ShowClipboard&quot;, 0)
Return

GuiClose:
   ExitApp

ShowClipboard(type) {
   global hEdit
   static EM_SETSEL := 0xB1, EM_REPLACESEL := 0xC2
   if (type != 1) ; text
      Return
   str := Clipboard . &quot;`r`n&quot;
   SendMessage, EM_SETSEL, -2, -1,, ahk_id %hEdit%
   SendMessage, EM_REPLACESEL,, &amp;str,, ahk_id %hEdit%
}

OnCheck() {
   static t := 0
   OnClipboardChange(&quot;ShowClipboard&quot;, t := !t)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[peterverhovensky]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41360</uri>
			</author>
			<updated>2021-04-23T22:40:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147490#p147490</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147489#p147489" />
			<content type="html"><![CDATA[<p>Глобальные переменные это в первую очередь удобно, во вторую понятно для примера новичку.<br />Если программа большая - проблемы, а тут код из 26 строк.</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2021-04-23T22:37:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147489#p147489</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147488#p147488" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>peterverhovensky пишет:</cite><blockquote><p>Чтобы допускать действие в основной код, только когда у этой переменной значение 1, к примеру.</p></blockquote></div><p>Возможный подход, но в данном случае особого смысла не имеет, т. к. у чекбокса возможно всего два состояния, и при клике по нему состояние переключается на противоположное. Поэтому нам достаточно знать его изначальное состояние, чтобы после каждого переключения знать текущее.<br /><strong>__Михаил__</strong>, нет смысла переменную-переключатель делать глобальной, глобальных переменных следует избегать. Я использовал глобальную hEdit, но это только потому, что она глобальная изначально.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-04-23T22:16:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147488#p147488</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147487#p147487" />
			<content type="html"><![CDATA[<p>Я бы так сделал:</p><div class="codebox"><pre><code>Ch := 1	; Галка по умолчанию.

Gui, +AlwaysOnTop
Gui, Add, CheckBox, x10 y15 Checked%Ch% gOnCheck, Отображать буфер обмена
Gui, Add, Edit, xp y+10 w450 h250 hwndhEdit
Gui, Show
OnClipboardChange(&quot;ShowClipboard&quot;, Ch)
Return

GuiClose:
   ExitApp

ShowClipboard(type) {
   global hEdit
   static EM_SETSEL := 0xB1, EM_REPLACESEL := 0xC2
   if (type != 1) ; text
      Return
   str := Clipboard . &quot;`r`n&quot;
   SendMessage, EM_SETSEL, -2, -1,, ahk_id %hEdit%
   SendMessage, EM_REPLACESEL,, &amp;str,, ahk_id %hEdit%
}

OnCheck() {
   Global Ch
   OnClipboardChange(&quot;ShowClipboard&quot;, Ch := !Ch)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2021-04-23T22:00:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147487#p147487</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147485#p147485" />
			<content type="html"><![CDATA[<p>Чтобы допускать действие в основной код, только когда у этой переменной значение 1, к примеру.</p>]]></content>
			<author>
				<name><![CDATA[peterverhovensky]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41360</uri>
			</author>
			<updated>2021-04-23T19:01:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147485#p147485</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147484#p147484" />
			<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>2021-04-23T18:55:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147484#p147484</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147483#p147483" />
			<content type="html"><![CDATA[<p>Днем два часа пытался понять и сейчас не клеится <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />. Так и не нашел переменную, отвечающую за состояние <em>CheckBox</em>.</p>]]></content>
			<author>
				<name><![CDATA[peterverhovensky]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41360</uri>
			</author>
			<updated>2021-04-23T18:21:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147483#p147483</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147482#p147482" />
			<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>2021-04-23T17:23:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147482#p147482</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147481#p147481" />
			<content type="html"><![CDATA[<p>Да, если удалить — неотжатой появляется, но продолжает копировать в буфер. Тут же если галку поставить — не копирует буфер, и наоборот.</p>]]></content>
			<author>
				<name><![CDATA[peterverhovensky]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41360</uri>
			</author>
			<updated>2021-04-23T17:09:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147481#p147481</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147480#p147480" />
			<content type="html"><![CDATA[<p>А если удалить <em>checked</em>, у вас она не отжатой появляется?<br />Наверно файл забыли сохранить.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-04-23T14:56:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147480#p147480</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Захват буфера в GUI-окно по выбору CheckBox]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147479#p147479" />
			<content type="html"><![CDATA[<p>Никак не пойму — каким образом можно по умолчанию сделать галку отжатой? Удалял слово &quot;checked&quot;, менял на &quot;checked0&quot;, прописывал какие-то условия в коде, но не удается найти то самое <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />.</p>]]></content>
			<author>
				<name><![CDATA[peterverhovensky]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41360</uri>
			</author>
			<updated>2021-04-23T13:35:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147479#p147479</id>
		</entry>
</feed>
