<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Видимый переход к нужному месту в контроле Edit]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=9639&amp;type=atom" />
	<updated>2015-01-10T13:31:25Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=9639</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Видимый переход к нужному месту в контроле Edit]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=90262#p90262" />
			<content type="html"><![CDATA[<p>а как быть с программами типа текстовых редакторов с функцией wrap lines? Как получить реальный индекс строки, а не индекс её части?</p>]]></content>
			<author>
				<name><![CDATA[Drugoy]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27463</uri>
			</author>
			<updated>2015-01-10T13:31:25Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=90262#p90262</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Видимый переход к нужному месту в контроле Edit]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83244#p83244" />
			<content type="html"><![CDATA[<p>Всем спасибо, разобрался с EM_LINELENGTH, нашёл человечий перевод.<br />Пример перехода в конец нужной строки:<br /></p><div class="codebox"><pre><code>
    Row = 3
    SendMessage, 0xBB, Row - 1,,,ahk_id %hResult%    ;  EM_LINEINDEX 
    LINEINDEX := Errorlevel
    SendMessage, 0x00C1, LINEINDEX, , , ahk_id %hResult%    ;  EM_LINELENGTH
    RowEnd := Errorlevel+LINEINDEX
    PostMessage, 0x00B1, RowEnd, RowEnd, , ahk_id %hResult%    ;  EM_SETSEL 
    PostMessage, 0xB7,,,, ahk_id %hResult%    ;  EM_SCROLLCARET  
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-22T18:25:55Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83244#p83244</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Видимый переход к нужному месту в контроле Edit]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83242#p83242" />
			<content type="html"><![CDATA[<p>Укороченный вариант:<br /></p><div class="codebox"><pre><code>
Gui, Add, Edit, r10 -Wrap +HScroll vResult hwndhResult w300   
Gui, Show 

Loop   
{
    GuiControlGet, Result
    GuiControl, , Result, % Result &quot;AddText. &quot; (Mod(A_Index, 25) &lt; 15 ? &quot;&quot; : &quot;`n&quot;) 
    SendMessage, 0x0E, , , , ahk_id %hResult%    ;  WM_GETTEXTLENGTH
    PostMessage, 0x00B1, Errorlevel, Errorlevel, , ahk_id %hResult%    ;  EM_SETSEL
    PostMessage, 0xB7,,,, ahk_id %hResult%    ;  EM_SCROLLCARET 
    Sleep 100
}
Return
</code></pre></div><p>Насчёт EM_LINELENGTH всё также интересно.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-22T17:55:19Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83242#p83242</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Видимый переход к нужному месту в контроле Edit]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83235#p83235" />
			<content type="html"><![CDATA[<p>Вот только вопрос по EM_LINELENGTH, и по оптимальности решения.<br />Он что может узнать длинну только той строки, на которой каретка?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-22T14:08:36Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83235#p83235</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Видимый переход к нужному месту в контроле Edit]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83232#p83232" />
			<content type="html"><![CDATA[<p>Вроде дошло:<br /></p><div class="codebox"><pre><code>
Gui, Add, Edit, r10 -Wrap +HScroll vResult hwndhResult w300   
Gui, Show 

Loop   
{
    GuiControlGet, Result 
    GuiControl, , Result, % Result &quot;AddText. &quot; (Mod(A_Index, 25) &lt; 15 ? &quot;&quot; : &quot;`n&quot;)
    Gosub GoLastChar 
    Sleep 100
}
Return
 
     
GoLastChar:   
    ControlGet, RowCount, LineCount,,, ahk_id %hResult% 
    SendMessage, 0xBB, RowCount - 1,,,ahk_id %hResult%    ;  EM_LINEINDEX
    LINEINDEX := Errorlevel
    SendMessage, 0x00B1, LINEINDEX, LINEINDEX, , ahk_id %hResult%    ;  EM_SETSEL
    SendMessage, 0x00C1, -1, , , ahk_id %hResult%    ;  EM_LINELENGTH
    LastPos := Errorlevel + LINEINDEX
    SendMessage, 0x00B1, LastPos, LastPos, , ahk_id %hResult%    ;  EM_SETSEL
    SendMessage, 0xB7,,,, ahk_id %hResult%    ;  EM_SCROLLCARET 
    Return
</code></pre></div><p>Или так:<br /></p><div class="codebox"><pre><code>
Gui, Add, Edit, r10 -Wrap +HScroll vResult hwndhResult w300   
Gui, Show 

Loop   
{
    GuiControl, , Result, % Result &quot;AddText. &quot; (Mod(A_Index, 25) &lt; 15 ? &quot;&quot; : &quot;`n&quot;) 
    Gosub GoLastChar 
    Sleep 100
}
Return
  
GoLastChar:    
    GuiControlGet, Result
    StringReplace, Str, Result, `n, ||, 1 
    StringReplace, Str, Str, `r, ||, 1 
    LastPos := StrLen(Str) 
    SendMessage, 0x00B1, LastPos, LastPos, , ahk_id %hResult%    ;  EM_SETSEL
    SendMessage, 0xB7,,,, ahk_id %hResult%    ;  EM_SCROLLCARET 
    Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-22T14:02:52Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83232#p83232</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Видимый переход к нужному месту в контроле Edit]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=83226#p83226" />
			<content type="html"><![CDATA[<p>Покурил тему <strong>teadrinker</strong> <a href="http://forum.script-coding.com/viewtopic.php?id=2631">AHK: Переход к нужной строке в контроле Edit окна GUI</a>, но так и не соображу.<br /></p><div class="codebox"><pre><code>
Gui, Add, Edit, r10 -Wrap +HScroll vResult hwndhResult w400
Gui, Show 
Loop
{
    GuiControlGet, Result
    GuiControl, -Redraw, Result
    GuiControl, , Result, % Result &quot;AddText. &quot; (Mod(A_Index, 20) &lt; 15 ? &quot;&quot; : &quot;`n&quot;)
    SetTimer, GoLastChar, -10
    Sleep Mod(A_Index, 20) &lt; 15 ? 100 : 200
}
Return


GoLastChar:   
    PostMessage, 0x00B1, StrLen(Result)*2, StrLen(Result)*2, , ahk_id %hResult%    ;  EM_SETSEL
    SendMessage, 0xB7,,,, ahk_id %hResult%    ;  EM_SCROLLCARET 
    ControlGet, LineCount, LineCount,,, ahk_id %hResult% 
    ControlGet, CurrentCol, CurrentCol,,, ahk_id %hResult%
    SendMessage, 0xB6, CurrentCol, LineCount,, ahk_id %hResult%    ;  EM_LINESCROLL
    GuiControl, +Redraw, Result
    GuiControl, Focus, Result
    Return
</code></pre></div><p>Хочется всегда видеть каретку у последнего символа, в данном случае скролл горизонтально не перемещается, да и вертикально каретку видно не всегда. Был вариант с горизонтальным перемещением, но вертикально не работало.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-05-22T12:17:28Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=83226#p83226</id>
		</entry>
</feed>
