<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Контекстное меню Gui Edit]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=18422&amp;type=atom" />
	<updated>2025-04-08T22:03:34Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=18422</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Контекстное меню Gui Edit]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162237#p162237" />
			<content type="html"><![CDATA[<p>Для точного перехвата ПКМ можно сделать так:</p><div class="codebox"><pre><code>OnMessage(0x204, &quot;WM_RBUTTONDOWN&quot;)	; Регистрируем обработчик сообщений для ПКМ.
Return

; Обработчик нажатия правой кнопки мыши:
WM_RBUTTONDOWN(wParam, lParam, msg, hwnd){
 Global hEdit
 If (hwnd = hEdit){
  Menu, EditMenu, Show	; Показываем своё меню.
  ;Return 0		; Подавляем стандартное меню. --Не заметил эффекта--
 }
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2025-04-08T22:03:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162237#p162237</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Контекстное меню Gui Edit]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162236#p162236" />
			<content type="html"><![CDATA[<p>АХК так устроен - необходимо активацию окна сделать и лишь затем только перехват сработает.<br />Точнее сама HotKey привязка к окну.</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2025-04-08T21:52:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162236#p162236</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Контекстное меню Gui Edit]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=162235#p162235" />
			<content type="html"><![CDATA[<p>Скрипт после запуска меняет контекстное меню для Edit, но при переключении окон и возвращении на окно Gui - возвращается контекстное меню по умолчанию. В чем причина?<br /></p><div class="codebox"><pre><code>
Gui, +AlwaysOnTop +ToolWindow hwndMainWin -dpiscale
Gui, Color, F5F5F5
Gui, Font, S11, Tahoma
Gui, Add, Edit, Limit23 w250 vn hwndhEdit

obj := {h: hEdit}
obj.f := fn := Func(&quot;SetDots&quot;).Bind(obj)
GuiControl, +g, %hEdit%, % fn

Gui, Show,, 

Gosub, LOAD_MENUS  ;!!
Gosub, LOADHOTKEYS ;!!
Return


LOADHOTKEYS:
   hotkey, IfWinActive, ahk_id %MainWin%
   hotkey, RButton, RButton_Down 
RETURN
RButton_Down:
   KeyWait, RButton
   MouseGetPos,,,, hCtrl, 2
   If (hCtrl = HEdit)
      Menu, EditMenu, Show
Return
LOAD_MENUS:
   Menu, EditMenu, Add, Вырезать, ContextCut
   Menu, EditMenu, Add, Копировать, ContextCopy
   Menu, EditMenu, Add, Вставить, ContextPaste
   Menu, EditMenu, Add, Удалить, ContextDelete
   Menu, EditMenu, Add
   Menu, EditMenu, Add, Выделить всё, ContextSelectAll
Return
ContextCut:
   ControlSend, Edit1, ^{sc2D}, ahk_id %MainWin%
return
ContextCopy:
   ControlSend, Edit1, ^{sc2E}, ahk_id %MainWin%
return
ContextPaste:
   ControlSend, Edit1, ^{sc2F}, ahk_id %MainWin%
return
ContextDelete:
   ControlSend, Edit1, {sc153}, ahk_id %MainWin%
return
ContextSelectAll:
   ControlSend, Edit1, ^{sc1E}, ahk_id %MainWin%
return

GuiClose:
   ExitApp

ButtonCopy:
   Clipboard := RegExReplace(ok,&quot;`n&quot;, &quot; &quot;)
Return

SetDots(obj)  {
   global
   GuiControl, -g, % obj.h
   GuiControlGet, num,, % obj.h
   num := StrReplace(num, &quot; &quot;)

   GuiControl,, % obj.h, % RegExReplace(num, &quot;\d(?=(\d{3})+$)&quot;, &quot;$0 &quot;)
   Send {End}
   fn := obj.f
   GuiControl, +g, % obj.h, % fn
}
return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[1srafel]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=43566</uri>
			</author>
			<updated>2025-04-08T21:37:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=162235#p162235</id>
		</entry>
</feed>
