<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: можно ли сделать меню с перетаскиваемыми menuitem'ами?]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=10118</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10118&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: можно ли сделать меню с перетаскиваемыми menuitem'ами?».]]></description>
		<lastBuildDate>Sat, 08 Nov 2014 18:18:31 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: можно ли сделать меню с перетаскиваемыми menuitem'ами?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=88129#p88129</link>
			<description><![CDATA[<p>Хочу улучшить свой <a href="https://github.com/Drugoy/Autohotkey-scripts-.ahk/blob/master/Meta%20Shortcut/Meta%20Shortcut.ahk">скрипт</a>, добавив возможность сортировки итемов в меню простым драг&#039;н&#039;дропом, а по возможности и создание суб-меню при драг-н-дропе итема в итем.</p>]]></description>
			<author><![CDATA[null@example.com (Drugoy)]]></author>
			<pubDate>Sat, 08 Nov 2014 18:18:31 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=88129#p88129</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: можно ли сделать меню с перетаскиваемыми menuitem'ами?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=88128#p88128</link>
			<description><![CDATA[<p>Что вообще задумано? Меню контекстное, меню области уведомлений, главное меню, меню заголовка или собственное нестандартное уникальное меню?</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Sat, 08 Nov 2014 18:02:51 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=88128#p88128</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: можно ли сделать меню с перетаскиваемыми menuitem'ами?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=88123#p88123</link>
			<description><![CDATA[<p>Пример с деревом - с багом <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /><br />Баг в том, что если курсор при перетаскивании опустить далеко вниз за окно, то потом достаточно повести его совсем чуть-чуть (всё ещё не отпуская кнопку мыши), для перетаскивания вверх, хотя курсор остаётся далеко внизу под окном.<br />Делать это через позицию курсора как-то не правильно.</p><p>Ну и раз уж это дерево, то почему нельзя ветку верхнего уровня сделать под-веткой?</p><p>Пример с LV - рабочий, только кода ну уж очень много :-/</p>]]></description>
			<author><![CDATA[null@example.com (Drugoy)]]></author>
			<pubDate>Sat, 08 Nov 2014 17:03:48 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=88123#p88123</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: можно ли сделать меню с перетаскиваемыми menuitem'ами?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=88096#p88096</link>
			<description><![CDATA[<p>Кажется у нас такой темы ещё не было.<br /><a href="http://www.autohotkey.com/board/topic/10120-treeview-drag-and-drop-items/">TreeView: Drag and Drop items</a><br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;Пример с TreeView</div><div class="fancy_spoiler"><div class="codebox"><pre><code>#singleinstance force

SetTimer, TREEVIEWdragTIMER, 10
SetTimer, TREEVIEWdragTIMER, Off

Gui, Add, TreeView, gMySubroutine h195 0x200 AltSubmit 0x400
Gui, Add, Button, gMOVEdown, MOVEdown
Gui, Add, Button, gMOVEup, MOVEup

P1 := TV_Add(&quot;First parent&quot;)
P1C1 := TV_Add(&quot;Parent 1&#039;s first child&quot;, P1)  ; Specify P1 to be this item&#039;s parent.
P2 := TV_Add(&quot;Second parent&quot;)
P2C1 := TV_Add(&quot;Parent 2&#039;s first child&quot;, P2)
P2C2 := TV_Add(&quot;Parent 2&#039;s second child&quot;, P2)
P2C2C1 := TV_Add(&quot;Child 2&#039;s first child&quot;, P2C2)
P3 := TV_Add(&quot;3rd parent&quot;)
P4 := TV_Add(&quot;4th parent&quot;)
Gui, Show, ,Drag and drop experiment..  ; Show the window and its TreeView.
return

GuiEscape:
GuiClose:  ; Exit the script when the user closes the TreeView&#039;s GUI window.
ExitApp
;------------------------------------------------------------------------------
MOVEup:
TREEVIEWmoveup()
return
;------------------------------------------------------------------------------
MOVEdown:
TREEVIEWmovedown()
return
;------------------------------------------------------------------------------
MySubroutine:
If A_GuiEvent=D
{
    MouseGetPos, , OutputVarY
    SetTimer, TREEVIEWdragTIMER, On
}
return
;------------------------------------------------------------------------------
TREEVIEWdragTIMER:
OLDvalue=
;TV_Modify(A_EventInfo , &quot;Select&quot;)
GetKeyState, state, LButton, P
If state=U
{
    ;TV_Modify(A_EventInfo , &quot;Select&quot;)
    SetTimer, TREEVIEWdragTIMER, Off
    OutputVarY=
    OLDvalue=
    NEWOutputVarY=
    return
}
MouseGetPos, , NEWOutputVarY 
If NEWOutputVarY=%OutputVarY%
    return

OLDvalue:=Sub(OutputVarY, 11)
If NEWOutputVarY&lt;%OLDvalue%
{
    MouseGetPos, , OutputVarY
    TREEVIEWmoveup()
    return
}

OLDvalue:=Add(OutputVarY, 11)
If NEWOutputVarY&gt;%OLDvalue%
{
    MouseGetPos, , OutputVarY
    TREEVIEWmovedown()
    return
}
return

;////////////////////////// FUNCTIONS //////////////////////////
TREEVIEWmoveup()
{
TV_GetText(PREVitem, TV_GetPrev(TV_GetSelection()))
TV_GetText(THISitem, TV_GetSelection())
If PREVitem=
    return

; LOOPS THROUGH ITEM.. STORING THE TEXT OF CHILD ITEMS IN A STRING.. (there&#039;s gotta be a better way!!)

Loop
{
    If TV_GetChild(TV_GetSelection())=0   ; CURRENT ITEM HAS CHILD ITEMS..
        break
    TV_GetText(CHILDitem, TV_GetChild(TV_GetSelection()))
    TV_Delete(TV_GetChild(TV_GetSelection())) 
    If THISitemARRAY=
        THISitemARRAY=%CHILDitem%
    Else
        THISitemARRAY=%THISitemARRAY%|%CHILDitem%
}
Loop
{
    If TV_GetChild(TV_GetPrev(TV_GetSelection()))=0 ; CURRENT ITEM HAS CHILD ITEMS..
        break
    TV_GetText(CHILDitem, TV_GetChild(TV_GetPrev(TV_GetSelection())))
    TV_Delete(TV_GetChild(TV_GetPrev(TV_GetSelection())))
    If PREVitemARRAY=
        PREVitemARRAY=%CHILDitem%
    Else
        PREVitemARRAY=%PREVitemARRAY%|%CHILDitem%
}
If THISitemARRAY&lt;&gt;
{
    Loop, Parse, THISitemARRAY, |
        TV_Add(A_LoopField, TV_GetPrev(TV_GetSelection()))

}
If PREVitemARRAY&lt;&gt;
{
    Loop, Parse, PREVitemARRAY, |
        TV_Add(A_LoopField, TV_GetSelection())
}
TV_Modify(TV_GetSelection() , &quot;&quot;, PREVitem)
TV_Modify(TV_GetPrev(TV_GetSelection()) , &quot;Select&quot;, THISitem)
PREVitemARRAY=
THISitemARRAY=
return
}
;------------------------------------------------------------------------------
TREEVIEWmovedown()
{
TV_GetText(NEXTitem, TV_GetNext(TV_GetSelection()))
TV_GetText(THISitem, TV_GetSelection())
If NEXTitem=
    return

Loop
{
    If TV_GetChild(TV_GetSelection())=0 
        break
    TV_GetText(CHILDitem, TV_GetChild(TV_GetSelection()))
    TV_Delete(TV_GetChild(TV_GetSelection())) 
    If THISitemARRAY=
        THISitemARRAY=%CHILDitem%
    Else
        THISitemARRAY=%THISitemARRAY%|%CHILDitem%
}
Loop
{
    If TV_GetChild(TV_GetNext(TV_GetSelection()))=0 
        break
    TV_GetText(CHILDitem, TV_GetChild(TV_GetNext(TV_GetSelection())))
    TV_Delete(TV_GetChild(TV_GetNext(TV_GetSelection())))
    If NEXTitemARRAY=
        NEXTitemARRAY=%CHILDitem%
    Else
        NEXTitemARRAY=%NEXTitemARRAY%|%CHILDitem%
}
If THISitemARRAY&lt;&gt;
{
    Loop, Parse, THISitemARRAY, |
        TV_Add(A_LoopField, TV_GetNext(TV_GetSelection()))

}
If NEXTitemARRAY&lt;&gt;
{
    Loop, Parse, NEXTitemARRAY, |
        TV_Add(A_LoopField, TV_GetSelection())
}
TV_Modify(TV_GetSelection() , &quot;&quot;, NEXTitem)
TV_Modify(TV_GetNext(TV_GetSelection()) , &quot;Select&quot;, THISitem)
NEXTitemARRAY=
THISitemARRAY=
return
}
;------------------------------------------------------------------------------
Add(x, y)
{
 return x + y   ; &quot;Return&quot; expects an expression.
}
;------------------------------------------------------------------------------
Sub(x, y)
{
 return x - y   ; &quot;Return&quot; expects an expression.
}</code></pre></div></div></div><p><a href="http://www.autohotkey.com/board/topic/94364-class-lv-rows-copy-cut-paste-and-drag-listviews/">[Class] LV_Rows - Copy, Cut, Paste and Drag ListViews</a></p><p><a href="http://www.autohotkey.com/board/topic/37504-listview-drag-drop/">ListView Drag &amp; Drop</a></p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Fri, 07 Nov 2014 20:33:17 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=88096#p88096</guid>
		</item>
		<item>
			<title><![CDATA[AHK: можно ли сделать меню с перетаскиваемыми menuitem'ами?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=88061#p88061</link>
			<description><![CDATA[<p>Встроенной командой Menu, похоже, что нельзя. Но может какими-нибудь dllcall&#039;ами можно на более низком уровне это сделать?<br />На крайний случай осталась идея делать gui+listview/treeview, там вроде drag&#039;n&#039;drop поддерживается нативно.</p>]]></description>
			<author><![CDATA[null@example.com (Drugoy)]]></author>
			<pubDate>Thu, 06 Nov 2014 19:27:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=88061#p88061</guid>
		</item>
	</channel>
</rss>
