<?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=12256&amp;type=atom" />
	<updated>2016-12-27T22:11:57Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=12256</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110355#p110355" />
			<content type="html"><![CDATA[<p>Круто, спасибо.</p>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2016-12-27T22:11:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110355#p110355</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110353#p110353" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>ElemsNumber := 20
logoPath := &quot;D:\Downloads\dJ8db6A.png&quot;  ; указать путь к картинке
MainColor := &quot;F0F0F0&quot;                   ; цвет фона окна
HoverColor := &quot;BBFFFF&quot;                  ; цвет при наведении
width := 300                            ; ширина окна

Gui, Main: -Caption +ToolWindow +hwndhMainGui
Gui, Main: Color, % MainColor

Loop % ElemsNumber  {
   Gui, %A_Index%: Default
   Gui, -Caption +ToolWindow +ParentMain
   Gui, Margin, 0, 0
   Gui, Color, % MainColor
   Gui, Add, Pic, x0 y0, % logoPath
   Gui, Add, Text, x+0 yp+12, result%A_Index%
   Gui, Add, Text, xp y+0 vText, sometext%A_Index%
   if (A_Index = 1)  {
      GuiControlGet, Text, Pos
      height := TextY + TextH
   }
   Gui, Show, % &quot;NA x0 y&quot; (A_Index - 1) * height &quot; w&quot; width
}
Gui, Main: Show, % &quot;NA w&quot; width &quot; h&quot; height * ElemsNumber

OnMessage(0x200, Func(&quot;WM_MOUSEMOVE&quot;).Bind(MainColor, HoverColor, hMainGui))
OnMessage(0x201, &quot;WM_LBUTTONDOWN&quot;)
Return

WM_LBUTTONDOWN()  {
   static start := 0
   if (A_TickCount - start) &lt; 400
      Return
   MsgBox, % A_Gui       ; здесь вместо MsgBox действие при клике по элементу
   Sleep, 400
   start := A_TickCount
}

WM_MOUSEMOVE(MainColor, HoverColor, hGui)  {
   static prev := [], timer
   if (!A_Gui || A_Gui = prev[1])
      Return
   
   Gui, %A_Gui%: Color, % HoverColor
   try Gui, % prev[1] &quot; :Color&quot;, % MainColor
   prev[1] := A_Gui
   
   try SetTimer, % timer, Delete
   timer := Func(&quot;ClearColor&quot;).Bind(A_Gui, MainColor, prev, hGui)
   SetTimer, % timer, 100
}

ClearColor(nGui, MainColor, prev, hMainGui)  {
   MouseGetPos,,, hwnd
   if (hwnd = hMainGui)
      Return
   
   Gui, %nGui%: Color, % MainColor
   prev[1] := &quot;&quot;
   SetTimer,, Delete
}</code></pre></div><p>Пробовал с Progress — не получилось, при смене цвета Progress выходит на передний план.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-12-27T20:30:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110353#p110353</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110351#p110351" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> да все, на которые наводишь мышкой, когда убираешь, то цвет в дефолт.<br />П.С. А, спасибо, а то я думал глюк у меня какой-то с этим сервисом.<br /></p><div class="quotebox"><cite>ypppu пишет:</cite><blockquote><p><strong>upsi_daezium</strong>, то есть Вы хотите, чтобы фон изменялся не у всего GUI, а только прямоугольное поле под группой элементов управления?</p></blockquote></div><p>Да, вы все правильно поняли.</p>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2016-12-27T17:52:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110351#p110351</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110350#p110350" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>upsi_daezium пишет:</cite><blockquote><p>первый элемент меняет фон и цвет текста при наведении на него мышкой</p></blockquote></div><p>В смысле, нужно, чтобы все элементы меняли цвет при наведении, или только первый?</p><p>P. S. Неправильно указываете ссылку на картинку, чтобы её было видно здесь. В теге img нужно указывать не ссылку на страницу (http://imgur.com/a/xag1T), а именно на картинку (http://i.imgur.com/9v3c4Rj.png):</p><p><span class="postimg"><img src="http://i.imgur.com/9v3c4Rj.png" alt="http://i.imgur.com/9v3c4Rj.png" /></span></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-12-27T17:03:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110350#p110350</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110349#p110349" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> вот <a href="http://imgur.com/a/xB3PY">http://imgur.com/a/xB3PY</a> это лого, в последней версии я переделал в формат пнг, потому что он поддерживает полупрозрачность.<br /><span class="postimg"><img src="http://i.imgur.com/dJ8db6A.png" alt="http://i.imgur.com/dJ8db6A.png" /></span><br />А это вариант как я хочу, первый элемент меняет фон и цвет текста при наведении на него мышкой <a href="http://imgur.com/a/xag1T">http://imgur.com/a/xag1T</a>.<br /><span class="postimg"><img src="http://i.imgur.com/9v3c4Rj.png" alt="http://i.imgur.com/9v3c4Rj.png" /></span></p>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2016-12-27T16:56:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110349#p110349</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110346#p110346" />
			<content type="html"><![CDATA[<p><strong>upsi_daezium</strong>, баз наличия Logo.gif-ов эта информация бесполезна.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-12-27T14:52:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110346#p110346</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110344#p110344" />
			<content type="html"><![CDATA[<p>Вывод скрипта.<br />Обратите внимание на прозрачность у картинки первого элемента.<br /><a href="http://imgur.com/a/yUGHp">http://imgur.com/a/yUGHp</a><br /><span class="postimg"><img src="http://imgur.com/a/yUGHp" alt="http://imgur.com/a/yUGHp" /></span></p>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2016-12-27T14:39:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110344#p110344</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110342#p110342" />
			<content type="html"><![CDATA[<p><strong>upsi_daezium</strong>, то есть Вы хотите, чтобы фон изменялся не у всего GUI, а только прямоугольное поле под группой элементов управления?</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2016-12-27T14:34:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110342#p110342</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110341#p110341" />
			<content type="html"><![CDATA[<p><strong>upsi_daezium</strong>, так у меня-то этих картинок нет. Но задача ясна, могу написать свой пример без этих картинок. Либо дайте на них ссылку.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-12-27T14:33:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110341#p110341</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110339#p110339" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> извиняюсь, не знал, что у вас не откроется.<br />А вот код.<br /></p><div class="codebox"><pre><code>
   
    Gui, destroy 
    Gui, -Caption +ToolWindow -AlwaysOnTop -SysMenu
    Gui, Color, ffffff
    
    results := 20
    
    i := 0
    While i &lt; results
    {
      if i = 0 ; for first result
        {
          ; возможное решение задачи посредством прогресбара
          Gui, Add, Progress,x0 y0 w300 h20 cbbffff BackgroundFFEEFF vMyProgress
          GuiControl,, MyProgress, 50 
          
          Gui, Add, Pic,+BackgroundTrans x0 y0, Logo%i%.gif
          Gui, Add, Text,+BackgroundTrans x+0 y0 gLabel , result%i%
          Gui, Add, Text, xp y20 gLabel , sometext%i%
        }
      else if i &lt;&gt; 0
        {
          Gui, Add, Pic, x0 y+0, Logo%i%.gif
          Gui, Add, Text, x+0 yp+12  gLabel ,result%i%
          Gui, Add, Text, xp+ y+0  gLabel , sometext%i%
        }

      i := i +1
    }
    Gui, Show, NA
    
    
    
    ; press control
Label:
MsgBox, %  test
Return
</code></pre></div><p>Задача такая, нужно чтобы при наведении\снятии мышки фон у данного элемента менялся. <br />Если посмотреть код или запустить скрипт, то будет видно, что создастся список из 20 элементов, в каждом из которых содержится картинка и 2 надписи. В коде я отметил, возможную попытку решения через прогрессбар.</p>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2016-12-27T14:20:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110339#p110339</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110320#p110320" />
			<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>2016-12-27T10:17:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110320#p110320</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110292#p110292" />
			<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>2016-12-26T17:38:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110292#p110292</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110290#p110290" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>У меня показывается.</p></blockquote></div><p>У меня тоже.</p>]]></content>
			<author>
				<name><![CDATA[shiz]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26249</uri>
			</author>
			<updated>2016-12-26T17:30:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110290#p110290</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110284#p110284" />
			<content type="html"><![CDATA[<p>У меня ни в одном десктопном браузере не показывается. Вот с мобильного попробовал — загрузилось. Может, провайдер считает сайт подозрительным. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-12-26T16:21:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110284#p110284</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: GUI смена фона при наведении на элементы в блоке]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110283#p110283" />
			<content type="html"><![CDATA[<p>Странно, почему у тебя не грузится. У меня показывается.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-12-26T16:17:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110283#p110283</id>
		</entry>
</feed>
