Having trouble with this graphical mouse gesture flyout GUI

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Off Topic
Posts: 43
Joined: 07 Oct 2017, 20:57

Having trouble with this graphical mouse gesture flyout GUI

18 Jan 2018, 13:22

Hi all. So I've been wanting to create a graphical mouse gesture menu in the vein of SolidWorks' radial flyout menu and certain HUDs in video games:

Image

In this initial build, I got everything to work pretty well. It's responsive and quick, the gui reads the mouse hovers reliably and I don't have any major problems (except in design and how I approached it):

Image

Image

But the above was really just a test, I wanted to rebuild it for better function and more variety:

Image

Image

And I really like this new version, but I'm having a lot of problems with it that I didn't have in the initial build despite the coding and methods being practically identical. I'm not sure why everything works so well in the first but not in this one. For example, my mouse hover functions should be (to my knowledge) correct here yet this new gui is only accepting a single mouse hover per side. An example:

Code: Select all

; Using OnMessage(0x200,"Highlight") in Auto-Execute

Highlight(wParam, lParam, Msg)
	{
		global xPos, yPos, id, control
		MouseGetPos, xPos, yPos, id, control
	
	IfInString, control, SysListView
		{
		if (control = "SysListView323")
			Gosub, North1on
		else
			Gosub, North1off

		if (control = "SysListView324")
			Gosub, North1on
		else
			Gosub, North1off
		}
	}
Return


North1on:
	GuiControl, +Background2B2B2B, North2A
	GuiControl, +Background2B2B2B, North2B
	GuiControl, +Background%G1%, North1A
	GuiControl, +Background%G1%, North1B
	Return


North1off:
	GuiControl, +Background2B2B2B, North2A
	GuiControl, +Background2B2B2B, North2B
	GuiControl, +Background2B2B2B, North1A
	GuiControl, +Background2B2B2B, North1B
	Return
In the above, the code between these two SysListView controls (323 and 324) is identical so you'd expect them to behave identically. But they do not:

Image

SysListView324 works where 323 does not, and this is happening everywhere for me in this code -- all of these controls *should* be rigged to work, but only one control out of four on all sides works as expected and I don't understand why. Can I get some assistance here or tips for a better way to do this (SysListView controls are the only ones I can get to behave this well without any flashing) or just an extra pair of eyes to comb over this code? I really need this part of it functioning before moving on because I want to design a few other MenuTypes and will need to put conditional statements in all the mouse-over labels for determining which controls to light up, etc. Here's the newest GUI code in entirety:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance, Force


; Settings
	MenuType = Default
	DPIoffset = 300
	Count = 0
	MCount = 0
	; MToggle = U
	; mNum = 0
	CMark = 190
	bgWH = 400
	CoordMode, Mouse, Screen
	
	; BG Colors
	PanelBG = 161616
	Mask = 2B2B2C

	; RBGW Colors
	R1 = D44400
	R2 = DD6933
	R3 = E58F66

	G1 = 24EE49
	G2 = 50F16D
	G3 = 7CF592

	B1 = 5064F1
	B2 = 7383F4
	B3 = 96A2F7

	W1 = 878787
	W2 = 656565
	W3 = 444444

	N0 = 2B2B2B
	

; Gui Settings
	Gui, +LastFound -Border -Caption +Owner +AlwaysOnTop hwndGuiFLY
		Gui, Margin , 0, 0
		Gui, Color, %Mask%, %Mask%
		Gui +LastFound
		WinSet, TransColor, %Mask%
;
; Debug BG
	; Gui, Add, Picture, x0 y0 vBG, pixL2.png
;
; Listview box controls
	
	; North
		Gui, Add, Listview, x135 y45 w130 h50 Background2B2B2B +ReadOnly vNorth2A -Hdr AltSubmit
		Gui, Add, Listview, x200 y45 w65 h50 Background2B2B2B +ReadOnly vNorth2B -Hdr AltSubmit
		Gui, Add, Listview, x170 y120 w60 h35 Background2B2B2B +ReadOnly vNorth1A -Hdr AltSubmit
		Gui, Add, Listview, x200 y120 w30 h35 Background2B2B2B +ReadOnly vNorth1B -Hdr AltSubmit
	
	; Center
		Gui, Add, Listview, x%CMark% y%CMark% w20 h20 Background2B2B2B +ReadOnly vCenter -Hdr AltSubmit ; gGuiMove
	
	; South
		Gui, Add, Listview, x170 y245 w60 h35 Background2B2B2B +ReadOnly vSouth1A -Hdr AltSubmit
		Gui, Add, Listview, x200 y245 w30 h35 Background2B2B2B +ReadOnly vSouth1B -Hdr AltSubmit
		Gui, Add, Listview, x135 y305 w130 h50 Background2B2B2B +ReadOnly vSouth2A -Hdr AltSubmit
		Gui, Add, Listview, x200 y305 w65 h50 Background2B2B2B +ReadOnly vSouth2B -Hdr AltSubmit

	; West
		Gui, Add, Listview, x45 y135 w50 h130 Background2B2B2B +ReadOnly vWest2A -Hdr AltSubmit
		Gui, Add, Listview, x45 y200 w50 h65 Background2B2B2B +ReadOnly vWest2B -Hdr AltSubmit
		Gui, Add, Listview, x120 y170 w35 h60 Background2B2B2B +ReadOnly vWest1A -Hdr AltSubmit
		Gui, Add, Listview, x120 y200 w35 h30 Background2B2B2B +ReadOnly vWest1B -Hdr AltSubmit

	; East
		Gui, Add, Listview, x245 y170 w35 h60 Background2B2B2B +ReadOnly vEast1A -Hdr AltSubmit
		Gui, Add, Listview, x245 y200 w35 h30 Background2B2B2B +ReadOnly vEast1B -Hdr AltSubmit
		Gui, Add, Listview, x305 y135 w50 h130 Background2B2B2B +ReadOnly vEast2A -Hdr AltSubmit
		Gui, Add, Listview, x305 y200 w50 h65 Background2B2B2B +ReadOnly vEast2B -Hdr AltSubmit
			
;
; Debug Anno
	; Gui, Add, Picture, x0 y0 vBGanno, GuestAnno.png

; 
	OnMessage(0x200,"Highlight")
	GuiControl, Hide, Center
	Gosub, HideDupe1
	Gosub, HideDupe2
;
	Gui, Show, w%bgWH% h%bgWH% Hide Center

SetTimer, CapsLockIt, 5

; End Auto-Execute
Return


; Prevent Start Menu from activating on Windows Key
~LWin::
	WinState := "D"
	Return
~LWin Up::
	WinState := ""
	Return


; Activate GUI 
#RButton::
	; Gosub, ColorReset
	WinGet, active_id, ID, A
	WinActivate, ahk_id %active_id%
	global xPos, yPos, id, control
	MouseGetPos, xPos, yPos, id, control
	mX := xPos-DPIoffset
	mY := yPos-DPIoffset
	Gui, Show, x%mX% y%mY% w%bgWH% h%bgWH%
Return

; Hide and reset GUI
#RButton Up::
	; ToolTip
	Gosub, gGuiHide
	Gosub, ColorReset
	Return

; Shifting through profiles
#MButton::
	++MCount
	If (MCount = 1) {
		MenuType = Expand1
		Gosub, Exp1
		Gosub, Def2
	} Else If (MCount = 2) {
		MenuType = Expand2
		Gosub, Def1
		Gosub, Exp2
	} Else If (MCount = 3) {
		MenuType = Expand
		Gosub, Exp1
		Gosub, Exp2
	} Else If (MCount = 4) {
		Gosub, Debug1
		Gosub, Debug2
		MenuType = Debug
	} Else If (MCount >= 5) {
		Gosub, Def1
		Gosub, Def2
		MenuType = Default
		MCount = 0
	}
	; Tooltip %MCount%
	Return

gGuiHide:
	Gui, Show, Hide
	WinActivate, ahk_id %active_id%
	Return


; CapsLock to debug and code listviews
CapsLockIt:
		If !GetKeyState("CapsLock","T"){

		 Tooltip		 

		} Else { 

	 	 CoordMode, Mouse, Screen
	 	 ; WinGet, CList, ControlList
	 	 ; WinGet, IDalt, ID
	 	 ; Winget, CListHWND, ControlListHwnd
	 	 ; Winget, proID, PID
		 MouseGetPos, xPos, yPos, id, control
		 Tooltip %A_GuiControl%`n%MenuType%`n%control%

		} 
		Return


ColorReset:
	GuiControl, +Background2B2B2B, North1A
	GuiControl, +Background2B2B2B, North1B
	GuiControl, +Background2B2B2B, North2A
	GuiControl, +Background2B2B2B, North2B
	GuiControl, +Background2B2B2B, South1A
	GuiControl, +Background2B2B2B, South1B
	GuiControl, +Background2B2B2B, South2A
	GuiControl, +Background2B2B2B, South2B

	GuiControl, +Background2B2B2B, West1A
	GuiControl, +Background2B2B2B, West1B
	GuiControl, +Background2B2B2B, West2A
	GuiControl, +Background2B2B2B, West2B
	GuiControl, +Background2B2B2B, East1A
	GuiControl, +Background2B2B2B, East1B
	GuiControl, +Background2B2B2B, East2A
	GuiControl, +Background2B2B2B, East2B
Return

ColorFull1:
	GuiControl, +Background878787, North1A
	GuiControl, +Background878787, North1B
	GuiControl, +Background878787, South1A
	GuiControl, +Background878787, South1B
	GuiControl, +Background878787, West1A
	GuiControl, +Background878787, West1B
	GuiControl, +Background878787, East1A
	GuiControl, +Background878787, East1B
	Sleep, 100
Return

ColorFull2:
	GuiControl, +Background878787, North2A
	GuiControl, +Background878787, North2B
	GuiControl, +Background878787, South2A
	GuiControl, +Background878787, South2B
	GuiControl, +Background878787, West2A
	GuiControl, +Background878787, West2B
	GuiControl, +Background878787, East2A
	GuiControl, +Background878787, East2B
	Sleep, 100
Return


HideDupe1:
	GuiControl, Hide, North1B
	GuiControl, Hide, South1B
	GuiControl, Hide, West1B
	GuiControl, Hide, East1B
Return

HideDupe2:
	GuiControl, Hide, North2B
	GuiControl, Hide, South2B
	GuiControl, Hide, West2B
	GuiControl, Hide, East2B
Return

ShowDupe1:
	GuiControl, Show, North1B
	GuiControl, Show, South1B
	GuiControl, Show, West1B
	GuiControl, Show, East1B
Return

ShowDupe2:
	GuiControl, Show, North2B
	GuiControl, Show, South2B
	GuiControl, Show, West2B
	GuiControl, Show, East2B
Return


; Inner Rim default
Def1:
	Gosub, ColorFull1
	; Gosub, CenterOn
	GuiControl, Move, North1A, x170 y120 w60 h35
	GuiControl, Move, North1B, x200 y120 w30 h35
	GuiControl, Move, South1A, x170 y245 w60 h35
	GuiControl, Move, South1B, x200 y245 w30 h35
	GuiControl, Move, West1A, x120 y170 w35 h60
	GuiControl, Move, West1B, x120 y200 w35 h30
	GuiControl, Move, East1A, x245 y170 w35 h60
	GuiControl, Move, East1B, x245 y200 w35 h30
	Gosub, HideDupe1
	; Gosub, CenterOff
	Gosub, ColorReset
	Return

; Outer Rim default
Def2:
	; Gosub, CenterOn
	Gosub, ColorFull2
	GuiControl, Move, North2A, x135 y45 w130 h50
	GuiControl, Move, North2B, x135 y45 w130 h50
	GuiControl, Move, South2A, x135 y305 w130 h50
	GuiControl, Move, South2B, x135 y305 w130 h50
	GuiControl, Move, West2A, x45 y135 w50 h130
	GuiControl, Move, West2B, x45 y135 w50 h130
	GuiControl, Move, East2A, x305 y135 w50 h130
	GuiControl, Move, East2B, x305 y135 w50 h130
	Gosub, HideDupe2
	; Gosub, CenterOff
	Gosub, ColorReset
	Return

Exp1:
	; Gosub, CenterOn
	Gosub, ColorFull1
	GuiControl, Move, North1A, x120 y120 w60 h35
	GuiControl, Move, North1B, x220 y120 w60 h35
	GuiControl, Move, South1A, x120 y245 w60 h35
	GuiControl, Move, South1B, x220 y245 w60 h35
	GuiControl, Move, West1A, x120 y120 w35 h60
	GuiControl, Move, West1B, x120 y220 w35 h60
	GuiControl, Move, East1A, x245 y120 w35 h60
	GuiControl, Move, East1B, x245 y220 w35 h60
	Gosub, ShowDupe1
	; Gosub, CenterOff
	Gosub, ColorReset
	Return


; Outer Rim expanded
Exp2:
	; Gosub, CenterOn
	Gosub, ColorFull2
	GuiControl, Move, North2A, x45 y45 w120 h50
	GuiControl, Move, North2B, x235 y45 w120 h50
	GuiControl, Move, South2A, x45 y305 w120 h50
	GuiControl, Move, South2B, x235 y305 w120 h50
	GuiControl, Move, West2A, x45 y45 w50 h120
	GuiControl, Move, West2B, x45 y235 w50 h120
	GuiControl, Move, East2A, x305 y45 w50 h120
	GuiControl, Move, East2B, x305 y235 w50 h120
	Gosub, ShowDupe2
	; Gosub, CenterOff
	Gosub, ColorReset
	Return

Debug1:
	; Gosub, ColorFull1
	GuiControl, Move, North1A, x170 y120 w30 h35
	GuiControl, Move, North1B, x200 y120 w30 h35
	GuiControl, Move, South1A, x170 y245 w30 h35
	GuiControl, Move, South1B, x200 y245 w30 h35
	GuiControl, Move, West1A, x120 y170 w35 h30
	GuiControl, Move, West1B, x120 y200 w35 h30
	GuiControl, Move, East1A, x245 y170 w35 h30
	GuiControl, Move, East1B, x245 y200 w35 h30
	; Gosub, HideDupe1
	Gosub, ShowDupe1
	Gosub, ColorReset
	Return

Debug2:
	; Gosub, CenterOn
	GuiControl, Move, North2A, x135 y45 w65 h50
	GuiControl, Move, North2B, x200 y45 w65 h50
	GuiControl, Move, South2A, x135 y305 w65 h50
	GuiControl, Move, South2B, x200 y305 w65 h50
	GuiControl, Move, West2A, x45 y135 w50 h65
	GuiControl, Move, West2B, x45 y200 w50 h65
	GuiControl, Move, East2A, x305 y135 w50 h65
	GuiControl, Move, East2B, x305 y200 w50 h65
	Gosub, ShowDupe2
	; Gosub, CenterOff
	Gosub, ColorReset
	Return


; East1A:
; 		; CurrControl := RTrim(A_GuiControl, "AB")
; 		; GuiControl, +Background878787, %A_GuiControl%
; 		; Gosub, %CurrControl%
; 		GuiControl, +Background878787, %A_GuiControl%
; 	Return

CenterOn:
	GuiControl, Show, Center
	GuiControl, +Background878787, Center
	Sleep, 150
	GuiControl, +Background2B2B2B, Center
Return


CenterOff:
	GuiControl, Hide, Center
Return


North2on:
	GuiControl, +Background%G1%, North2A
	GuiControl, +Background%G1%, North2B
	GuiControl, +Background%G2%, North1A
	GuiControl, +Background%G2%, North1B
	Return


North2off:
	GuiControl, +Background2B2B2B, North2A
	GuiControl, +Background2B2B2B, North2B
	GuiControl, +Background2B2B2B, North1A
	GuiControl, +Background2B2B2B, North1B
	Return


North1on:
	GuiControl, +Background2B2B2B, North2A
	GuiControl, +Background2B2B2B, North2B
	GuiControl, +Background%G1%, North1A
	GuiControl, +Background%G1%, North1B
	Return


North1off:
	GuiControl, +Background2B2B2B, North2A
	GuiControl, +Background2B2B2B, North2B
	GuiControl, +Background2B2B2B, North1A
	GuiControl, +Background2B2B2B, North1B
	Return



South2on:
	GuiControl, +Background%W1%, South2A
	GuiControl, +Background%W1%, South2B
	GuiControl, +Background%W2%, South1A
	GuiControl, +Background%W2%, South1B
	Return


South2off:
	GuiControl, +Background2B2B2B, South2A
	GuiControl, +Background2B2B2B, South2B
	GuiControl, +Background2B2B2B, South1A
	GuiControl, +Background2B2B2B, South1B
	Return


South1on:
	GuiControl, +Background2B2B2B, South2A
	GuiControl, +Background2B2B2B, South2B
	GuiControl, +Background%W1%, South1A
	GuiControl, +Background%W1%, South1B
	Return


South1off:
	GuiControl, +Background2B2B2B, South2A
	GuiControl, +Background2B2B2B, South2B
	GuiControl, +Background2B2B2B, South1A
	GuiControl, +Background2B2B2B, South1B
	Return


West2on:
	GuiControl, +Background%R1%, West2A
	GuiControl, +Background%R1%, West2B
	GuiControl, +Background%R2%, West1A
	GuiControl, +Background%R2%, West1B
	Return


West2off:
	GuiControl, +Background2B2B2B, West2A
	GuiControl, +Background2B2B2B, West2B
	GuiControl, +Background2B2B2B, West1A
	GuiControl, +Background2B2B2B, West1B
	Return


West1on:
	GuiControl, +Background2B2B2B, West2A
	GuiControl, +Background2B2B2B, West2B
	GuiControl, +Background%R1%, West1A
	GuiControl, +Background%R1%, West1B
	Return


West1off:
	GuiControl, +Background2B2B2B, West2A
	GuiControl, +Background2B2B2B, West2B
	GuiControl, +Background2B2B2B, West1A
	GuiControl, +Background2B2B2B, West1B
	Return

East2on:
	GuiControl, +Background%B1%, East2A
	GuiControl, +Background%B1%, East2B
	GuiControl, +Background%B2%, East1A
	GuiControl, +Background%B2%, East1B
	Return


East2off:
	GuiControl, +Background2B2B2B, East2A
	GuiControl, +Background2B2B2B, East2B
	GuiControl, +Background2B2B2B, East1A
	GuiControl, +Background2B2B2B, East1B
	Return


East1on:
	GuiControl, +Background2B2B2B, East2A
	GuiControl, +Background2B2B2B, East2B
	GuiControl, +Background%B1%, East1A
	GuiControl, +Background%B1%, East1B
	Return


East1off:
	GuiControl, +Background2B2B2B, East2A
	GuiControl, +Background2B2B2B, East2B
	GuiControl, +Background2B2B2B, East1A
	GuiControl, +Background2B2B2B, East1B
	Return


; For changing color of controls on mouse hover
Highlight(wParam, lParam, Msg)
	{
		global xPos, yPos, id, control
		MouseGetPos, xPos, yPos, id, control
	
	IfInString, control, SysListView
		{
		; North to South
		if (control = "SysListView321")
			Gosub, North2on
		else
			Gosub, North2off

		if (control = "SysListView322")
			Gosub, North2on
		else
			Gosub, North2off

		if (control = "SysListView323")
			Gosub, North1on
		else
			Gosub, North1off

		if (control = "SysListView324")
			Gosub, North1on
		else
			Gosub, North1off

		if (control = "SysListView325")
			Gosub, CenterOn
		else
			Gosub, CenterOff

		if (control = "SysListView326")
			Gosub, South1on
		else
			Gosub, South1off

		if (control = "SysListView327")
			Gosub, South1on
		else
			Gosub, South1off

		if (control = "SysListView328")
			Gosub, South2on
		else
			Gosub, South2off

		if (control = "SysListView329")
			Gosub, South2on
		else
			Gosub, South2off


		if (control = "SysListView3210")
			Gosub, West2on
		else
			Gosub, West2off

		if (control = "SysListView3211")
			Gosub, West2on
		else
			Gosub, West2off

		if (control = "SysListView3212")
			Gosub, West1on
		else
			Gosub, West1off

		if (control = "SysListView3213")
			Gosub, West1on
		else
			Gosub, West1off


		if (control = "SysListView3214")
			Gosub, East1on
		else
			Gosub, East1off

		if (control = "SysListView3215")
			Gosub, East1on
		else
			Gosub, East1off

		if (control = "SysListView3216")
			Gosub, East2on
		else
			Gosub, East2off

		if (control = "SysListView3217")
			Gosub, East2on
		else
			Gosub, East2off

		}
	}
Return
And in case it makes any difference, the initial menu build (which I'm no longer working on and am only putting here for reference) is here:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance, force


; Settings
	MenuType = 1
	Count = 0
	MCount = 1
	MToggle = U
	mNum = 0
	CMark = 190
	bgWH = 400
	CoordMode, Mouse, Screen
	
	; BG Colors
	PanelBG = 161616
	Mask = 2B2B2C

	; RBGW Colors
	R1 = D44400
	R2 = DD6933
	R3 = E58F66

	G1 = 24EE49
	G2 = 50F16D
	G3 = 7CF592

	B1 = 5064F1
	B2 = 7383F4
	B3 = 96A2F7

	W1 = 878787
	W2 = 656565
	W3 = 444444

	N0 = 2B2B2B
	



; Gui Settings
	Gui, +LastFound +Border -Caption +Owner +AlwaysOnTop hwndGuiFLY
		Gui, Margin , 0, 0
		Gui, Color, %Mask%, %PanelBG%
		Gui +LastFound
		WinSet, TransColor, %Mask%
;
; Debug BG
	Gui, Add, Picture, x0 y0 vBG, pixL2.png
;
; Listview box controls
	
	; North
		Gui, Add, Listview, x100 y35 w200 h50 Background2B2B2B +ReadOnly vNorth3 -Hdr AltSubmit
		Gui, Add, Listview, x143 y98 w114 h34 Background2B2B2B +ReadOnly vNorth2 -Hdr AltSubmit
		Gui, Add, Listview, x175 y148 w50 h20 Background2B2B2B +ReadOnly vNorth1 -Hdr AltSubmit
	
	; Center
		Gui, Add, Listview, x%CMark% y%CMark% w20 h20 Background2B2B2B +ReadOnly vCenter -Hdr AltSubmit gGuiMove
	
	; South
			Gui, Add, Listview, x175 y232 w50 h20 Background2B2B2B +ReadOnly vSouth1 -Hdr AltSubmit
			Gui, Add, Listview, x143 y268 w114 h32 Background2B2B2B +ReadOnly vSouth2 -Hdr AltSubmit
		Gui, Add, Listview, x100 y315 w200 h50 Background2B2B2B +ReadOnly vSouth3 -Hdr AltSubmit
	
	; West
		Gui, Add, Listview, x35 y100 w50 h200 Background2B2B2B +ReadOnly vWest3 -Hdr AltSubmit
		Gui, Add, Listview, x98 y143 w34 h114 Background2B2B2B +ReadOnly vWest2 -Hdr AltSubmit
		Gui, Add, Listview, x148 y175 w20 h50 Background2B2B2B +ReadOnly vWest1 -Hdr AltSubmit
	; East

		Gui, Add, Listview, x232 y175 w20 h50 Background2B2B2B +ReadOnly vEast1 -Hdr AltSubmit
		Gui, Add, Listview, x268 y143 w34 h114 Background2B2B2B +ReadOnly vEast2 -Hdr AltSubmit
		Gui, Add, Listview, x315 y100 w50 h200 Background2B2B2B +ReadOnly vEast3 -Hdr AltSubmit

	
;
; Debug Anno
	Gui, Add, Picture, x0 y0 vBGanno, GuestAnno.png

; 
	OnMessage(0x200,"Highlight")
	GuiControl, Hide, Center
	GuiControl, Hide, BG
	GuiControl, Hide, BGanno
;
	Gui, Show, w%bgWH% h%bgWH% Hide Center

; End Auto-Execute
Return

; Toggle

CapsLock::
	If !GetKeyState("CapsLock","T"){

		SetCapsLockState, On

		} Else { 

		SetCapsLockState, Off

		}
Return



; Prevent Start Menu from activating on Windows Key
~LWin::
	WinState := "D"
	Return
~LWin Up::
	WinState := ""
	Return

; Activate GUI 
#RButton::
	Gosub, GuiClear
	WinGet, active_id, ID, A
	WinActivate, ahk_id %active_id%
	global mouseX, mouseY, currWin, Hover
	MouseGetPos, mouseX, mouseY, currWin, Hover
	mX := mouseX-300
	mY := mouseY-300
	Gui, Show, x%mX% y%mY% w%bgWH% h%bgWH%
Return

; Hide and reset GUI
#RButton Up::
	ToolTip
	Gosub, gGuiHide
	Return

; To Debug GUI control placement and size while coding
#MButton::
	++MCount
	If (A_PriorHotkey != A_ThisHotkey && mCount < 4) {
		Gosub, Ring%mCount%
		} Else {
			If (MCount = 0) {
				 MToggle = "D"
				 mNum = 0
				 GuiControl, Hide, BGanno
				 GuiControl, Hide, BG
		  	 } Else If (MCount = 1) {
			  	 Gosub, Ring1
			 } Else If (MCount = 2) {
				 Gosub, Ring2
			 } Else If (MCount = 3) {
				 Gosub, Ring3
			 } Else If (MCount > 3) {
				 MCount = 0
				 Gosub, GuiClear
				 GuiControl, Hide, BGanno
				 GuiControl, Hide, BG
			 }
		}
		MenuType = %MCount%
		; ToolTip %Count%`n%MCount%
		 Return


#WheelUp::
		If (A_PriorHotkey != A_ThisHotkey or A_TimeSincePriorHotkey > 300) {
			++Count
			If (Count > 3) {
				Count = -3
			} Else If (Count = 3) {
				Gosub, sNorth3
			} Else If (Count = 2) {
				Gosub, sNorth2
			} Else If (Count = 1) {
				Gosub, sNorth1
			} Else If (Count = 0) {
				Gosub, GuiClear
			} Else If (Count = -1) {
				Gosub, sSouth1
			} Else If (Count = -2) {
				Gosub, sSouth2
			} Else If (Count = -3) {
				Gosub, sSouth3
			} Else If (Count < -3) {
				Count = 3
			}
		}
		; ToolTip %Count%`n%MCount%
		Return

#WheelDown::
		If (A_PriorHotkey != A_ThisHotkey or A_TimeSincePriorHotkey > 300) {
			--Count
			If (Count > 3) {
				Count = -3
			} Else If (Count = 3) {
				Gosub, sNorth3
			} Else If (Count = 2) {
				Gosub, sNorth2
			} Else If (Count = 1) {
				Gosub, sNorth1
			} Else If (Count = 0) {
				Gosub, GuiClear
			} Else If (Count = -1) {
				Gosub, sSouth1
			} Else If (Count = -2) {
				Gosub, sSouth2
			} Else If (Count = -3) {
				Gosub, sSouth3
			} Else If (Count < -3) {
				Count = 3
			}
		}
		; ToolTip %Count%`n%MCount%
		Return





; Scroll / Mousewheel subs
; s%A_GuiControl%
sNorth3:
	GuiControl, Move, North3, x35 w330
	GuiControl, +Background%B1%, North3
	GuiControl, Move, North2, x98 w204
	GuiControl, +Background%G2%, North2
	GuiControl, Move, North1, x148 w104
	GuiControl, +Background%R3%, North1
Return

sNorth2:
	GuiControl, Move, North3, x100 y35 w200 h50
	GuiControl, +Background%N0%, North3
	;
	GuiControl, Move, North1, x148 w104
	GuiControl, +Background%R2%, North1
	GuiControl, Move, North2, x98 w204
	GuiControl, +Background%G1%, North2
	; ToolTip North2
Return

sNorth1:
	GuiControl, Move, North3, x100 y35 w200 h50
	GuiControl, Move, North2, x143 y98 w114 h34
	GuiControl, +Background%N0%, North3
	GuiControl, +Background%N0%, North2
	;
	GuiControl, Hide, Center
	GuiControl, Move, North1, x148 w104
	GuiControl, +Background%R1%, North1
	; ToolTip North1
Return

sSouth1:
	GuiControl, Move, South2, x143 y268 w114 h34
	GuiControl, Move, South3, x100 y315 w200 h50
	GuiControl, +Background%N0%, South2
	GuiControl, +Background%N0%, South3
	;
	GuiControl, Hide, Center
	GuiControl, Move, South1, x148 w104
	GuiControl, +Background%W1%, South1
	; ToolTip South1
Return

sSouth2:
	GuiControl, Move, South3, x100 y315 w200 h50
	GuiControl, +Background%N0%, South3
	;
	GuiControl, Move, South1, x148 w104
	GuiControl, +Background%W2%, South1
	GuiControl, Move, South2, x98 w204
	GuiControl, +Background%W1%, South2
	; ToolTip South2
Return

sSouth3:
	; Send, {k}
	GuiControl, Move, South1, x148 w104
	GuiControl, +Background%W3%, South1
	GuiControl, Move, South2, x98 w204
	GuiControl, +Background%W2%, South2
	GuiControl, Move, South3, x35 w330
	GuiControl, +Background%W1%, South3
	; ToolTip South3
Return





; Gesture / Mouseover subs
; g%A_GuiControl%
gNorth3:
	If (MenuType = 1) {
		GuiControl, Move, North3, x35 w330
		GuiControl, +Background%G1%, North3
		GuiControl, Move, North2, x98 w204
		GuiControl, +Background%G2%, North2
		GuiControl, Move, North1, x148 w104
		GuiControl, +Background%G3%, North1
		KeyWait, RButton
		Gosub, gGuiHide
		Gosub, GuiClear
		WinActivate, ahk_class illustrator
		Send, {F23}
		Sleep, 50
		Send, {l}
		; MsgBox %MenuType%
	} Else if (MenuType = 2) {
		GuiControl, Move, North3, x35 w330
		GuiControl, +Background%R1%, North3
		GuiControl, Move, North2, x98 w204
		GuiControl, +Background%R2%, North2
		GuiControl, Move, North1, x148 w104
		GuiControl, +Background%R3%, North1
		KeyWait, RButton
		Gosub, gGuiHide
		Gosub, GuiClear
		WinActivate, ahk_class illustrator
		MsgBox %MenuType%
	} Else if (MenuType = 3) {
		GuiControl, Move, North3, x35 w330
		GuiControl, +Background%B1%, North3
		GuiControl, Move, North2, x98 w204
		GuiControl, +Background%B2%, North2
		GuiControl, Move, North1, x148 w104
		GuiControl, +Background%B3%, North1
		KeyWait, RButton
		Gosub, gGuiHide
		Gosub, GuiClear
		WinActivate, ahk_class illustrator
		MsgBox %MenuType%
	} Else {
		GuiControl, Move, North3, x35 w330
		GuiControl, +Background%W1%, North3
		GuiControl, Move, North2, x98 w204
		GuiControl, +Background%W2%, North2
		GuiControl, Move, North1, x148 w104
		GuiControl, +Background%W3%, North1
		KeyWait, RButton
		Gosub, gGuiHide
		Gosub, GuiClear
		WinActivate, ahk_class illustrator
		MsgBox %MenuType%
	}
Return

gNorth3Lite:
	GuiControl, Move, North3, x35 w330
	GuiControl, +Background878787, North3
Return

gNorth2:
	GuiControl, Move, North1, x148 w104
	GuiControl, +Background%G2%, North1
	GuiControl, Move, North2, x98 w204
	GuiControl, +Background%G1%, North2
	; ToolTip North2
Return

gNorth1:
	GuiControl, Move, North1, x148 w104
	GuiControl, +Background%G1%, North1
	; ToolTip North1
Return

gSouth1:
	GuiControl, Move, South1, x148 w104
	GuiControl, +Background%W1%, South1
	; ToolTip South1
Return

gSouth2:
	GuiControl, Move, South1, x148 w104
	GuiControl, +Background%W2%, South1
	GuiControl, Move, South2, x98 w204
	GuiControl, +Background%W1%, South2
	; ToolTip South2
Return

gSouth3:
	GuiControl, Move, South1, x148 w104
	GuiControl, +Background%W3%, South1
	GuiControl, Move, South2, x98 w204
	GuiControl, +Background%W2%, South2
	GuiControl, Move, South3, x35 w330
	GuiControl, +Background%W1%, South3
	; ToolTip %A_GuiControl%
	; Sleep 1000
	KeyWait, RButton
	Gosub, gGuiHide
	Gosub, GuiClear
	Send, {p}
Return

gSouth3Lite:
	GuiControl, Move, South3, x35 w330
	GuiControl, +Background878787, South3
Return

gWest3:
	GuiControl, Move, West3, y35 h330
	GuiControl, +Background%R1%, West3
	GuiControl, Move, West2, y98 h204
	GuiControl, +Background%R2%, West2
	GuiControl, Move, West1, y148 h104
	GuiControl, +Background%R3%, West1
	; ToolTip %A_GuiControl%
	; Sleep 1000
	KeyWait, RButton
	Gosub, gGuiHide
	Gosub, GuiClear
	Send, {F22}
	Sleep, 50
	Send, {m}
Return

gWest2:
	GuiControl, Move, West1, y148 h104
	GuiControl, +Background%R2%, West1
	GuiControl, Move, West2, y98 h204
	GuiControl, +Background%R1%, West2
	; ToolTip West2
Return

gWest1:
	GuiControl, Move, West1, y148 h104
	GuiControl, +Background878787, West1
	; ToolTip West1
Return

gEast1:
	GuiControl, Move, East1, y148 h104
	GuiControl, +Background%B1%, East1
	; ToolTip East1
Return

gEast2:
	GuiControl, Move, East2, y98 h204
	GuiControl, +Background%B1%, East2
	GuiControl, Move, East1, y148 h104
	GuiControl, +Background%B2%, East1
	; ToolTip East2
Return

gEast3:
	GuiControl, Move, East3, y35 h330
	GuiControl, +Background%B1%, East3
	GuiControl, Move, East2, y98 h204
	GuiControl, +Background%B2%, East2
	GuiControl, Move, East1, y148 h104
	GuiControl, +Background%B3%, East1
	; ToolTip %A_GuiControl%
	; Sleep 1000
	KeyWait, RButton
	Gosub, gGuiHide
	Gosub, GuiClear
	Send, {F24}
	Sleep, 50
	Send, {5}
Return

; Misc

GuiCenter:
	; Gosub, GuiClear
	Count = 0
	MCount = 0
	ToolTip Center
Return

gCenterLite:
	GuiControl, Show, Center
	GuiControl, +Background878787, Center
Return



; RunSubs for GUI reset, menu type and animations

Ring1:
	GuiControl, Move, North1, x148 w104
	GuiControl, Move, South1, x148 w104
	GuiControl, Move, West1, y148 h104
	GuiControl, Move, East1, y148 h104
	GuiControl, +Background878787, North1
	GuiControl, +Background878787, South1
	GuiControl, +Background878787, West1
	GuiControl, +Background878787, East1
	GuiControl, Move, North3, x100 y35 w200 h50
	GuiControl, Move, North2, x143 y98 w114 h34
	GuiControl, Move, South2, x143 y268 w114 h34
	GuiControl, Move, South3, x100 y315 w200 h50
	GuiControl, Move, West3, x35 y100 w50 h200
	GuiControl, Move, West2, x98 y143 w34 h114	
	GuiControl, Move, East2, x268 y143 w34 h114
	GuiControl, Move, East3, x315 y100 w50 h200
	GuiControl, +Background2B2B2B, North3
	GuiControl, +Background2B2B2B, North2
	GuiControl, +Background2B2B2B, South2
	GuiControl, +Background2B2B2B, South3
	GuiControl, +Background2B2B2B, West3
	GuiControl, +Background2B2B2B, West2
	GuiControl, +Background2B2B2B, East2
	GuiControl, +Background2B2B2B, East3
Return

Ring2:
	GuiControl, Move, North2, x98 w204
	GuiControl, Move, South2, x98 w204
	GuiControl, Move, West2, y98 h204
	GuiControl, Move, East2, y98 h204
	GuiControl, +Background878787, North2
	GuiControl, +Background878787, South2
	GuiControl, +Background878787, West2
	GuiControl, +Background878787, East2
	GuiControl, Move, North3, x100 y35 w200 h50
	GuiControl, Move, North1, x175 y148 w50 h20
	GuiControl, Move, South1, x175 y232 w50 h20
	GuiControl, Move, South3, x100 y315 w200 h50
	GuiControl, Move, West3, x35 y100 w50 h200
	GuiControl, Move, West1, x148 y175 w20 h50
	GuiControl, Move, East1, x232 y175 w20 h50	
	GuiControl, Move, East3, x315 y100 w50 h200
	GuiControl, +Background2B2B2B, North3
	GuiControl, +Background2B2B2B, North1
	GuiControl, +Background2B2B2B, South1
	GuiControl, +Background2B2B2B, South3
	GuiControl, +Background2B2B2B, West3
	GuiControl, +Background2B2B2B, West1
	GuiControl, +Background2B2B2B, East1
	GuiControl, +Background2B2B2B, East3
Return

Ring3:
	GuiControl, Move, North3, x35 w330
	GuiControl, Move, South3, x35 w330
	GuiControl, Move, West3, y35 h330
	GuiControl, Move, East3, y35 h330
	GuiControl, +Background878787, North3
	GuiControl, +Background878787, South3
	GuiControl, +Background878787, West3
	GuiControl, +Background878787, East3
	GuiControl, Move, North2, x143 y98 w114 h34
	GuiControl, Move, North1, x175 y148 w50 h20
	GuiControl, Move, South1, x175 y232 w50 h20
	GuiControl, Move, South2, x143 y268 w114 h34
	GuiControl, Move, West2, x98 y143 w34 h114
	GuiControl, Move, West1, x148 y175 w20 h50
	GuiControl, Move, East1, x232 y175 w20 h50	
	GuiControl, Move, East2, x268 y143 w34 h114
	GuiControl, +Background2B2B2B, North2
	GuiControl, +Background2B2B2B, North1
	GuiControl, +Background2B2B2B, South1
	GuiControl, +Background2B2B2B, South2
	GuiControl, +Background2B2B2B, West2
	GuiControl, +Background2B2B2B, West1
	GuiControl, +Background2B2B2B, East1
	GuiControl, +Background2B2B2B, East2
Return


gGuiHide:
	Gui, Show, Hide
	WinActivate, ahk_id %active_id%
	Return

GuiClear:
	; Count = 0
	mNum = 0
	GuiControl, Move, North3, x100 y35 w200 h50
	GuiControl, Move, North2, x143 y98 w114 h34
	GuiControl, Move, North1, x175 y148 w50 h20
	GuiControl, Move, South1, x175 y232 w50 h20
	GuiControl, Move, South2, x143 y268 w114 h34
	GuiControl, Move, South3, x100 y315 w200 h50
	GuiControl, Move, West3, x35 y100 w50 h200
	GuiControl, Move, West2, x98 y143 w34 h114
	GuiControl, Move, West1, x148 y175 w20 h50
	GuiControl, Move, East1, x232 y175 w20 h50	
	GuiControl, Move, East2, x268 y143 w34 h114
	GuiControl, Move, East3, x315 y100 w50 h200
	GuiControl, +Background2B2B2B, North3
	GuiControl, +Background2B2B2B, North2
	GuiControl, +Background2B2B2B, North1
	GuiControl, +Background2B2B2B, South1
	GuiControl, +Background2B2B2B, South2
	GuiControl, +Background2B2B2B, South3
	GuiControl, +Background2B2B2B, West3
	GuiControl, +Background2B2B2B, West2
	GuiControl, +Background2B2B2B, West1
	GuiControl, +Background2B2B2B, East1
	GuiControl, +Background2B2B2B, East2
	GuiControl, +Background2B2B2B, East3
	Return

; For changing color of controls on mouse hover
Highlight(wParam, lParam, Msg)
	{
		global mouseX, mouseY, currWin, Hover
		MouseGetPos, mouseX, mouseY, currWin, Hover
	
	IfInString, Hover, SysListView
		{
		; North to South
		if (Hover = "SysListView321")
			Gosub, g%A_GuiControl%
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%

		if (Hover = "SysListView322")
			Gosub, g%A_GuiControl%
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%

		if (Hover = "SysListView323" && MToggle != "D")
			Gosub, g%A_GuiControl%
		if (Hover = "SysListView323" && MToggle = "D")
			Gosub, Ring%mCount%
		else if (Hover = "SysListView322")
			Gosub, gNorth2
		else 
			GuiControl, +Background2B2B2B, %A_GuiControl%

		if (Hover = "SysListView324")
			Gosub, GuiCenter
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%

		if (Hover = "SysListView325")
			Gosub, g%A_GuiControl%
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%

		if (Hover = "SysListView326")
			Gosub, g%A_GuiControl%
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%

		if (Hover = "SysListView327") ; Center
			Gosub, g%A_GuiControl%
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%

	; West to East
		if (Hover = "SysListView328") ; Largest
			Gosub, g%A_GuiControl%
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%

		if (Hover = "SysListView329")
			Gosub, g%A_GuiControl%
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%

		if (Hover = "SysListView3210")
			Gosub, g%A_GuiControl%
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%

		if (Hover = "SysListView3211")
			Gosub, g%A_GuiControl%
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%

		if (Hover = "SysListView3212")
			Gosub, g%A_GuiControl%
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%

		if (Hover = "SysListView3213") ; Largest
			Gosub, g%A_GuiControl%
		else
			GuiControl, +Background2B2B2B, %A_GuiControl%
		}

	; IfNotInString, Hover, SysListView
		
	; 	{
	; 		GuiControl, +Background2B2B2B, North3
	; 		GuiControl, +Background2B2B2B, North2
	; 		GuiControl, +Background2B2B2B, North1
	; 		GuiControl, +Background2B2B2B, South1
	; 		GuiControl, +Background2B2B2B, South2
	; 		GuiControl, +Background2B2B2B, South3
	; 		GuiControl, +Background2B2B2B, West3
	; 		GuiControl, +Background2B2B2B, West2
	; 		GuiControl, +Background2B2B2B, West1
	; 		GuiControl, +Background2B2B2B, East1
	; 		GuiControl, +Background2B2B2B, East2
	; 		GuiControl, +Background2B2B2B, East3
	; 		GuiControl, +Background2B2B2B, Center
	; 	}
	}
Return

GuiMove:
	PostMessage, 0xA1, 2
return

Exit:
Esc::
#Esc::
ExitApp
Why does this all work in the old menu and not the new one?
User avatar
Off Topic
Posts: 43
Joined: 07 Oct 2017, 20:57

Re: Having trouble with this graphical mouse gesture flyout GUI

19 Jan 2018, 00:47

Image

Bump. I think part of this might be a redrawing error inside my code somewhere, so I've now taken out a lot of the manual refreshing, rearranged and added things, have looked it over and didn't change the North1on situation but it now works for the adjacent controls. I'm not sure why and I'm still getting strange results, half of the gui is broken so the sections that highlight the inner ring don't have functioning outer rings and vice versa. I could swear this code's identical and don't know where the problem is:

Image

So I still get deadzones for the South and East sections in the inner ring, and I've noticed that corners seem to flip to where the SysListViews overlap:

Image

I must be doing something wrong here but I can't tell what it is. I'm open to different methods if they'd be easier or more reliable than this, I just need the ability to make mouse hover hitboxes that change color (and don't flash as much as pictures). My updated script:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance, Force


; Settings
	MenuType = Default
	DPIoffset = 300
	Count = 0
	MCount = 0
	; MToggle = U
	; mNum = 0
	CMark = 190
	bgWH = 400
	CoordMode, Mouse, Screen
	
	; BG Colors
	PanelBG = 161616
	Mask = 2B2B2C

	; RBGW Colors
	R1 = D44400
	R2 = DD6933
	R3 = E58F66

	G1 = 24EE49
	G2 = 50F16D
	G3 = 7CF592

	B1 = 5064F1
	B2 = 7383F4
	B3 = 96A2F7

	W1 = 878787
	W2 = 656565
	W3 = 444444

	N0 = 2B2B2B
	
; Gui Settings
	Gui, +LastFound -Border -Caption +Owner +AlwaysOnTop hwndGuiFLY
	Gui, Margin , 0, 0
	Gui, Color, %Mask%, %Mask%
	Gui +LastFound
	WinSet, TransColor, %Mask%
	;
	; Debug BG
		; Gui, Add, Picture, x0 y0 vBG, pixL2.png
	;
	; Listview box controls
	
		; North
			Gui, Add, Listview, x135 y45 w130 h50 Background2B2B2B vNorth2A gNorth2AMsg
			Gui, Add, Listview, x200 y45 w65 h50 Background2B2B2B vNorth2B gNorth2BMsg
			Gui, Add, Listview, x170 y120 w60 h35 Background2B2B2B +ReadOnly vNorth1A -Hdr AltSubmit
			Gui, Add, Listview, x200 y120 w30 h35 Background2B2B2B +ReadOnly vNorth1B -Hdr AltSubmit
		
		; Center
			Gui, Add, Listview, x%CMark% y%CMark% w20 h20 Background2B2B2B vCenter gGuiMove
		
		; South
			Gui, Add, Listview, x170 y245 w60 h35 Background2B2B2B +ReadOnly vSouth1A -Hdr AltSubmit
			Gui, Add, Listview, x200 y245 w30 h35 Background2B2B2B +ReadOnly vSouth1B -Hdr AltSubmit
			Gui, Add, Listview, x135 y305 w130 h50 Background2B2B2B +ReadOnly vSouth2A -Hdr AltSubmit
			Gui, Add, Listview, x200 y305 w65 h50 Background2B2B2B +ReadOnly vSouth2B -Hdr AltSubmit

		; West
			Gui, Add, Listview, x45 y135 w50 h130 Background2B2B2B +ReadOnly vWest2A -Hdr AltSubmit
			Gui, Add, Listview, x45 y200 w50 h65 Background2B2B2B +ReadOnly vWest2B -Hdr AltSubmit
			Gui, Add, Listview, x120 y170 w35 h60 Background2B2B2B +ReadOnly vWest1A -Hdr AltSubmit
			Gui, Add, Listview, x120 y200 w35 h30 Background2B2B2B +ReadOnly vWest1B -Hdr AltSubmit

		; East
			Gui, Add, Listview, x245 y170 w35 h60 Background2B2B2B +ReadOnly vEast1A -Hdr AltSubmit
			Gui, Add, Listview, x245 y200 w35 h30 Background2B2B2B +ReadOnly vEast1B -Hdr AltSubmit
			Gui, Add, Listview, x305 y135 w50 h130 Background2B2B2B +ReadOnly vEast2A -Hdr AltSubmit
			Gui, Add, Listview, x305 y200 w50 h65 Background2B2B2B +ReadOnly vEast2B -Hdr AltSubmit
			
	; 
	OnMessage(0x200,"Highlight")
	GuiControl, Hide, Center
	; Gosub, HideDupe1
	; Gosub, HideDupe2
	;
	Gui, Show, w%bgWH% h%bgWH% Hide Center

SetTimer, CapsLockIt, 5

; End Auto-Execute
Return




;	// 	UX


	; Prevent Start Menu from activating on Windows Key
	~LWin::
		WinState := "D"
		Return
	~LWin Up::
		WinState := ""
		Return


	; Activate GUI 
	#RButton::
		; Gosub, ColorReset
		WinGet, active_id, ID, A
		WinActivate, ahk_id %active_id%
		global xPos, yPos, id, control
		MouseGetPos, xPos, yPos, id, control
		mX := xPos-DPIoffset
		mY := yPos-DPIoffset
		Gui, Show, x%mX% y%mY% w%bgWH% h%bgWH%
	Return

	; Hide and reset GUI
	#RButton Up::
		; ToolTip
		Gosub, gGuiHide
		; Gosub, ColorReset
		Return

	; Shifting through profiles
	#MButton::
		++MCount
		If (MCount = 1) {
			MenuType = Expand1
			Gosub, Exp1
			Gosub, Def2
		} Else If (MCount = 2) {
			MenuType = Expand2
			Gosub, Def1
			Gosub, Exp2
		} Else If (MCount = 3) {
			MenuType = Expand
			Gosub, Exp1
			Gosub, Exp2
		} Else If (MCount = 4) {
			Gosub, Debug1
			Gosub, Debug2
			MenuType = Debug
		} Else If (MCount >= 5) {
			Gosub, Def1
			Gosub, Def2
			MenuType = Default
			MCount = 0
		}
		; Tooltip %MCount%
		Return

	; CapsLock to debug and code listviews
	CapsLockIt:
			If !GetKeyState("CapsLock","T"){

			 Tooltip		 

			} Else { 

		 	 CoordMode, Mouse, Screen
		 	 ; WinGet, CList, ControlList
		 	 ; WinGet, IDalt, ID
		 	 ; Winget, CListHWND, ControlListHwnd
		 	 ; Winget, proID, PID
			 MouseGetPos, xPos, yPos, id, control
			 Tooltip %A_GuiControl%`n%MenuType%`n%control%

			} 
			Return

;	// 	GUI

	ColorReset:
		GuiControl, +Background2B2B2B, North1A
		GuiControl, +Background2B2B2B, North1B
		GuiControl, +Background2B2B2B, North2A
		GuiControl, +Background2B2B2B, North2B
		GuiControl, +Background2B2B2B, South1A
		GuiControl, +Background2B2B2B, South1B
		GuiControl, +Background2B2B2B, South2A
		GuiControl, +Background2B2B2B, South2B

		GuiControl, +Background2B2B2B, West1A
		GuiControl, +Background2B2B2B, West1B
		GuiControl, +Background2B2B2B, West2A
		GuiControl, +Background2B2B2B, West2B
		GuiControl, +Background2B2B2B, East1A
		GuiControl, +Background2B2B2B, East1B
		GuiControl, +Background2B2B2B, East2A
		GuiControl, +Background2B2B2B, East2B
	Return

	ColorFull1:
		GuiControl, +Background878787, North1A
		GuiControl, +Background878787, North1B
		GuiControl, +Background878787, South1A
		GuiControl, +Background878787, South1B
		GuiControl, +Background878787, West1A
		GuiControl, +Background878787, West1B
		GuiControl, +Background878787, East1A
		GuiControl, +Background878787, East1B
		Sleep, 100
	Return

	ColorFull2:
		GuiControl, +Background878787, North2A
		GuiControl, +Background878787, North2B
		GuiControl, +Background878787, South2A
		GuiControl, +Background878787, South2B
		GuiControl, +Background878787, West2A
		GuiControl, +Background878787, West2B
		GuiControl, +Background878787, East2A
		GuiControl, +Background878787, East2B
		Sleep, 100
	Return


	gGuiHide:
		Gui, Show, Hide
		WinActivate, ahk_id %active_id%
		Return

	HideDupe1:
		GuiControl, Hide, North1B
		GuiControl, Hide, South1B
		GuiControl, Hide, West1B
		GuiControl, Hide, East1B
	Return

	HideDupe2:
		GuiControl, Hide, North2B
		GuiControl, Hide, South2B
		GuiControl, Hide, West2B
		GuiControl, Hide, East2B
	Return

	ShowDupe1:
		GuiControl, Show, North1B
		GuiControl, Show, South1B
		GuiControl, Show, West1B
		GuiControl, Show, East1B
	Return

	ShowDupe2:
		GuiControl, Show, North2B
		GuiControl, Show, South2B
		GuiControl, Show, West2B
		GuiControl, Show, East2B
	Return

;	// 	MENU TYPES

	; Inner Rim default
	Def1:
		Gosub, CenterOff
		Gosub, ColorFull1
		; Gosub, CenterOn
		GuiControl, Move, North1A, x170 y120 w60 h35
		GuiControl, Move, North1B, x200 y120 w30 h35
		GuiControl, Move, South1A, x170 y245 w60 h35
		GuiControl, Move, South1B, x200 y245 w30 h35
		GuiControl, Move, West1A, x120 y170 w35 h60
		GuiControl, Move, West1B, x120 y200 w35 h30
		GuiControl, Move, East1A, x245 y170 w35 h60
		GuiControl, Move, East1B, x245 y200 w35 h30
		; Gosub, HideDupe1
		; Gosub, CenterOff
		Gosub, ColorReset
		Return

	; Outer Rim default
	Def2:
		; Gosub, CenterOn
		Gosub, ColorFull2
		GuiControl, Move, North2A, x135 y45 w130 h50
		GuiControl, Move, North2B, x135 y45 w130 h50
		GuiControl, Move, South2A, x135 y305 w130 h50
		GuiControl, Move, South2B, x135 y305 w130 h50
		GuiControl, Move, West2A, x45 y135 w50 h130
		GuiControl, Move, West2B, x45 y135 w50 h130
		GuiControl, Move, East2A, x305 y135 w50 h130
		GuiControl, Move, East2B, x305 y135 w50 h130
		; Gosub, HideDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		Return

	; Inner expanded
	Exp1:
		; Gosub, CenterOn
		Gosub, ColorFull1
		GuiControl, Move, North1A, x120 y120 w60 h35
		GuiControl, Move, North1B, x220 y120 w60 h35
		GuiControl, Move, South1A, x120 y245 w60 h35
		GuiControl, Move, South1B, x220 y245 w60 h35
		GuiControl, Move, West1A, x120 y120 w35 h60
		GuiControl, Move, West1B, x120 y220 w35 h60
		GuiControl, Move, East1A, x245 y120 w35 h60
		GuiControl, Move, East1B, x245 y220 w35 h60
		; Gosub, ShowDupe1
		; Gosub, CenterOff
		Gosub, ColorReset
		Return


	; Outer Rim expanded
	Exp2:
		; Gosub, CenterOn
		Gosub, ColorFull2
		GuiControl, Move, North2A, x45 y45 w120 h50
		GuiControl, Move, North2B, x235 y45 w120 h50
		GuiControl, Move, South2A, x45 y305 w120 h50
		GuiControl, Move, South2B, x235 y305 w120 h50
		GuiControl, Move, West2A, x45 y45 w50 h120
		GuiControl, Move, West2B, x45 y235 w50 h120
		GuiControl, Move, East2A, x305 y45 w50 h120
		GuiControl, Move, East2B, x305 y235 w50 h120
		; Gosub, ShowDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		Return

	Debug1:
		 Gosub, CenterOn
		; Gosub, ColorFull1
		GuiControl, Move, North1A, x170 y120 w30 h35
		GuiControl, Move, North1B, x200 y120 w30 h35
		GuiControl, Move, South1A, x170 y245 w30 h35
		GuiControl, Move, South1B, x200 y245 w30 h35
		GuiControl, Move, West1A, x120 y170 w35 h30
		GuiControl, Move, West1B, x120 y200 w35 h30
		GuiControl, Move, East1A, x245 y170 w35 h30
		GuiControl, Move, East1B, x245 y200 w35 h30
		; Gosub, HideDupe1
		; Gosub, ShowDupe1
		Gosub, ColorReset
		Return

	Debug2:
		 ; Gosub, CenterOff
		; Gosub, CenterOn
		GuiControl, Move, North2A, x135 y45 w65 h50
		GuiControl, Move, North2B, x200 y45 w65 h50
		GuiControl, Move, South2A, x135 y305 w65 h50
		GuiControl, Move, South2B, x200 y305 w65 h50
		GuiControl, Move, West2A, x45 y135 w50 h65
		GuiControl, Move, West2B, x45 y200 w50 h65
		GuiControl, Move, East2A, x305 y135 w50 h65
		GuiControl, Move, East2B, x305 y200 w50 h65
		; Gosub, ShowDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		Return

;	// 	MENU SUBS

	CenterOn:
		GuiControl, Show, Center
		GuiControl, +Background878787, Center
		Sleep, 150
		GuiControl, +Background2B2B2B, Center
	Return


	CenterOff:
		GuiControl, Hide, Center
	Return


	North2AMsg:
		MsgBox %A_GuiControl%
		Return
		
	North2BMsg:
	Return


	North2on:
		GuiControl, +Background%G1%, North2A
		GuiControl, +Background%G1%, North2B
		GuiControl, +Background%G2%, North1A
		GuiControl, +Background%G2%, North1B
		Return


	North2off:
		GuiControl, +Background2B2B2B, North2A
		GuiControl, +Background2B2B2B, North2B
		GuiControl, +Background2B2B2B, North1A
		GuiControl, +Background2B2B2B, North1B
		Return


	North1on:
		If (A_GuiControl = "North1A") {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%R1%, North1A
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background2B2B2B, North1B
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%B1%, North1A
				GuiControl, +Background%B1%, North1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%G1%, North1A
				GuiControl, +Background%G1%, West1A
				GuiControl, +Background2B2B2B, North1B
			} Else {
				;	Debug
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			}

		} Else {

			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%R1%, North1B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background2B2B2B, North1A
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%B1%, North1A
				GuiControl, +Background%B1%, North1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%G1%, North1B
				GuiControl, +Background%G1%, East1A
				GuiControl, +Background2B2B2B, North1A
			} Else {
				;	Debug
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			}
		}
		; (MenuType = Expand || MenuType = Expand1)
	Return


	North1off:
		GuiControl, +Background2B2B2B, North2A
		GuiControl, +Background2B2B2B, North2B
		GuiControl, +Background2B2B2B, North1A
		GuiControl, +Background2B2B2B, North1B
		Return



	South2on:
		GuiControl, +Background%W1%, South2A
		GuiControl, +Background%W1%, South2B
		GuiControl, +Background%W2%, South1A
		GuiControl, +Background%W2%, South1B
		Return


	South2off:
		GuiControl, +Background2B2B2B, South2A
		GuiControl, +Background2B2B2B, South2B
		GuiControl, +Background2B2B2B, South1A
		GuiControl, +Background2B2B2B, South1B
		Return


	South1on:
		If (A_GuiControl = "South1A") {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%W1%, South1A
				GuiControl, +Background%W1%, South1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%R1%, South1A
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background2B2B2B, South1B
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%B1%, South1A
				GuiControl, +Background%B1%, South1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%G1%, South1A
				GuiControl, +Background%G1%, East1A
				GuiControl, +Background2B2B2B, South1B
			} Else {
				;	Debug
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%W1%, South1A
				GuiControl, +Background%W1%, South1B
			}

		} Else {

			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%W1%, South1A
				GuiControl, +Background%W1%, South1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%R1%, South1B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background2B2B2B, South1A
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%B1%, South1A
				GuiControl, +Background%B1%, South1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%G1%, South1B
				GuiControl, +Background%G1%, West1A
				GuiControl, +Background2B2B2B, South1A
			} Else {
				;	Debug
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%W1%, South1A
				GuiControl, +Background%W1%, South1B
			}
		}
	Return

	South1off:
		GuiControl, +Background2B2B2B, South2A
		GuiControl, +Background2B2B2B, South2B
		GuiControl, +Background2B2B2B, South1A
		GuiControl, +Background2B2B2B, South1B
		Return


	West2on:
		GuiControl, +Background%R1%, West2A
		GuiControl, +Background%R1%, West2B
		GuiControl, +Background%R2%, West1A
		GuiControl, +Background%R2%, West1B
		Return


	West2off:
		GuiControl, +Background2B2B2B, West2A
		GuiControl, +Background2B2B2B, West2B
		GuiControl, +Background2B2B2B, West1A
		GuiControl, +Background2B2B2B, West1B
		Return


	West1on:
		If (A_GuiControl = "West1A") {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background%R1%, West1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background%R1%, North1A
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background%R1%, West1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%G1%, West1A
				GuiControl, +Background%G1%, North1A
			} Else {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%W1%, West1A
				GuiControl, +Background%W1%, West1B
			}
		} Else {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background%R1%, West1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1B
				GuiControl, +Background%R1%, South1A
				GuiControl, +Background2B2B2B, West1A
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background%R1%, West1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%G1%, West1B
				GuiControl, +Background%G1%, South1A
				GuiControl, +Background2B2B2B, West1A
			} Else {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%W1%, West1A
				GuiControl, +Background%W1%, West1B
			}
		}
	Return



	West1off:
		GuiControl, +Background2B2B2B, West2A
		GuiControl, +Background2B2B2B, West2B
		GuiControl, +Background2B2B2B, West1A
		GuiControl, +Background2B2B2B, West1B
		Return

	East2on:
		GuiControl, +Background%B1%, East2A
		GuiControl, +Background%B1%, East2B
		GuiControl, +Background%B2%, East1A
		GuiControl, +Background%B2%, East1B
		Return


	East2off:
		GuiControl, +Background2B2B2B, East2A
		GuiControl, +Background2B2B2B, East2B
		GuiControl, +Background2B2B2B, East1A
		GuiControl, +Background2B2B2B, East1B
		Return


	East1on:
		If (A_GuiControl = "East1A") {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background%R1%, East1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background%R1%, North1B
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background%R1%, East1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%G1%, East1A
				GuiControl, +Background%G1%, North1B
			} Else {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%W1%, East1A
				GuiControl, +Background%W1%, East1B
			}
		} Else {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background%R1%, East1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1B
				GuiControl, +Background%R1%, South1B
				GuiControl, +Background2B2B2B, East1A
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background%R1%, East1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%G1%, East1B
				GuiControl, +Background%G1%, South1B
				GuiControl, +Background2B2B2B, East1A
			} Else {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%W1%, East1A
				GuiControl, +Background%W1%, East1B
			}
		}
	Return


	East1off:
		GuiControl, +Background2B2B2B, East2A
		GuiControl, +Background2B2B2B, East2B
		GuiControl, +Background2B2B2B, East1A
		GuiControl, +Background2B2B2B, East1B
		Return

; For changing color of controls on mouse hover
Highlight(wParam, lParam, Msg)
	{
		; global xPos, yPos, id, control
		MouseGetPos, xPos, yPos, id, control
	
	IfInString, control, SysListView
		{
			; North to South
			If (control = "SysListView321" || control = "SysListView322") {
				Gosub, North2on
			} else {
				Gosub, North2off
			}

			if (control = "SysListView323" || control = "SysListView324") {
				Gosub, North1on
			} else {
				Gosub, North1off
			}

			if (control = "SysListView326" || control = "SysListView327") {
				Gosub, South1on
			} else {
				Gosub, South1off
			}

			if (control = "SysListView328" || control = "SysListView329") {
				Gosub, South2on
			} else {
				Gosub, South2off
			}

			if (control = "SysListView3210" || control = "SysListView3211") {
				Gosub, West2on
			} else {
				Gosub, West2off
			}

			if (control = "SysListView3212" || control = "SysListView3213") {
				Gosub, West1on
			} else {
				Gosub, West1off
			}

			if (control = "SysListView3214" || control = "SysListView3215") {
				Gosub, East1on
			} else {
				Gosub, East1off
			}

			if (control = "SysListView3216" || control = "SysListView3217") {
				Gosub, East2on
			} else {
				Gosub, East2off
			}
		}

	IfNotInString, control, SysListView
		{
			GuiControl, +Background2B2B2B, North2A
			GuiControl, +Background2B2B2B, North2B
			GuiControl, +Background2B2B2B, North1A
			GuiControl, +Background2B2B2B, North1B
			GuiControl, +Background2B2B2B, South1A
			GuiControl, +Background2B2B2B, South1B
			GuiControl, +Background2B2B2B, South2A
			GuiControl, +Background2B2B2B, South2B
			GuiControl, +Background2B2B2B, West2A
			GuiControl, +Background2B2B2B, West2B
			GuiControl, +Background2B2B2B, West1A
			GuiControl, +Background2B2B2B, West1B
			GuiControl, +Background2B2B2B, East1A
			GuiControl, +Background2B2B2B, East1B
			GuiControl, +Background2B2B2B, East2A
			GuiControl, +Background2B2B2B, East2B
		}


	IfInString, control, SysHeader
		{
			; If (control = "SysHeader321" || control = "SysHeader322") {
			; 	Gosub, North2on
			; } else {
			; 	Gosub, North2off
			; }

			if (control = "SysHeader325") {
				Gosub, GuiMoveMouse
			} Else {
				Gosub, CenterOff
			}
		}

	IfNotInString, control, SysHeader
		{
			GuiControl, +Background2B2B2B, Center
		}
	}
Return

GuiMoveMouse:
	GuiControl, +Background878787, Center
	PostMessage, 0xA1, 2
	Return

GuiMove:
	PostMessage, 0xA1, 2
return

Exit:
Esc::
#Esc::
ExitApp
User avatar
Off Topic
Posts: 43
Joined: 07 Oct 2017, 20:57

Re: Having trouble with this graphical mouse gesture flyout GUI

21 Jan 2018, 14:56

Bump again.

:offtopic:

I'm still stuck with this same issue, I posted it on reddit as well and had u/radiantcabbage comment the following:
the logic in your highlight function is a problem, this needlessly evaluates alot of conditions that aren't likely to be relevant every time your script calls it. it should retain the current control, and not continue unless the pointer returns a different one, or just keep updating the control name and defer the whole thing to another function/sub entirely.

Code: Select all

OnMessage(0x200, "WM_MOUSEMOVE")
SetTimer highlight  ; some period > avg execution time, bench it

WM_MOUSEMOVE(wParam, lParam, Msg) {
    global control
    MouseGetPos, xPos, yPos, id, control

    ; we need to return *fast*, other apps are waiting
    ; defer this long ass tree of conditions to a new thread, eg. timer
}

highlight:
    classNN := ""
    if (control = classNN)
        return  ; same as last period, skip it
    else
        classNN := control
    time := a_tickcount

    if if if    ; now we can take as long as we want!

    ; dont want more queueing problems, set appropriate period above
    tooltip % (a_tickcount - time)
return
I'm guessing the execution time of this function just exceeded your ability to process the message, they won't queue if it's still running when a new one arrives. the interpreter will just drop it and stop monitoring the message, this is important because system messages < 0x312 are designated as a shared resource, you would potentially be holding up the message queue for other apps. this is also how ms decides certain messages can be intercepted (eg. input) without passing them along, if you have a good reason to do this.

I suggest to run your actual highlight conditions as a timed subroutine, see remarks for OnMessage(),
If a message arrives while its function is still running due to a previous arrival of the same message, the function will not be called again (except if MaxThreads is greater than 1); instead, the message will be treated as unmonitored. If this is undesirable, a message greater than or equal to 0x312 can be buffered until its function completes by specifying Critical as the first line of the function. Alternatively, Thread Interrupt can achieve the same thing as long as it lasts long enough for the function to finish. By contrast, a message less than 0x312 cannot be buffered by Critical or Thread Interrupt (however [in v1.0.46+] Critical may help because it checks messages less often, which gives the function more time to finish). The only way to guarantee that no such messages are missed is to ensure the function finishes in under 6 milliseconds (though this limit can be raised via Critical 30). One way to do this is to have it queue up a future thread by posting to its own script a monitored message number higher than 0x312. That message's function should use Critical as its first line to ensure that its messages are buffered.
I did as they said and replaced my OnMessage function to retrieve the name of the control and defer the actual highlighting and conditional statements to a separate subroutine that functions by a Timer, but I'm still getting the same result:

Image

I asked for clarification because I wasn't sure that I understood what they were trying to tell me and was given this in response:
that was a typo, the command should be tooltip. the tickcount measurements are for benchmarking your function, subtracting a previous time from the current tickcount will get you the elapsed time in milliseconds
But they never told me if I implemented any of it correctly and my Time / A_TickValue is always the same, I don't understand what benchmarking is (I'm assuming it's supposed to be a way to retrieved the elapsed time between actions) in this context and I can't get it to work because the values are always the same. Another user commented saying I could optimize my code and make everything 10x smaller but didn't give any examples of how to do so when I asked and these are the only responses I've gotten so far despite trying to make sure that I'm showing an effort, showing my code and showing all these visuals throughout. I still don't understand why this menu isn't working when my initial menu worked so well, I'm spending way too much time spinning my wheels on the most basic part of it (highlighting and gosub calls on mouse hover) to no avail when I'd really rather move on to manual animation and other menu types:

Image

I could really use help because I do not understand why this isn't working and I'm too new to figure everything out for myself. My current code:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance, Force


; Settings
	MenuType = Default
	DPIoffset = 300
	Count = 0
	MCount = 0
	; MToggle = U
	; mNum = 0
	CMark = 190
	bgWH = 400
	CoordMode, Mouse, Screen
	
	; BG Colors
	PanelBG = 161616
	Mask = 2B2B2C

	; RBGW Colors
	R1 = D44400
	R2 = DD6933
	R3 = E58F66

	G1 = 24EE49
	G2 = 50F16D
	G3 = 7CF592

	B1 = 5064F1
	B2 = 7383F4
	B3 = 96A2F7

	W1 = 878787
	W2 = 656565
	W3 = 444444

	N0 = 2B2B2B
	
; Gui Settings
	Gui, +LastFound -Border -Caption +Owner +AlwaysOnTop hwndGuiFLY
	Gui, Margin , 0, 0
	Gui, Color, %Mask%, %Mask%
	Gui +LastFound
	WinSet, TransColor, %Mask%
	;
	; Debug BG
		; Gui, Add, Picture, x0 y0 vBG, pixL2.png
	;
	; Listview box controls
		; North
			Gui, Add, Listview, x135 y45 w130 h50 Background2B2B2B vNorth2A gNorth2AMsg
			Gui, Add, Listview, x200 y45 w65 h50 Background2B2B2B vNorth2B gNorth2BMsg
			Gui, Add, Listview, x170 y120 w60 h35 Background2B2B2B +ReadOnly vNorth1A -Hdr AltSubmit
			Gui, Add, Listview, x200 y120 w30 h35 Background2B2B2B +ReadOnly vNorth1B -Hdr AltSubmit
		
		; Center
			Gui, Add, Listview, x%CMark% y%CMark% w20 h20 Background2B2B2B vCenter gGuiMove
		
		; South
			Gui, Add, Listview, x170 y245 w60 h35 Background2B2B2B +ReadOnly vSouth1A -Hdr AltSubmit
			Gui, Add, Listview, x200 y245 w30 h35 Background2B2B2B +ReadOnly vSouth1B -Hdr AltSubmit
			Gui, Add, Listview, x135 y305 w130 h50 Background2B2B2B +ReadOnly vSouth2A -Hdr AltSubmit
			Gui, Add, Listview, x200 y305 w65 h50 Background2B2B2B +ReadOnly vSouth2B -Hdr AltSubmit

		; West
			Gui, Add, Listview, x45 y135 w50 h130 Background2B2B2B +ReadOnly vWest2A -Hdr AltSubmit
			Gui, Add, Listview, x45 y200 w50 h65 Background2B2B2B +ReadOnly vWest2B -Hdr AltSubmit
			Gui, Add, Listview, x120 y170 w35 h60 Background2B2B2B +ReadOnly vWest1A -Hdr AltSubmit
			Gui, Add, Listview, x120 y200 w35 h30 Background2B2B2B +ReadOnly vWest1B -Hdr AltSubmit

		; East
			Gui, Add, Listview, x245 y170 w35 h60 Background2B2B2B +ReadOnly vEast1A -Hdr AltSubmit
			Gui, Add, Listview, x245 y200 w35 h30 Background2B2B2B +ReadOnly vEast1B -Hdr AltSubmit
			Gui, Add, Listview, x305 y135 w50 h130 Background2B2B2B +ReadOnly vEast2A -Hdr AltSubmit
			Gui, Add, Listview, x305 y200 w50 h65 Background2B2B2B +ReadOnly vEast2B -Hdr AltSubmit
			
	; 
	OnMessage(0x200,"WM_MOUSEMOVE")
	GuiControl, Hide, Center
	; Gosub, HideDupe1
	; Gosub, HideDupe2
	;
	Gui, Show, w%bgWH% h%bgWH% Hide Center

SetTimer, CapsLockIt, 5
SetTimer, Highlight, 20

; End Auto-Execute
Return




;	// 	UX


	; Prevent Start Menu from activating on Windows Key
	~LWin::
		WinState := "D"
		Return
	~LWin Up::
		WinState := ""
		Return


	; Activate GUI 
	#RButton::
		; Gosub, ColorReset
		WinGet, active_id, ID, A
		WinActivate, ahk_id %active_id%
		global xPos, yPos, id, control
		MouseGetPos, xPos, yPos, id, control
		mX := xPos-DPIoffset
		mY := yPos-DPIoffset
		Gui, Show, x%mX% y%mY% w%bgWH% h%bgWH%
	Return

	; Hide and reset GUI
	#RButton Up::
		; ToolTip
		Gosub, gGuiHide
		; Gosub, ColorReset
		Return

	; Shifting through profiles
	#MButton::
		++MCount
		Gosub, ColorReset
		If (MCount = 1) {
			MenuType = Expand1
			Gosub, Exp1
			Gosub, Def2
		} Else If (MCount = 2) {
			MenuType = Expand
			Gosub, Exp1
			Gosub, Exp2
		} Else If (MCount = 3) {
			MenuType = Expand2
			Gosub, Def1
			Gosub, Exp2
		} Else If (MCount = 4) {
			MenuType = BHfoldIn
			Gosub, BHfoldIn
		} Else If (MCount = 5) {
			MenuType = BHfoldOut
			Gosub, BHfoldOut
		} Else If (MCount = 6) {
			MenuType = BVfoldIn
			Gosub, BVfoldIn
		} Else If (MCount = 7) {
			MenuType = BVfoldOut
			Gosub, BVfoldOut
		} Else If (MCount = 8) {
			MenuType = CrossHV
			Gosub, CrossHV
		} Else If (MCount = 9) {
			MenuType = CrossX
			Gosub, CrossX
		} Else If (MCount = 10) {
			MenuType = Rollbox
			Gosub, Rollbox
		} Else If (MCount = 11) {
			Gosub, Debug1
			Gosub, Debug2
			MenuType = Debug
		} Else If (MCount >= 12) {
			Gosub, Def1
			Gosub, Def2
			MenuType = Default
			MCount = 0
		}
		; Tooltip %MCount%
		Return

	; CapsLock to debug and code listviews
	CapsLockIt:
			If !GetKeyState("CapsLock","T"){

			 Tooltip		 

			} Else { 

		 	 ; CoordMode, Mouse, Screen
		 	 ; WinGet, CList, ControlList
		 	 ; WinGet, IDalt, ID
		 	 ; Winget, CListHWND, ControlListHwnd
		 	 ; Winget, proID, PID
			 ; MouseGetPos, xPos, yPos, id, control
			 Tooltip %A_TickCount%`n%Time%`n%MenuType%`n%control%

			} 
			Return

;	// 	GUI

	ColorReset:
		SetTimer, GuiFollowMouse, Off
		GuiControl, +Background2B2B2B, North1A
		GuiControl, +Background2B2B2B, North1B
		GuiControl, +Background2B2B2B, North2A
		GuiControl, +Background2B2B2B, North2B
		GuiControl, +Background2B2B2B, South1A
		GuiControl, +Background2B2B2B, South1B
		GuiControl, +Background2B2B2B, South2A
		GuiControl, +Background2B2B2B, South2B

		GuiControl, +Background2B2B2B, West1A
		GuiControl, +Background2B2B2B, West1B
		GuiControl, +Background2B2B2B, West2A
		GuiControl, +Background2B2B2B, West2B
		GuiControl, +Background2B2B2B, East1A
		GuiControl, +Background2B2B2B, East1B
		GuiControl, +Background2B2B2B, East2A
		GuiControl, +Background2B2B2B, East2B
	Return

	ColorFull1:
		SetTimer, GuiFollowMouse, Off
		GuiControl, +Background878787, North1A
		GuiControl, +Background878787, North1B
		GuiControl, +Background878787, South1A
		GuiControl, +Background878787, South1B
		GuiControl, +Background878787, West1A
		GuiControl, +Background878787, West1B
		GuiControl, +Background878787, East1A
		GuiControl, +Background878787, East1B
		Sleep, 100
	Return

	ColorFull2:
		SetTimer, GuiFollowMouse, Off
		GuiControl, +Background878787, North2A
		GuiControl, +Background878787, North2B
		GuiControl, +Background878787, South2A
		GuiControl, +Background878787, South2B
		GuiControl, +Background878787, West2A
		GuiControl, +Background878787, West2B
		GuiControl, +Background878787, East2A
		GuiControl, +Background878787, East2B
		Sleep, 100
	Return


	gGuiHide:
		Gui, Show, Hide
		WinActivate, ahk_id %active_id%
		Return

	HideDupe1:
		GuiControl, Hide, North1B
		GuiControl, Hide, South1B
		GuiControl, Hide, West1B
		GuiControl, Hide, East1B
	Return

	HideDupe2:
		GuiControl, Hide, North2B
		GuiControl, Hide, South2B
		GuiControl, Hide, West2B
		GuiControl, Hide, East2B
	Return

	ShowDupe1:
		GuiControl, Show, North1B
		GuiControl, Show, South1B
		GuiControl, Show, West1B
		GuiControl, Show, East1B
	Return

	ShowDupe2:
		GuiControl, Show, North2B
		GuiControl, Show, South2B
		GuiControl, Show, West2B
		GuiControl, Show, East2B
	Return

;	// 	MENU TYPES

	; Inner Rim default
	Def1:
		SetTimer, GuiFollowMouse, -10
		Gosub, CenterOff
		Gosub, ColorFull1
		; Gosub, CenterOn
		GuiControl, Move, North1A, x170 y120 w60 h35
		GuiControl, Move, North1B, x200 y120 w30 h35
		GuiControl, Move, South1A, x170 y245 w60 h35
		GuiControl, Move, South1B, x200 y245 w30 h35
		GuiControl, Move, West1A, x120 y170 w35 h60
		GuiControl, Move, West1B, x120 y200 w35 h30
		GuiControl, Move, East1A, x245 y170 w35 h60
		GuiControl, Move, East1B, x245 y200 w35 h30
		; Gosub, HideDupe1
		; Gosub, CenterOff
		Gosub, ColorReset
		Return

	; Outer Rim default
	Def2:
		SetTimer, GuiFollowMouse, -10
		; Gosub, CenterOn
		Gosub, ColorFull2
		GuiControl, Move, North2A, x135 y45 w130 h50
		GuiControl, Move, North2B, x135 y45 w130 h50
		GuiControl, Move, South2A, x135 y305 w130 h50
		GuiControl, Move, South2B, x135 y305 w130 h50
		GuiControl, Move, West2A, x45 y135 w50 h130
		GuiControl, Move, West2B, x45 y135 w50 h130
		GuiControl, Move, East2A, x305 y135 w50 h130
		GuiControl, Move, East2B, x305 y135 w50 h130
		; Gosub, HideDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		Return

	; Inner expanded
	Exp1:
		; Gosub, CenterOn
		Gosub, ColorFull1
		GuiControl, Move, North1A, x120 y120 w60 h35
		GuiControl, Move, North1B, x220 y120 w60 h35
		GuiControl, Move, South1A, x120 y245 w60 h35
		GuiControl, Move, South1B, x220 y245 w60 h35
		GuiControl, Move, West1A, x120 y120 w35 h60
		GuiControl, Move, West1B, x120 y220 w35 h60
		GuiControl, Move, East1A, x245 y120 w35 h60
		GuiControl, Move, East1B, x245 y220 w35 h60
		; Gosub, ShowDupe1
		; Gosub, CenterOff
		Gosub, ColorReset
		Return


	; Outer Rim expanded
	Exp2:
		; Gosub, CenterOn
		Gosub, ColorFull2
		GuiControl, Move, North2A, x45 y45 w120 h50
		GuiControl, Move, North2B, x235 y45 w120 h50
		GuiControl, Move, South2A, x45 y305 w120 h50
		GuiControl, Move, South2B, x235 y305 w120 h50
		GuiControl, Move, West2A, x45 y45 w50 h120
		GuiControl, Move, West2B, x45 y235 w50 h120
		GuiControl, Move, East2A, x305 y45 w50 h120
		GuiControl, Move, East2B, x305 y235 w50 h120
		; Gosub, ShowDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		Return

	Debug1:
		 Gosub, CenterOn
		; Gosub, ColorFull1
		GuiControl, Move, North1A, x170 y120 w30 h35
		GuiControl, Move, North1B, x200 y120 w30 h35
		GuiControl, Move, South1A, x170 y245 w30 h35
		GuiControl, Move, South1B, x200 y245 w30 h35
		GuiControl, Move, West1A, x120 y170 w35 h30
		GuiControl, Move, West1B, x120 y200 w35 h30
		GuiControl, Move, East1A, x245 y170 w35 h30
		GuiControl, Move, East1B, x245 y200 w35 h30
		; Gosub, HideDupe1
		; Gosub, ShowDupe1
		Gosub, ColorReset
		Return

	Debug2:
		 ; Gosub, CenterOff
		; Gosub, CenterOn
		GuiControl, Move, North2A, x135 y45 w65 h50
		GuiControl, Move, North2B, x200 y45 w65 h50
		GuiControl, Move, South2A, x135 y305 w65 h50
		GuiControl, Move, South2B, x200 y305 w65 h50
		GuiControl, Move, West2A, x45 y135 w50 h65
		GuiControl, Move, West2B, x45 y200 w50 h65
		GuiControl, Move, East2A, x305 y135 w50 h65
		GuiControl, Move, East2B, x305 y200 w50 h65
		; Gosub, ShowDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		Return

	BVfoldOut:
		 ; Gosub, CenterOn
		Gosub, ColorFull1
		GuiControl, Move, North2A, x80 y45 w120 h50
		GuiControl, Move, North2B, x200 y45 w120 h50
		GuiControl, Move, North1A, x137 y186 w18 h10
		GuiControl, Move, North1B, x245 y186 w18 h10
		GuiControl, Move, South1A, x137 y204 w18 h10
		GuiControl, Move, South1B, x245 y204 w18 h10
		GuiControl, Move, South2A, x80 y305 w120 h50
		GuiControl, Move, South2B, x200 y305 w120 h50
		GuiControl, Move, West2A, x80 y45 w50 h120
		GuiControl, Move, West2B, x80 y235 w50 h120
		GuiControl, Move, West1A, x120 y186 w17 h10
		GuiControl, Move, West1B, x120 y204 w17 h10
		GuiControl, Move, East1A, x263 y186 w17 h10
		GuiControl, Move, East1B, x263 y204 w17 h10
		GuiControl, Move, East2A, x270 y45 w50 h120
		GuiControl, Move, East2B, x270 y235 w50 h120
		; Gosub, ShowDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		Return


	BVfoldIn:
		 ; Gosub, CenterOn
		Gosub, ColorFull1
		GuiControl, Move, North2A, x117 y95 w83 h37
		GuiControl, Move, North2B, x200 y95 w83 h37
		GuiControl, Move, North1A, x96 y186 w18 h10
		GuiControl, Move, North1B, x286 y186 w18 h10
		GuiControl, Move, South1A, x96 y204 w18 h10
		GuiControl, Move, South1B, x286 y204 w18 h10
		GuiControl, Move, South2A, x117 y268 w83 h37
		GuiControl, Move, South2B, x200 y268 w83 h37
		GuiControl, Move, West2A, x117 y132 w15 h33
		GuiControl, Move, West2B, x117 y235 w15 h33
		GuiControl, Move, West1A, x79 y186 w17 h10
		GuiControl, Move, West1B, x79 y204 w17 h10
		GuiControl, Move, East1A, x304 y186 w17 h10
		GuiControl, Move, East1B, x304 y204 w17 h10
		GuiControl, Move, East2A, x268 y132 w15 h33
		GuiControl, Move, East2B, x268 y235 w15 h33
		; Gosub, ShowDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		Return


	BHfoldIn:
		Gosub, ColorFull1
		GuiControl, Move, North2A, x132 y115 w33 h15
		GuiControl, Move, North2B, x235 y115 w33 h15
		GuiControl, Move, North1A, x186 y80 w10 h18
		GuiControl, Move, North1B, x204 y80 w10 h18
		GuiControl, Move, South1A, x186 y303 w10 h18
		GuiControl, Move, South1B, x204 y303 w10 h18
		GuiControl, Move, South2A, x132 y270 w33 h15
		GuiControl, Move, South2B, x235 y270 w33 h15
		GuiControl, Move, West2A, x95 y115 w37 h85
		GuiControl, Move, West2B, x95 y200 w37 h85
		GuiControl, Move, West1A, x186 y97 w10 h17
		GuiControl, Move, West1B, x186 y285 w10 h17
		GuiControl, Move, East1A, x204 y97 w10 h17
		GuiControl, Move, East1B, x204 y285 w10 h17
		GuiControl, Move, East2A, x268 y115 w37 h85
		GuiControl, Move, East2B, x268 y200 w37 h85
		Gosub, ColorReset
		Return

	BHfoldOut:
		Gosub, ColorFull1
		GuiControl, Move, North2A, x45 y80 w120 h50
		GuiControl, Move, North2B, x235 y80 w120 h50
		GuiControl, Move, North1A, x186 y120 w10 h18
		GuiControl, Move, North1B, x204 y120 w10 h18
		GuiControl, Move, South1A, x186 y263 w10 h18
		GuiControl, Move, South1B, x204 y263 w10 h18
		GuiControl, Move, South2A, x45 y270 w120 h50
		GuiControl, Move, South2B, x235 y270 w120 h50
		GuiControl, Move, West2A, x45 y80 w50 h120
		GuiControl, Move, West2B, x45 y200 w50 h120
		GuiControl, Move, West1A, x186 y137 w10 h17
		GuiControl, Move, West1B, x186 y245 w10 h17
		GuiControl, Move, East1A, x204 y137 w10 h17
		GuiControl, Move, East1B, x204 y245 w10 h17
		GuiControl, Move, East2A, x305 y80 w50 h120
		GuiControl, Move, East2B, x305 y200 w50 h120
		; Gosub, ShowDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		Return


	CrossHV:
		Gosub, ColorFull1
		GuiControl, Move, North2A, x186 y120 w10 h17
		GuiControl, Move, North2B, x204 y120 w10 h17
		GuiControl, Move, North1A, x186 y137 w10 h18
		GuiControl, Move, North1B, x204 y137 w10 h18
		GuiControl, Move, South1A, x186 y245 w10 h18
		GuiControl, Move, South1B, x204 y245 w10 h18
		GuiControl, Move, South2A, x186 y263 w10 h17
		GuiControl, Move, South2B, x204 y263 w10 h17
		GuiControl, Move, West2A, x120 y186 w17 h10
		GuiControl, Move, West2B, x120 y204 w17 h10
		GuiControl, Move, West1A, x137 y186 w18 h10
		GuiControl, Move, West1B, x137 y204 w18 h10
		GuiControl, Move, East1A, x245 y186 w18 h10
		GuiControl, Move, East1B, x245 y204 w18 h10
		GuiControl, Move, East2A, x263 y186 w17 h10
		GuiControl, Move, East2B, x263 y204 w17 h10
		; Gosub, ShowDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		SetTimer, GuiFollowMouse, 10
		Return

	CrossX:
		Gosub, ColorFull1
		GuiControl, Move, North2A, x230 y160 w10 h10
		GuiControl, Move, North2B, x240 y150 w10 h10
		GuiControl, Move, North1A, x210 y180 w10 h10
		GuiControl, Move, North1B, x220 y170 w10 h10
		GuiControl, Move, South1A, x180 y210 w10 h10
		GuiControl, Move, South1B, x170 y220 w10 h10
		GuiControl, Move, South2A, x160 y230 w10 h10
		GuiControl, Move, South2B, x150 y240 w10 h10
		GuiControl, Move, West2A, x160 y160 w10 h10
		GuiControl, Move, West2B, x150 y150 w10 h10
		GuiControl, Move, West1A, x180 y180 w10 h10
		GuiControl, Move, West1B, x170 y170 w10 h10
		GuiControl, Move, East1A, x210 y210 w10 h10
		GuiControl, Move, East1B, x220 y220 w10 h10
		GuiControl, Move, East2A, x230 y230 w10 h10
		GuiControl, Move, East2B, x240 y240 w10 h10
		; Gosub, ShowDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		SetTimer, GuiFollowMouse, 10
		Return


	;$
	GuiFollowMouse:
			MouseGetPos, xPos, yPos, id, control
			mX2 := xPos-DPIoffset
			mY2 := yPos-DPIoffset
			Gui, Show, x%mX2% y%mY2% w%bgWH% h%bgWH%
		Return



	Rollbox:
		Gosub, ColorFull1
		GuiControl, Move, North2A, x190 y140 w10 h10
		GuiControl, Move, North2B, x200 y140 w10 h10
		GuiControl, Move, North1A, x190 y150 w10 h10
		GuiControl, Move, North1B, x200 y150 w10 h10
		GuiControl, Move, South1A, x190 y240 w10 h10
		GuiControl, Move, South1B, x200 y240 w10 h10
		GuiControl, Move, South2A, x190 y250 w10 h10
		GuiControl, Move, South2B, x200 y250 w10 h10
		GuiControl, Move, West2A, x190 y170 w10 h10
		GuiControl, Move, West2B, x200 y170 w10 h10
		GuiControl, Move, West1A, x190 y160 w10 h10
		GuiControl, Move, West1B, x200 y160 w10 h10
		GuiControl, Move, East1A, x190 y220 w10 h10
		GuiControl, Move, East1B, x200 y220 w10 h10
		GuiControl, Move, East2A, x190 y230 w10 h10
		GuiControl, Move, East2B, x200 y230 w10 h10
		; Gosub, ShowDupe2
		; Gosub, CenterOff
		Gosub, ColorReset
		SetTimer, GuiFollowMouse, 10
		Return




;	// 	MENU SUBS

	CenterOn:
		GuiControl, Show, Center
		GuiControl, +Background878787, Center
		Sleep, 150
		GuiControl, +Background2B2B2B, Center
	Return


	CenterOff:
		GuiControl, Hide, Center
	Return


	North2AMsg:
		MsgBox %A_GuiControl%
		Return
		
	North2BMsg:
	Return


	North2on:
		GuiControl, +Background%G1%, North2A
		GuiControl, +Background%G1%, North2B
		GuiControl, +Background%G2%, North1A
		GuiControl, +Background%G2%, North1B
		Return


	North2off:
		GuiControl, +Background2B2B2B, North2A
		GuiControl, +Background2B2B2B, North2B
		GuiControl, +Background2B2B2B, North1A
		GuiControl, +Background2B2B2B, North1B
		Return


	North1on:
		If (A_GuiControl = "North1A") {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%R1%, North1A
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background2B2B2B, North1B
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%B1%, North1A
				GuiControl, +Background%B1%, North1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%G1%, North1A
				GuiControl, +Background%G1%, West1A
				GuiControl, +Background2B2B2B, North1B
			} Else {
				;	Debug
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			}

		} Else { ; this must be North1B

			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%R1%, North1B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background2B2B2B, North1A
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%B1%, North1A
				GuiControl, +Background%B1%, North1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%G1%, North1B
				GuiControl, +Background%G1%, East1A
				GuiControl, +Background2B2B2B, North1A
			} Else {
				;	Debug
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			}
		}
		; (MenuType = Expand || MenuType = Expand1)
	Return


	North1off:
		GuiControl, +Background2B2B2B, North2A
		GuiControl, +Background2B2B2B, North2B
		GuiControl, +Background2B2B2B, North1A
		GuiControl, +Background2B2B2B, North1B
		Return



	South2on:
		GuiControl, +Background%W1%, South2A
		GuiControl, +Background%W1%, South2B
		GuiControl, +Background%W2%, South1A
		GuiControl, +Background%W2%, South1B
		Return


	South2off:
		GuiControl, +Background2B2B2B, South2A
		GuiControl, +Background2B2B2B, South2B
		GuiControl, +Background2B2B2B, South1A
		GuiControl, +Background2B2B2B, South1B
		Return


	South1on:
		If (A_GuiControl = "South1A") {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%W1%, South1A
				GuiControl, +Background%W1%, South1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%R1%, South1A
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background2B2B2B, South1B
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%B1%, South1A
				GuiControl, +Background%B1%, South1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%G1%, South1A
				GuiControl, +Background%G1%, East1A
				GuiControl, +Background2B2B2B, South1B
			} Else {
				;	Debug
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%W1%, South1A
				GuiControl, +Background%W1%, South1B
			}

		} Else {

			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%W1%, South1A
				GuiControl, +Background%W1%, South1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%R1%, South1B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background2B2B2B, South1A
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%B1%, South1A
				GuiControl, +Background%B1%, South1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%G1%, South1B
				GuiControl, +Background%G1%, West1A
				GuiControl, +Background2B2B2B, South1A
			} Else {
				;	Debug
				GuiControl, +Background2B2B2B, South2A
				GuiControl, +Background2B2B2B, South2B
				GuiControl, +Background%W1%, South1A
				GuiControl, +Background%W1%, South1B
			}
		}
	Return

	South1off:
		GuiControl, +Background2B2B2B, South2A
		GuiControl, +Background2B2B2B, South2B
		GuiControl, +Background2B2B2B, South1A
		GuiControl, +Background2B2B2B, South1B
		Return


	West2on:
		GuiControl, +Background%R1%, West2A
		GuiControl, +Background%R1%, West2B
		GuiControl, +Background%R2%, West1A
		GuiControl, +Background%R2%, West1B
		Return


	West2off:
		GuiControl, +Background2B2B2B, West2A
		GuiControl, +Background2B2B2B, West2B
		GuiControl, +Background2B2B2B, West1A
		GuiControl, +Background2B2B2B, West1B
		Return


	West1on:
		If (A_GuiControl = "West1A") {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background%R1%, West1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background%R1%, North1A
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background%R1%, West1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%G1%, West1A
				GuiControl, +Background%G1%, North1A
			} Else {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%W1%, West1A
				GuiControl, +Background%W1%, West1B
			}
		} Else {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background%R1%, West1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1B
				GuiControl, +Background%R1%, South1A
				GuiControl, +Background2B2B2B, West1A
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background%R1%, West1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%G1%, West1B
				GuiControl, +Background%G1%, South1A
				GuiControl, +Background2B2B2B, West1A
			} Else {
				GuiControl, +Background2B2B2B, West2A
				GuiControl, +Background2B2B2B, West2B
				GuiControl, +Background%W1%, West1A
				GuiControl, +Background%W1%, West1B
			}
		}
	Return



	West1off:
		GuiControl, +Background2B2B2B, West2A
		GuiControl, +Background2B2B2B, West2B
		GuiControl, +Background2B2B2B, West1A
		GuiControl, +Background2B2B2B, West1B
		Return

	East2on:
		GuiControl, +Background%B1%, East2A
		GuiControl, +Background%B1%, East2B
		GuiControl, +Background%B2%, East1A
		GuiControl, +Background%B2%, East1B
		Return


	East2off:
		GuiControl, +Background2B2B2B, East2A
		GuiControl, +Background2B2B2B, East2B
		GuiControl, +Background2B2B2B, East1A
		GuiControl, +Background2B2B2B, East1B
		Return


	East1on:
		If (A_GuiControl = "East1A") {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background%R1%, East1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background%R1%, North1B
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background%R1%, East1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%G1%, East1A
				GuiControl, +Background%G1%, North1B
			} Else {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%W1%, East1A
				GuiControl, +Background%W1%, East1B
			}
		} Else {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background%R1%, East1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1B
				GuiControl, +Background%R1%, South1B
				GuiControl, +Background2B2B2B, East1A
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background%R1%, East1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%G1%, East1B
				GuiControl, +Background%G1%, South1B
				GuiControl, +Background2B2B2B, East1A
			} Else {
				GuiControl, +Background2B2B2B, East2A
				GuiControl, +Background2B2B2B, East2B
				GuiControl, +Background%W1%, East1A
				GuiControl, +Background%W1%, East1B
			}
		}
	Return


	East1off:
		GuiControl, +Background2B2B2B, East2A
		GuiControl, +Background2B2B2B, East2B
		GuiControl, +Background2B2B2B, East1A
		GuiControl, +Background2B2B2B, East1B
		Return

; For changing color of controls on mouse hover
WM_MOUSEMOVE(wParam, lParam, Msg)
		{
			LastControl := control
			++MouseCount
			global xPos, yPos, id, control
			MouseGetPos, xPos, yPos, id, control
		
		}
Return

Highlight:
			
			; If (LastControl != control) {
			; ++Change
			; Tooltip %Change%`n%MouseCount%
			
			; } Else {
			; classNN := ""
			classNN := ""
			If (control = classNN)
				Return
			Else
				classNN := control
			Time := A_TickCount

			; IfInString, control, SysListView
			; {
				If (control = "SysListView321" || control = "SysListView322") {
					Gosub, North2on
				} else {
					Gosub, North2off
				}

				if (control = "SysListView323" || control = "SysListView324") {
					Gosub, North1on
				} else {
					Gosub, North1off
				}

				if (control = "SysListView326" || control = "SysListView327") {
					Gosub, South1on
				} else {
					Gosub, South1off
				}

				if (control = "SysListView328" || control = "SysListView329") {
					Gosub, South2on
				} else {
					Gosub, South2off
				}

				if (control = "SysListView3210" || control = "SysListView3211") {
					Gosub, West2on
				} else {
					Gosub, West2off
				}

				if (control = "SysListView3212" || control = "SysListView3213") {
					Gosub, West1on
				} else {
					Gosub, West1off
				}

				if (control = "SysListView3214" || control = "SysListView3215") {
					Gosub, East1on
				} else {
					Gosub, East1off
				}

				if (control = "SysListView3216" || control = "SysListView3217") {
					Gosub, East2on
				} else {
					Gosub, East2off
				}
			; }

			; IfNotInString, control, SysListView
			; {
			; GuiControl, +Background2B2B2B, North2A
			; GuiControl, +Background2B2B2B, North2B
			; GuiControl, +Background2B2B2B, North1A
			; GuiControl, +Background2B2B2B, North1B
			; GuiControl, +Background2B2B2B, South1A
			; GuiControl, +Background2B2B2B, South1B
			; GuiControl, +Background2B2B2B, South2A
			; GuiControl, +Background2B2B2B, South2B
			; GuiControl, +Background2B2B2B, West2A
			; GuiControl, +Background2B2B2B, West2B
			; GuiControl, +Background2B2B2B, West1A
			; GuiControl, +Background2B2B2B, West1B
			; GuiControl, +Background2B2B2B, East1A
			; GuiControl, +Background2B2B2B, East1B
			; GuiControl, +Background2B2B2B, East2A
			; GuiControl, +Background2B2B2B, East2B
			; }
					

			; }
			; TimeSince := A_TickCount - Time
			; Tooltip %A_TickCount%`n%Time%`n%TimeSince%`n%MenuType%`n%TestNN%`n%id%

			; Tooltip % (A_TickCount - Time)
		Return


GuiMoveMouse:
	GuiControl, +Background878787, Center
	PostMessage, 0xA1, 2
	Return

GuiMove:
	PostMessage, 0xA1, 2
return

Exit:
Esc::
#Esc::
ExitApp
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Having trouble with this graphical mouse gesture flyout GUI

21 Jan 2018, 16:19

- I had a look at it, but it was very complicated, and thus difficult to follow.
- The code looks like it could probably be greatly simplified, e.g. wherever code repeats, try to make that into a function.
- I would recommend writing a really simple example script, and trying to get that working.
- I would also recommend commenting out lines, and seeing what happens.
- Is it just that some maths is wrong somewhere? It's odd that highlighting one bit, causes a different bit to get highlighted, that would suggest that something fundamental is wrong.
- You could add more/different text to be reported in the ToolTip, to help debugging, e.g. check the last line that was written to the log string, if the current line is different, append to the log string.
- Thanks for the example, it looked great when I tested it.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Off Topic
Posts: 43
Joined: 07 Oct 2017, 20:57

Re: Having trouble with this graphical mouse gesture flyout GUI

21 Jan 2018, 18:19

jeeswg wrote:- I had a look at it, but it was very complicated, and thus difficult to follow.
- The code looks like it could probably be greatly simplified, e.g. wherever code repeats, try to make that into a function.
- I would recommend writing a really simple example script, and trying to get that working.
- I would also recommend commenting out lines, and seeing what happens.
- Is it just that some maths is wrong somewhere? It's odd that highlighting one bit, causes a different bit to get highlighted, that would suggest that something fundamental is wrong.
- You could add more/different text to be reported in the ToolTip, to help debugging, e.g. check the last line that was written to the log string, if the current line is different, append to the log string.
- Thanks for the example, it looked great when I tested it.
Thanks jeeswg, I think it's much more redundant than it is complicated. I'm still a beginner with coding so I know I'm not doing anything complicated from a technical standpoint, I'm just doing large lists of very simple things -- most of this is just referencing x and y coordinates and width and height properties, but I don't understand how to place them into something like an array (the Docs for arrays don't seem to show an example of what I intend to do here and it's really hard to extrapolate a method without knowing where to find it or seeing others doing similar things, the Docs for Functions are huge and it's hard to find things knowing you have to do 20 minute sit-downs of reading every time going into it because I tend to get glossy-eyed in those mountains of text and personally don't learn very well through such strictly literary models) in order to extract it from within a function. I don't know how to structure either the array or the function required for that. Right now I'm stuck doing this all the only way I know how to -- through large, redundant lists where I explicitly state everything that needs to happen. I don't know how to utilize Loops to build these because the x and y parameters are always individual to the control and I don't know how to place these into something like an array and then extract the data needed (control name, x, y, w, h) in a concise way and will function with a GuiControl line, though I'd have access to all of that data very easily and I could generate lists in no time:

Image

The trouble with having an example script that's much simpler is what happened with my first menu at the very top of the page. The highlighting works perfectly there, exactly like I wanted and expected it to, but in changing the shape (despite the fact I'm using the exact same methods and code) the highlighting no longer works -- so I'm at a loss because I don't know of another way to highlight and this method *did* work for me in an example script then broke the moment I transferred it to new shapes. I don't know what to do at this point because I'm torn between spending more time becoming frustrated at something I already had working, or pressing on to make the menu even more complicated without knowing whether or not it'd ever work in the first place. I've made schematics for all the menu types and could easily do new sets (or entirely new menus) in no time:

Image

I have all the data, I just don't know what to do with it, and I can't proceed towards things like rigging it in After Effects for impressive animation easing or any of the things I made this menu specifically to test without having the main function of the menu working because that's obviously much more important than my own vanity as an animator. I keep being told that my code could be greatly simplified, but without seeing examples of how to go about doing that, I don't understand what that means or what I'm supposed to take away from passing mentions of it. Like these examples:

Code: Select all

	BHfoldIn:
		Gosub, ColorFull1
		GuiControl, Move, North2A, x132 y115 w33 h15
		GuiControl, Move, North2B, x235 y115 w33 h15
		GuiControl, Move, North1A, x186 y80 w10 h18
		GuiControl, Move, North1B, x204 y80 w10 h18
		GuiControl, Move, South1A, x186 y303 w10 h18
		GuiControl, Move, South1B, x204 y303 w10 h18
		GuiControl, Move, South2A, x132 y270 w33 h15
		GuiControl, Move, South2B, x235 y270 w33 h15
		GuiControl, Move, West2A, x95 y115 w37 h85
		GuiControl, Move, West2B, x95 y200 w37 h85
		GuiControl, Move, West1A, x186 y97 w10 h17
		GuiControl, Move, West1B, x186 y285 w10 h17
		GuiControl, Move, East1A, x204 y97 w10 h17
		GuiControl, Move, East1B, x204 y285 w10 h17
		GuiControl, Move, East2A, x268 y115 w37 h85
		GuiControl, Move, East2B, x268 y200 w37 h85
		Gosub, ColorReset
		Return
I have to do a lot of coordinate work like the above, and determine menu types like below:

Code: Select all

	; Shifting through profiles
	#MButton::
		++MCount
		Gosub, ColorReset
		If (MCount = 1) {
			MenuType = Expand1
			Gosub, Exp1
			Gosub, Def2
		} Else If (MCount = 2) {
			MenuType = Expand
			Gosub, Exp1
			Gosub, Exp2
		} Else If (MCount = 3) {
			MenuType = Expand2
			Gosub, Def1
			Gosub, Exp2
		} Else If (MCount = 4) {
			MenuType = BHfoldIn
			Gosub, BHfoldIn
		} Else If (MCount = 5) {
			MenuType = BHfoldOut
			Gosub, BHfoldOut
		} Else If (MCount = 6) {
			MenuType = BVfoldIn
			Gosub, BVfoldIn
		} Else If (MCount = 7) {
			MenuType = BVfoldOut
			Gosub, BVfoldOut
		} Else If (MCount = 8) {
			MenuType = CrossHV
			Gosub, CrossHV
		} Else If (MCount = 9) {
			MenuType = CrossX
			Gosub, CrossX
		} Else If (MCount = 10) {
			MenuType = Rollbox
			Gosub, Rollbox
		} Else If (MCount = 11) {
			Gosub, Debug1
			Gosub, Debug2
			MenuType = Debug
		} Else If (MCount >= 12) {
			Gosub, Def1
			Gosub, Def2
			MenuType = Default
			MCount = 0
		}
		; Tooltip %MCount%
		Return
If I knew of better or more concise ways of doing any of that, I'd embrace and do all the heavy lifting myself because it's going to be a pain to be explicit about all this. For controls:

Code: Select all

    North1on:
		If (A_GuiControl = "North1A") {
			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%R1%, North1A
				GuiControl, +Background%R1%, West1A
				GuiControl, +Background2B2B2B, North1B
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%B1%, North1A
				GuiControl, +Background%B1%, North1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%G1%, North1A
				GuiControl, +Background%G1%, West1A
				GuiControl, +Background2B2B2B, North1B
			} Else {
				;	Debug
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			}

		} Else { ; this must be North1B

			If (MenuType = "Default") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			} Else If (MenuType = "Expand1") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%R1%, North1B
				GuiControl, +Background%R1%, East1A
				GuiControl, +Background2B2B2B, North1A
			} Else If (MenuType = "Expand2") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%B1%, North1A
				GuiControl, +Background%B1%, North1B
			} Else If (MenuType = "Expand") {
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%G1%, North1B
				GuiControl, +Background%G1%, East1A
				GuiControl, +Background2B2B2B, North1A
			} Else {
				;	Debug
				GuiControl, +Background2B2B2B, North2A
				GuiControl, +Background2B2B2B, North2B
				GuiControl, +Background%W1%, North1A
				GuiControl, +Background%W1%, North1B
			}
		}
		; (MenuType = Expand || MenuType = Expand1)
	Return
If I were to implement the newest GUI menu shapes into the above, the code would be well over twice as long, but I don't know how to make it concise or easier to read for others or how to use something like a Loop when I have varying conditions and individual parameters for each control. I'm legitimately very new to coding, I don't really know what I'm doing here even to the extent that I don't know if I'm even asking the right questions or using the right terminology while doing so.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Having trouble with this graphical mouse gesture flyout GUI

23 Jan 2018, 10:33

- I've done a simple script that shows some possible techniques for simplifying this type of script.
- It shows a grid of squares, depending on which square you hover over, an L-shape of 3 squares is highlighted.
- I stored the XYWH info for each control in an array, so that I could identify a control by its coordinates, however, I didn't actually use that array in the end, because I could identify each control by its ClassNN.

Code: Select all

;4x6 grid, highlight 3-square L-shapes
#SingleInstance force

oArray := {}
vPosX := 0, vPosY := 0
vPosW := 100, vPosH := 100
vCountW := 6, vCountH := 4
vColDark := "2B2B2B"

vX := vPosX - vPosW
Loop, % vCountW
{
	vX += vPosW
	vY := vPosY - vPosH
	Loop, % vCountH
	{
		vY += vPosH
		oArray.Push([vX, vY, vPosW, vPosH])
	}
}

OnMessage(0x200, "Highlight")

Gui, +LastFound -Border -Caption +Owner +AlwaysOnTop hwndGuiFLY
Gui, Margin, 0, 0
Loop, % oArray.Length()
{
	vCoords := Format("x{} y{} w{} h{}", oArray[A_Index]*)
	Gui, Add, Listview, % vCoords " Background" vColDark " +ReadOnly -Hdr"
}
Gui, Show, x100 y100
return

;==================================================

;note: the borders 'look funny' for certain controls,
;if the mouse is over those controls
;at the moment that the GUI is first drawn

;note: this script does not remove the highlight
;when the cursor hovers off the GUI,
;because it only gets notified when
;the cursor hovers over the GUI
Highlight(wParam, lParam, Msg)
{
	;1 5 9  13 17 21
	;2 6 10 14 18 22
	;3 7 11 15 19 23
	;4 8 12 16 20 24
	static oSets := [[1,2,5],[6,9,10],[13,14,17],[18,21,22]
	,[3,4,7],[8,11,12],[15,16,19],[20,23,24]]

	static vCtlClassNN2, oArray := {}
	vColLight := "878787"
	vColDark := "2B2B2B"
	CoordMode, Mouse, Screen
	MouseGetPos, vCurX, vCurY, hWnd, vCtlClassNN
	if (SubStr(vCtlClassNN, 1, 13) = "SysListView32")
		vNum := SubStr(vCtlClassNN, 14)
	else
		return
	if (vNum = vNum2)
		return
	for _, oSet in oSets
	{
		vIndex := A_Index
		for _, vValue in oSet
			if (vValue = vNum)
			{
				vSet := vIndex
				break
			}
		if vSet
			break
	}
	if (vSet = vSet2)
		return
	for _, vValue in oSets[vSet]
	{
		GuiControl, % "+Background" vColLight, % "SysListView32" vValue
		oArray.Delete(vValue)
	}
	for vKey in oArray
		GuiControl, % "+Background" vColDark, % "SysListView32" vKey
	for _, vValue in oSets[vSet]
		oArray[vValue] := 1
	vNum2 := vNum, vSet2 := vSet
}

;==================================================
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Off Topic
Posts: 43
Joined: 07 Oct 2017, 20:57

Re: Having trouble with this graphical mouse gesture flyout GUI

23 Jan 2018, 13:45

Wow jeeswg, I love this script -- I'd been wanting to do something very similar to this and it's really impressive to see how it's being written here. Thank you very much! Admittedly I don't understand everything (though I do understand more than I expected to, I have trouble visualizing for loops within other for loops) in it but it's an extremely good example and has a lot that I'd been curious to see in this direct context, the way you're highlighting and building the gui itself is very interesting -- I'll need more time to really digest all of it though I can see how it is way more efficient and saves the trouble from long lists of code with hard to detect mistakes/errors. As an aside, the borders looking funny part is actually what I'm trying to achieve and would rather not have visible borders at all after every redraw/recolor, not entirely sure how yet though. I'd actually gotten my original script to work yesterday but had been trying to learn about arrays after your initial reply, the problem was a redrawing error and the Else statements in my highlighting label. I'm able to snatch data from Adobe Illustrator directly and generate that as code in the hopes that I can draw and code menus in near real time, and I'll definitely be formatting what I pick up as an array in line with what you've been showing:

Image

Loving AHK so much, lol. I rewrote the entire script (through that same Copy/Paste Programming with mountains of text method) but did get the results I wanted:

Image
Image

I'm just showing this for posterity because what you've given me today is far more useful than I expected to get and wanted to update you on it so there's no backtracking. I plan on rebuilding everything from scratch, this is just a test case. But! There's a certain part of this that I feel is too ambitious for someone who's only just starting with arrays, I wrote a much shorter script in order to practice arrays and figure out a method and I'd appreciate a look at it when you have time:

Code: Select all

	#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
	; #Warn  ; Enable warnings to assist with detecting common errors.
	SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
	SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

	#SingleInstance, force

	MenuCount	:= 0
	Mask		:= 0x2B2B2C

	global	directionA	:=	["North"
							,"South"
							,"West"
							,"East"]

		Gui, +LastFound -Caption +AlwaysOnTop hwndFlyout
		Gui, Margin , 0, 0
		Gui, Color, %Mask%, %Mask%
		Gui +LastFound
		WinSet, TransColor, %Mask%
		
		; North
		Gui, Add, Progress, x135 y45 w130 h50 Background2B2B2B vNorth2A, 0
		Gui, Add, Progress, x200 y45 w65 h50 Background2B2B2B vNorth2B , 0
		Gui, Add, Progress, x170 y120 w60 h35 Background2B2B2B vNorth1A , 0
		Gui, Add, Progress, x200 y120 w30 h35 Background2B2B2B vNorth1B , 0

		Gui, Show, w400 h400 Center

	; End Auto-Execute
	Return

	; Shifting through profiles, menu shapes and settings
	#MButton::
		++MenuCount
			If (MenuCount >= 4)
				MenuCount = 1
		Tooltip %MenuCount%
		Sleep, 100
		Gosub, Arrange%MenuCount%
	Return


	; Rollbox Expanded
	Arrange3:
		N3 := {1A:", x185 y130 w15 h15",1B:", x200 y130 w15 h15",2A:", x185 y145 w15 h15",2B:", x200 y145 w15 h15"}
		S3 := {1A:", x185 y240 w15 h15",1B:", x200 y240 w15 h15",2A:", x185 y255 w15 h15",2B:", x200 y255 w15 h15"}
		W3 := {1A:", x185 y160 w15 h15",1B:", x200 y160 w15 h15",2A:", x185 y175 w15 h15",2B:", x200 y175 w15 h15"}
		E3 := {1A:", x185 y210 w15 h15",1B:", x200 y210 w15 h15",2A:", x185 y225 w15 h15",2B:", x200 y225 w15 h15"}

			For index, value in E3
			MsgBox % "GuiControl, Move, " directionA[4] index value
			
			; All error that parameters are blank
			; GuiControl, Move, North index value
		    ; GuiControl, % " Move, " Direction[1] index value
		    ; GuiControl, Move, % Direction[1] index value
			; GuiControl, Move, % "North" index value 

		ToolTip
	Return

	; Rollbox Collapsed
	Arrange2:
		N2 := {1A:", x193 y146 w7 h7",1B:", x200 y146 w7 h7",2A:", x193 y153 w7 h7",2B:", x200 y153 w7 h7"}
		S2 := {1A:", x193 y240 w7 h7",1B:", x200 y240 w7 h7",2A:", x193 y247 w7 h7",2B:", x200 y247 w7 h7"}
		W2 := {1A:", x193 y160 w7 h7",1B:", x200 y160 w7 h7",2A:", x193 y167 w7 h7",2B:", x200 y167 w7 h7"}
		E2 := {1A:", x193 y226 w7 h7",1B:", x200 y226 w7 h7",2A:", x193 y233 w7 h7",2B:", x200 y233 w7 h7"}

			For index, value in W2 
			MsgBox % "GuiControl, Move, " directionA[3] index value

		ToolTip
	Return

	; Rollbox Default
	Arrange1:
		N1 := {1A:", x190 y140 w10 h10",1B:", x200 y140 w10 h10",2A:", x190 y150 w10 h10",2B:", x200 y150 w10 h10"}
		S1 := {1A:", x190 y240 w10 h10",1B:", x200 y240 w10 h10",2A:", x190 y250 w10 h10",2B:", x200 y250 w10 h10"}
		W1 := {1A:", x190 y160 w10 h10",1B:", x200 y160 w10 h10",2A:", x190 y170 w10 h10",2B:", x200 y170 w10 h10"}
		E1 := {1A:", x190 y220 w10 h10",1B:", x200 y220 w10 h10",2A:", x190 y230 w10 h10",2B:", x200 y230 w10 h10"}

			For index, value in N1 
			MsgBox % "GuiControl, Move, " directionA[1] index value

		ToolTip
	Return


	F20::
		N0 := {1A:", x170 y120 w30 h35",1B:", x200 y120 w30 h35",2A:", x135 y45 w65 h50",2B:", x200 y45 w65 h50"}
		S0 := {1A:", x170 y245 w30 h35",1B:", x200 y245 w30 h35",2A:", x135 y305 w65 h50",2B:", x305 y305 w65 h50"}
		W0 := {1A:", x120 y170 w35 h30",1B:", x120 y200 w35 h30",2A:", x45 y135 w50 h65",2B:", x45 y135 w50 h65"}
		E0 := {1A:", x305 y135 w35 h30",1B:", x200 y200 w35 h30",2A:", x190 y230 w50 h65",2B:", x200 y230 w50 h65"}

			For index, value in S1
			MsgBox % "GuiControl, Move, " directionA[2] index value

		ToolTip
	Return


	#Esc::
	Esc::
	ExitApp
What you've given me is much better than the above and I plan to implement a lot from it, but this was my initial guess at how I could do this kind of polygraphic flyout menu and I almost got it to work -- I was trying to make arrays with sequential numbers so that I could use the MenuCount as a driving variable that will then activate, arrange, and move all 12 controls whenever the MenuCount changes (via MButton) though I'm not sure of the best way to do this. I can't figure out the correct syntax for turning the MsgBox lines into GuiControl ones though, I'm getting correct data and retrieving things without much trouble (except for something like directionA[%variable%], I haven't gotten to work), but I feel that I'd need arrays within arrays (within arrays again, even?) to pull this off the way I'm intending. I hope what I'm doing above makes sense and I'll study your sample to try and implement your methods instead, but I'd be curious to know if I'm on the wrong track here. I'll need something like 10 arrays which each contain individual parameters for the same 12 controls, or a "master array/function" containing MenuCount arrays which themselves contain all parameters for 12 controls.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Having trouble with this graphical mouse gesture flyout GUI

23 Jan 2018, 14:14

- Some code to remove listview borders:

Code: Select all

;to remove listview borders
;WS_EX_CLIENTEDGE := 0x200
;change:
Gui, Add, Listview, % vCoords " Background" vColDark " +ReadOnly -Hdr"
;to:
Gui, Add, Listview, % vCoords " Background" vColDark " +ReadOnly -Hdr -E0x200"

;handy code
ControlGetFocus, vCtlClassNN, A

MouseGetPos, vCurX, vCurY, hWnd, vCtlClassNN

WinGet, vWinStyle, Style, A
WinGet, vWinExStyle, ExStyle, A
ControlGet, vCtlStyle, Style,, % vCtlClassNN, A
ControlGet, vCtlExStyle, ExStyle,, % vCtlClassNN, A

MsgBox, % Format("0x{:08X} 0x{:08X}", vWinStyle, vWinExStyle)
MsgBox, % Format("0x{:08X} 0x{:08X}", vCtlStyle, vCtlExStyle)
- Btw if you did manage to fix the massive script, do post it, so that I can use WinMerge on it, to see what you changed.
- There are occasional times in programming when I know it'll be easier to learn something than new, than to make something work using methods I already understand. This is probably one of those times.
- There are different ways to do this. With or without arrays within arrays. The only important thing is that arrays in some form will probably make things easier.
- The project looks really promising, so I'm glad if I can remove a lot of the difficulty re. writing it.
- I'll do an object within object loop example in a moment.

- [EDIT:] Here are some simple object within an object loop examples.

Code: Select all

;object within an object loop examples

;2 equivalent arrays

oArray := ["a", "b", "c"]
vOutput := ""
for vKey, vValue in oArray
	vOutput .= vKey " " vValue "`r`n"
MsgBox, % vOutput

oArray := {1:"a", 2:"b", 3:"c"}
vOutput := ""
for vKey, vValue in oArray
	vOutput .= vKey " " vValue "`r`n"
MsgBox, % vOutput

;==================================================

;3 equivalent arrays

oArray:=[["a","b","c"],["d","e","f"],["g","h","i"]]
vOutput := ""
for vKey, vValue in oArray
	vOutput .= vKey " " vValue "`r`n"
MsgBox, % vOutput
vOutput := ""
for vKey, vValue in oArray
	for vKey2, vValue2 in vValue
		vOutput .= vKey2 " " vValue2 "`r`n"
MsgBox, % vOutput

oArray:=[{1:"a",2:"b",3:"c"},{1:"d",2:"e",3:"f"},{1:"g",2:"h",3:"i"}]
vOutput := ""
for vKey, vValue in oArray
	vOutput .= vKey " " vValue "`r`n"
MsgBox, % vOutput
vOutput := ""
for vKey, vValue in oArray
	for vKey2, vValue2 in vValue
		vOutput .= vKey2 " " vValue2 "`r`n"
MsgBox, % vOutput

oArray:={1:{1:"a",2:"b",3:"c"},2:{1:"d",2:"e",3:"f"},3:{1:"g",2:"h",3:"i"}}
vOutput := ""
for vKey, vValue in oArray
	vOutput .= vKey " " vValue "`r`n"
MsgBox, % vOutput
vOutput := ""
for vKey, vValue in oArray
	for vKey2, vValue2 in vValue
		vOutput .= vKey2 " " vValue2 "`r`n"
MsgBox, % vOutput
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Off Topic
Posts: 43
Joined: 07 Oct 2017, 20:57

Re: Having trouble with this graphical mouse gesture flyout GUI

31 Jan 2018, 20:16

jeeswg wrote:- Some code to remove listview borders:

;handy code ;; This is very handy indeed, thanks!
ControlGetFocus, vCtlClassNN, A
MouseGetPos, vCurX, vCurY, hWnd, vCtlClassNN
[/code]

- Btw if you did manage to fix the massive script, do post it, so that I can use WinMerge on it, to see what you changed.
- There are occasional times in programming when I know it'll be easier to learn something than new, than to make something work using methods I already understand. This is probably one of those times.
- There are different ways to do this. With or without arrays within arrays. The only important thing is that arrays in some form will probably make things easier.
- The project looks really promising, so I'm glad if I can remove a lot of the difficulty re. writing it.
- I'll do an object within object loop example in a moment.
Hi jeeswg, sorry for the late reply -- I wanted to try and incorporate your suggestions so I've spent the time since practicing arrays, functions, for loops and other aspects of AHK/coding that I hadn't attempted before. I found your examples above, your Object tutorial and your Function tutorials to be extremely helpful, especially on the tutorial end with the sheer amount of examples provided in them and how basic the examples were. I've rebuilt everything and am onto a new menu, I have a bunch of problems and questions. Here's the animation rig that I was alluding to:

Image

And if you're curious how I'm controlling it:

Image

I wrote the script version below prior to making this animation rig, but everything uses the same assets from Adobe Illustrator and I could render these animations as png sequences or even JSON compatible animations. Overall I feel that animating gives a good idea for prototyping (since it doesn't need to work, it just needs to look like it works) and I also feel this will be useful for communicating what uses I'm aiming for, or to simply show things when needed rather than try to describe it through lengthy run-on sentences. The AHK version is far less elegant atm:

Image

I'm having extremely odd image display issues and I can't tell if I'm crazy, or if the images for the vertical version of the menu are rotated 90 degrees (which seems impossible?) when I change menu types, I'm having trouble using GuiControl, Move on pictures overall:

Image

Pretty messy, right? I don't know how to make a radial menu unless by mosaic, the boxes with green outlines are the picture controls where I'm using transparency to mask/cut-out the visibility of the sharp corners below:

Image

Except, in doing so, when I mouse over a bumper control and the SysListView highlights, the picture and the control fight for focus and will flash erratically. I noticed that you like using bulleted lists and figure you'd find it helpful for me to aswell:

- I've trimmed my script down to ~650 lines, but a lot of it is in redundant arrays. I don't know of a good way to structure and pull this data, do you have any advice? I've ended up using a bunch of arrays for individual purposes because I couldn't figure out a way to do it through one or only a few. I'm afraid it might not be much easier to understand than the initial script because I did a lot of testing and tried a lot of different angles, I've marked problem areas with $$ and commented the script throughout though.

- I can get my controls to highlight well, but I can't figure out a way to tell my script "Unless the control number changes so you need to highlight a new control, don't continually refresh the current control's highlighting." If I could solve that, then my radius pictures are solved because the highlighted controls and pictures won't be fighting for the top.

- In the example below, how do I use two separate variables to retrieve from an array while having only one A_Index? I keep running into a problem where I could be looping through, but I only know how to with A_Index and I'm already using A_Index for another section of that code's line. Am I approaching this wrong? How can I make the # in 'directionA.#' into a variable without needing A_Index because I can't use two separate A_Indices?

Code: Select all

SetMenuType(MenuCount){
	; Horizontal Menu (Dark)
	If (MenuCount = 1) {
		for vKey, vValue in directionA
		{
			GuiControl, Move, % directionA.1 ControlArray[A_Index], % MasterArray.1.North[A_Index]
			GuiControl, Move, % directionA.2 ControlArray[A_Index], % MasterArray.1.South[A_Index]
			GuiControl, Move, % directionA.3 ControlArray[A_Index], % MasterArray.1.West[A_Index]
			GuiControl, Move, % directionA.4 ControlArray[A_Index], % MasterArray.1.East[A_Index]
		}
- I figure I might be able to condense all of the required info into one array, where the layout could be something like:

Code: Select all

; MenuArray.1.North.1A.X[1]
; MenuArray.1.North.1A.Y[1]
; MenuArray.1.North.1A.W[1]
; MenuArray.1.North.1A.H[1]
Where MenuArray.1 is the Menu Type, North is the quadrant, 1A is the control, and .X/Y/W/H are the parameters. X[1] is the initial x position and subsequent ones are the X positions required for different shapes, am I thinking of this incorrectly?

The script is below, the listed problems above are marked with $$. I've included all the picture corner radii .pngs and .ico files in this Google Drive mirror, with versions for 100% or 150% DPI scaling. If you have different needs, let me know and I'll render a new set out. You're free to use anything in this thread for your own personal use, however you see fit. I'd appreciate any tips, advice, criticism or alternate ways to accomplish any of this, or pointing out bad coding practices in general. I'd be most appreciative for any pointers on the use of array though. I know my current arrays are very sloppy, I just don't know of a better way to do all of this through a single one.

Code: Select all

	; Chatterblox / icontext menu

	#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
	; #Warn  ; Enable warnings to assist with detecting common errors.
	SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
	SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

	#SingleInstance, force
	Menu, Tray, Icon, Chatterblox3.ico
	CoordMode, Mouse, Screen

	Bloxer			= 0
	Scroll 			= 1
	boxCount 		= 0
	TrayVar   		= 1
	ScrollCount		= 0
	MenuCount 		= 1
	roll 	  		= 0
	Dir 	  		= South
	Def2      		= 878787
	BoardCount 		= 8
	xCtrl    		= 28
	controlNumber 	= 0

	TransColor		:= 0x2B2B2C
	; Mask = OuterMenu

global icontext 	:= 		["ChatterH2","ChatterV2","Chatterblox3"]

global	RGB    		:=		 {R:["D44400","DD6933","E58F66"]
							 ,G:["24EE49","50F16D","7CF592"]
							 ,B:["5064F1","7383F4","96A2F7"]
							 ,W:["FCFCFC","BDBDBD","7E7E7E"]
						     ,DEF:["2B2B2B","878787","434343"]}

global bloxArray	:= 		["West1A","North1A","North1B","East1A","West1B","South1A","South1B","East1B"]

global bumpArray	:= 		["West2A","North2A","North2B","East2A","West2B","South2A","South2B","East2B"]

global QuadArray	:=		["NW","NE","SW","SE"]

; global InnerOuter	:= 		["1","2"]

global ControlArray	:= 		["1A","1B","2A","2B"]

; Horizontal Menu colors
; BumperLights.1.1[A_Index] ; RGB.R.1
; BumperLights.1.2[A_Index]	; RGB.B.1

; Vertical Menu colors
; BumperLights.2.1[A_Index] ; RGB.G.1
; BumperLights.2.2[A_Index]	; RGB.DEF.1

global	Bumper 		:= 		[[["1","3","7","2"],["4","5","6","8"]],[["1","3","5","4"],["7","2","6","8"]]]

global 	ScrollListviewX	:= 		[[["95", "95", "132", "132"],["111", "111", "148", "148"]
								,["127", "127", "164", "164"],["130", "130", "167", "167"]]
								,[["268", "268", "235", "235"],["251", "251", "218", "218"]
								,["236", "236", "203", "203"],["233", "233", "200", "200"]]]

global 	ScrollPicX		:= 		[["95", "112", "127", "130"]] ; Only left side

global 	ScrollListviewN	:= 		["0", "17", "15", "3"]

global 	BumperLights	:= 		[[["West2A", "West2B", "North2A", "South2A"],["East2A", "East2B", "North2B", "South2B"]]
								,[["North2A", "North2B", "East2A", "West2A"],["South2A", "South2B", "East2B", "West2B"]]]

global MaskCoords	:= 		[["x95 y122", "x95 y115", "x288 y122", "x268 y115", "x95 y242", "x95 y278", "x288 y242", "x268 y278"]
							,["x124 y93" ,"x117 y93" ,"x240 y93" ,"x276 y93" ,"x124 y290" ,"x117 y270" ,"x240 y290" ,"x276 y270"]]

global MaskQuadCoords	:= 		[[["x95 y122", "x95 y115", "x288 y122", "x268 y115"],["x95 y242", "x95 y278", "x288 y242", "x268 y278"]]
							,[["x124 y93" ,"x117 y93" ,"x240 y93" ,"x276 y93"],["x124 y290" ,"x117 y270" ,"x240 y290" ,"x276 y270"]]]

global Limbs			:= 		["2A", "2B"]

global yPosArray		 := {Expand:["93", "270"], Collapse:["128", "235"]}


global MaskQuadLabels	:= 		[[["NW1", "NW2", "SW1", "SW2"],["NE1", "NE2", "SE1", "SE2"]]
							,[["NW1", "NW2", "NE1", "NE2"],["SW1", "SW2", "SE1", "SE2"]]]

global MaskLabel	:= 		["NW1","NW2","NE1","NE2","SW1","SW2","SE1","SE2"]






global MenuArray   				:=  [{North:{2A:{X:["95", "128"]}}
											,{2B:{X:["95", "125"]}}}]

; MasterArray.1... is Horizontal Menu
; MasterArray.2... is Vertical Menu
global	MasterArray :=	 	[{North:["x187 y115 w10 h15" 
										,"x203 y115 w10 h15" 
										,"x132 y115 w33 h15"
										,"x235 y115 w33 h15"]
										,South:["x187 y270 w10 h15" 
										,"x203 y270 w10 h15" 
										,"x132 y270 w33 h15"
										,"x235 y270 w33 h15"]
										,West:["x172 y115 w10 h15" 
										,"x172 y270 w10 h15" 
										,"x95 y115 w37 h85"
										,"x95 y200 w37 h85"]
										,East:["x218 y115 w10 h15" 
										,"x218 y270 w10 h15" 
										,"x268 y115 w37 h85"
										,"x268 y200 w37 h85"]}
							,{North:["x117 y187 w15 h10" 
										,"x268 y187 w15 h10" 
										,"x117 y93 w83 h37"
										,"x200 y93 w83 h37"]
										,South:["x117 y203 w15 h10" 
										,"x268 y203 w15 h10" 
										,"x117 y270 w83 h37"
										,"x200 y270 w83 h37"]
										,West:["x117 y172 w15 h10" 
										,"x117 y218 w15 h10" 
										,"x117 y130 w15 h35"
										,"x117 y235 w15 h35"]
										,East:["x268 y172 w15 h10" 
										,"x268 y218 w15 h10" 
										,"x268 y130 w15 h35"
										,"x268 y235 w15 h35"]}]

; Ideal form could be?:
; MenuArray.1.North.1A.X[1]
; MenuArray.1.North.1A.Y[1]
; MenuArray.1.North.1A.W[1]
; MenuArray.1.North.1A.H[1]

global	directionA	:=		["North","South","West","East"]

; Gui and Autos
		Gui, +LastFound -Caption +AlwaysOnTop hwndFlyout
		Gui, Margin , 0, 0
		Gui, Color, 2B2B2C, 2B2B2B
		Gui +LastFound
		WinSet, TransColor, 2B2B2C

		Gui, Add, Picture, x67 y67 vBG, Chatterblox1.4SS.png
		Gui, Add, Listview, x190 y190 w20 h20 Background2B2B2B +ReadOnly -Hdr -E0X00 vCenter

		for vKey, vValue in directionA
		{
			Gui, Add, Listview, % MasterArray.1.North[A_Index] " Background" RGB.DEF.1 " +ReadOnly -Hdr -E0X00 v" directionA.1 ControlArray[A_Index]
			Gui, Add, Listview, % MasterArray.1.South[A_Index] " Background" RGB.DEF.1 " +ReadOnly -Hdr -E0X00 v" directionA.2 ControlArray[A_Index]
			Gui, Add, Listview, % MasterArray.1.West[A_Index] " Background" RGB.DEF.1 " +ReadOnly -Hdr -E0X00 v" directionA.3 ControlArray[A_Index]
			Gui, Add, Listview, % MasterArray.1.East[A_Index] " Background" RGB.DEF.1 " +ReadOnly -Hdr -E0X00 v" directionA.4 ControlArray[A_Index]
		}

		Loop, % MaskCoords.1.Length()
		{
			Gui, Add, Picture, % "v" MaskLabel[A_Index] " " MaskCoords.1[A_Index], % MaskLabel[A_Index] "dark.png"
		}
		Gui, Font, s7 q4, Arial
		; WinSet, TransColor, 2B2B2A 150
		 Gui, Add, Picture, x138 y136 vGuiTextBG, textBG.png
		; Gui, Add, Progress, x138 y136 w124 h26 Background2B2B2A -E0x200 vTextBG, 0
		Gui, Add, Edit, x139 y137 w122 h24 c878787 Background2B2B2B -E0x200  +Multi +VScroll -Wrap vGuiText, %clipboard%
		; Gui, Add, UpDown, x243 y137 c2c2c2c Hidden vScrollBoxA , 1
		Gui, Add, Picture, x243 y137 vVscroll, Vscroll.png	
		GuiControl, Hide, Center
		GuiControl, Hide, BG
		Gui, Show, Hide w400 h400 Center

		SetTimer, mouseTrack, 20
		; SetTimer, Highlight, 20
		SetTimer, CapsLockIt, 20

; End Auto-Execute
Return



F24::
vOutput := ""
MsgBox % TestArray.1.North.1A[A_Index]
	; for vKey, vValue in yPosArray
	; 	for vKey2, vValue2 in vValue
Return

mouseTrack:
	global vCurX, vCurY, hWnd, vCtlClassNN
	MouseGetPos, vCurX, vCurY, hWnd, vCtlClassNN

	IfInString, vCtlClassNN, SysListView32
		{
			controlNewNumber	:= RegExReplace(vCtlClassNN, "SysListView321", "")
			++controlNewNumber
			If (controlNewNumber = lastControl)
				SetTimer, Highlight, Off
		}
Return


; Show the GUI as RButton is held.
*#RButton::
		WinGet, active_id, ID, A
		WinActivate, Chatterblox1.3.ahk ahk_class AutoHotkeyGUI
		; ControlFocus, Edit1, Chatterblox1.3.ahk ahk_class AutoHotkeyGUI
		SetTimer, Highlight, 20
		lastControl := controlNumber := "" 
		mouseX := vCurX-300
		mouseY := vCurY-300
		SetMenuType(MenuCount)
		GuiControl, , Edit1, %clipboard%
		Gui, Show, x%mouseX% y%mouseY% w400 h400
	Return

; RButton to hide GUI and confirm selection of bumper/control after mouse hover.
*#RButton Up::
		Gui, Show, Hide
		lastControl := controlNumber
		ResetBumpers()
		ResetBumperPics()
		If (lastControl != "" && lastControl != 0)
		MsgBox % lastControl
		WinActivate, ahk_id %active_id%
	Return



; Expand or contract the menu
#MButton::
	++Scroll
		If (Scroll > 2)
			Scroll = 1

	If (MenuCount = 1) {
		If (Scroll = 1) {	
			Loop, 2
			{
				GuiControl, Show, % "North" Limbs[A_Index]
				GuiControl, Show, % "South" Limbs[A_Index]
			}
		} Else If (Scroll = 2) {
			Loop, 2
			{
				GuiControl, Hide, % "North" Limbs[A_Index]
				GuiControl, Hide, % "South" Limbs[A_Index]
			}
		}
	} Else If (MenuCount = 2) {
		If (Scroll = 1) {	

			GuiControl, Move, North2A, % " y" yPosArray.Expand[1]
			GuiControl, Move, North2B, % " y" yPosArray.Expand[1]
			GuiControl, Move, South2A, % " y" yPosArray.Expand[2]
			GuiControl, Move, South2B, % " y" yPosArray.Expand[2]

		} Else If (Scroll = 2) {
			
			GuiControl, Move, North2A, % " y" yPosArray.Collapse[1]
			GuiControl, Move, North2B, % " y" yPosArray.Collapse[1]
			GuiControl, Move, South2A, % " y" yPosArray.Collapse[2]
			GuiControl, Move, South2B, % " y" yPosArray.Collapse[2]

		}
	}


	GuiDisplay()
	GuiSetScrollQuick(Scroll)
	Return

; Meant to hide the Edit box, doesn't work at the moment
GuiDisplay(){
	If (Scroll = 1) {
		GuiControl, Show, GuiTextBG
		GuiControl, Show, GuiText
		GuiControl, Show, Vscroll
	} Else If (Scroll = 2) {
		GuiControl, Hide, GuiTextBG
		GuiControl, Hide, GuiText
		GuiControl, Hide, Vscroll
	}
Return
}

GuiSetScrollQuick(Scroll){
	If (MenuCount = 1) {
	Loop, % BumperLights.1.1.Length()
			{
				If (Scroll = 1) {
					GuiControl, Move, % BumperLights.1.1[A_Index], % " x" ScrollListviewX.1.1[A_Index]
					GuiControl, Move, % BumperLights.1.2[A_Index], % " x" ScrollListviewX.2.1[A_Index]
					GuiControl, Move, % MaskQuadLabels.1.1[A_Index], % " x" ScrollPicX.1[A_Index]
				} Else If (Scroll = 2) {
					GuiControl, Move, % BumperLights.1.1[A_Index], % " x" ScrollListviewX.1.4[A_Index]
					GuiControl, Move, % BumperLights.1.2[A_Index], % " x" ScrollListviewX.2.4[A_Index]
					GuiControl, Move, % MaskQuadLabels.1.1[A_Index], % " x" ScrollPicX.1[A_Index]
				}
			}
		}
	ResetBumpers()
	Return
}


; $$
; This works in terms of boxes, but not pictures. I feel like my images are rotated here, I've rendered them multiple
; times with a similar glitching result.

; Change the layout/shape of the menu to select vertical, horizontal (or corner and other types of) mouse move bumpers.
; The current menu/directions of bumpers are displayed as the script's icon on the Taskbar.
^#MButton::
	global MenuCount
	++MenuCount
		If (MenuCount >= 3)
			MenuCount = 1
	Loop, % MenuCount
		{
		if (A_Index > MenuCount)
		break
		Menu, Tray, Icon, % icontext[A_Index] ".ico"
		SetMenuType(A_Index)
		}
	Tooltip %MenuCount%
	Sleep, 200
	Tooltip
	Return

; Display debugging ToolTip when CapsLock is enabled
CapsLockIt:
			If !GetKeyState("CapsLock","T") {

			GuiControl, Hide, BG
			 Tooltip		 

			} Else { 
				GuiControl, Show, BG
				ControlGetFocus, BumperNumber, A
				If (vCtlClassNN = ""){
				ToolTip % lastControl	
				} Else {
				Tooltip % BumperNumber "`r`n" vCtlClassNN "`r`n" controlNumber "`r`n" Scroll
				} 
			}
			Return



; Cycle through the inner (1"A,B") controls sequentially to access a "pocket" or virtual clipboard.
^#WheelUp::
		If (A_PriorHotkey != A_ThisHotkey or A_TimeSincePriorHotkey > 300) {
			++boxCount
			If (boxCount >= 9)
				{
					boxCount = 0
						Loop, % bloxArray.Length()
						{
							GuiControl, % "+Background" RGB.DEF[1], % bloxArray[A_Index]
						}
					}
			bloxShift(boxCount)
			ToolTip % boxCount
			}		
		Sleep, 300
		ToolTip
		Return
^#WheelDown::
		If (A_PriorHotkey != A_ThisHotkey or A_TimeSincePriorHotkey > 300) {
			--boxCount
			If (boxCount <= 0)
				{
					boxCount := bloxArray.Length()
				}
				bloxShift(boxCount)
				; ToolTip % boxCount "`r`n" boxRetreat
			}
		ToolTip % boxCount
		Sleep, 300
		ToolTip
		Return


; I plan on depositing, retrieving or stacking clipboard data from these boxes in this mode, can also be used
; for color to indicate different profiles or colors and output actions of bumpers.

; For lighting the inner controls sequentially when using ^#WheelUp or Down
bloxShift(boxCount){
	Loop, % boxCount
		{
			if (A_Index <= 0) {
			boxCount := bloxArray.Length()
				Loop, % bloxArray.Length()
				{
					GuiControl, % "+Background" RGB.DEF[2], % bloxArray[A_Index]
				}
			Break
			}
			boxRetreat := (boxCount + 1)
			Loop, % boxRetreat
				{
					If (A_Index > boxRetreat)
					Break
					GuiControl, % "+Background" RGB.DEF[1], % bloxArray[A_Index]
				}

			boxPrev := (boxCount - 1)
			Loop, % boxPrev
				{
					If (A_Index > boxPrev)
					Break
					GuiControl, % "+Background" RGB.DEF[2], % bloxArray[A_Index]	
				}
			GuiControl, % "+Background" RGB.DEF[2], % bloxArray[A_Index]
		}
	Return
}


; 
ResetBumpers(){
	Loop, % bumpArray.Length()
	{
			GuiControl, % "+Background" RGB.DEF.1, % bumpArray[A_Index]
		}
	; ResetBumperPics()
	Return
}
	
ResetBumperPics(){
		Loop, % MaskCoords.1.Length()
			{
				GuiControl, , % MaskLabel[A_Index], % MaskLabel[A_Index] "dark.png"
			}
}

; This is meant to move the picture corners as the menu scrolls to different sizes, but produces glitched pictures
ResetBumperPicsMenu(MenuCount){
	Loop, % MenuCount
	If (A_Index != MenuCount)
	Break
		Loop, % MaskCoords.1.Length()
			{
				; GuiControl, , % MaskLabel[A_Index], % MaskLabel[A_Index] "dark.png"
				GuiControl, Move, % MaskLabel[A_Index], % MaskCoords.1[A_Index]
			}
	ResetBumperPics()
}


; Timer to check if mouse is hovering over a control
Highlight:
		IfInString, vCtlClassNN, SysListView32
		{
			controlNumber	:= RegExReplace(vCtlClassNN, "SysListView321", "")
			++controlNumber ; This is to bump the first control to a value of 1
			; ToolTip % controlNumber
			HighlightMenu(MenuCount,controlNumber)
		}
	
	IfNotInString, vCtlClassNN, SysListView32
	{
		If (lastControl = controlNumber){
			; ResetBumpers()
			lastControl := ""
		}
	}

	IfInString, vCtlClassNN, Edit
		{
			ControlFocus, Edit1, Chatterblox1.3.ahk ahk_class AutoHotkeyGUI		
			GuiControl, , Vscroll, Vscroll3.png
		}
Return


; $$ This seems redundant but I don't know of a better way just yet.
HighlightMenu(MenuCount, controlNumber){
	If (MenuCount = 1){
		If (HasVal(Bumper.1.1, controlNumber) != 0) { ; if this is West
			++Bloxer
			Loop, % BumperLights.1.1.Length()
			{
				GuiControl, % "+Background" RGB.R.1, % BumperLights.1.1[A_Index]
			}
		HighlightMenuPic(MenuCount, Left)
		}
		If (HasVal(Bumper.1.2, controlNumber) != 0) { ; if this is East
			++Bloxer
			Loop, % BumperLights.1.2.Length()
			{
				GuiControl, % "+Background" RGB.B.1, % BumperLights.1.2[A_Index]
			}
		HighlightMenuPic(MenuCount, Right)	
		}
		; $$ lastControl is assigned to current control
		lastControl := controlNumber
		; ResetBumperPics(MenuCount)
	}

	If (MenuCount = 2){
		If (HasVal(Bumper.2.1, controlNumber) != 0) { ; if this is North
			Loop, % BumperLights.2.1.Length()
			{
				GuiControl, % "+Background" RGB.G.1, % BumperLights.2.1[A_Index]
				; Bump := "Left"
			}
		HighlightMenuPic(MenuCount, Left)
		}
		If (HasVal(Bumper.2.2, controlNumber) != 0) { ; if this is South
			Loop, % BumperLights.2.2.Length()
			{
				GuiControl, % "+Background" RGB.W.1, % BumperLights.2.2[A_Index]
				; Bump := "Right"
			}
		HighlightMenuPic(MenuCount, Right)	
		}
		lastControl := controlNumber
	}
	Return
}


; Changes the pictures from dark(2B2B2B) to lit by same colors as the SysListViews
HighlightMenuPic(MenuCount, Bump){
	Loop, % MaskQuadCoords.1.1.Length()
	{
		If (MenuCount = 1){
			If (Bump := Left) {
				GuiControl, , % MaskQuadLabels.1.1[A_Index],  % MaskQuadLabels.1.1[A_Index] ".png"
			} Else If (Bump := Right) {
				GuiControl, , % MaskQuadLabels.1.2[A_Index],  % MaskQuadLabels.1.2[A_Index] ".png"
			}
		}
	}
	; vOutput .= MaskQuadCoords.1.1[A_Index]	
	Return
}


; Thanks u/GroggyOtter
GuiControlSetColor(thisColor, nums:=0){
	for index, value in directionA
	{
		Loop, 2
		{
			if (nums = 1) && (A_Index > nums)
				break
			if (nums = 2) && (A_Index = 1)
				continue
			GuiControl, % "+Background" thisColor, % value A_Index "A"
			GuiControl, % "+Background" thisColor, % value A_Index "B"
		}
	}
	return
}


; jNizM
HasVal(haystack, needle) {
    for index, value in haystack
        if (value = needle)
            return index
    if !(IsObject(haystack))
        throw Exception("Bad haystack!", -1, haystack)
    return 0
}


SetMenuType(MenuCount){
	; Horizontal Menu (Dark)
	If (MenuCount = 1) {
		for vKey, vValue in directionA
		{
			GuiControl, Move, % directionA.1 ControlArray[A_Index], % MasterArray.1.North[A_Index]
			GuiControl, Move, % directionA.2 ControlArray[A_Index], % MasterArray.1.South[A_Index]
			GuiControl, Move, % directionA.3 ControlArray[A_Index], % MasterArray.1.West[A_Index]
			GuiControl, Move, % directionA.4 ControlArray[A_Index], % MasterArray.1.East[A_Index]
		}

	Loop, % MaskCoords.1.Length()
		{
			GuiControl, , % MaskLabel[A_Index], % MaskLabel[A_Index] "dark.png"
			GuiControl, Move, % MaskLabel[A_Index], % MaskCoords.1[A_Index]
		}
	} 

	; Vertical Menu (Dark)
	If (MenuCount = 2) {
		for vKey, vValue in directionA
		{
			GuiControl, Move, % directionA.1 ControlArray[A_Index], % MasterArray.2.North[A_Index]
			GuiControl, Move, % directionA.2 ControlArray[A_Index], % MasterArray.2.South[A_Index]
			GuiControl, Move, % directionA.3 ControlArray[A_Index], % MasterArray.2.West[A_Index]
			GuiControl, Move, % directionA.4 ControlArray[A_Index], % MasterArray.2.East[A_Index]
		}

	Loop, % MaskCoords.1.Length()
		{
			GuiControl, , % MaskLabel[A_Index], % "v" MaskLabel[A_Index] "dark.png"
			GuiControl, Move, % MaskLabel[A_Index], % MaskCoords.2[A_Index]
		}
	}

Return
}


; Use the mousewheel to adjust/scroll through available widths.
#WheelUp::
	If (A_PriorHotkey != A_ThisHotkey or A_TimeSincePriorHotkey > 300) {
		++ScrollCount
		If (ScrollCount >= 4)
			ScrollCount = 0
	}
	ToolTip % ScrollCount
	Sleep, 200
	GuiSetScroll(ScrollCount)
	Tooltip
Return
#WheelDown::
	If (A_PriorHotkey != A_ThisHotkey or A_TimeSincePriorHotkey > 300) {
		--ScrollCount
		If (ScrollCount < -1)
			ScrollCount = 3

	}
	ToolTip % ScrollCount
	Sleep, 200
	GuiSetScroll(ScrollCount)
	Tooltip
Return

; $$
; Big problems with this one while shifting through the available widths, my pictures display very glitchy when not in the original
; position. They display properly again upon reaching (ScrollCount = 0) but I can't get them to refresh correctly.
GuiSetScroll(ScrollCount){
; GuiControl, Move, North1A, x170
	Loop, % BumperLights.1.1.Length()
			{
				If (ScrollCount <= 0) {
					GuiControl, Move, % BumperLights.1.1[A_Index], % " x" ScrollListviewX.1.1[A_Index]
					GuiControl, Move, % BumperLights.1.2[A_Index], % " x" ScrollListviewX.2.1[A_Index]
					GuiControl, Move, % MaskQuadLabels.1.1[A_Index], % " x" ScrollPicX[A_Index]
					; MsgBox % BumperLights.1.1[A_Index] " `, x" ScrollListviewX.1[A_Index] "`r`n"
				; } Else If (ScrollCount = 1) {
				; 	GuiControl, Move, % BumperLights.1.1[A_Index], % " x" ScrollListviewX.2[A_Index]
				; 	GuiControl, Move, % MaskQuadLabels.1.1[A_Index], % " x" ScrollPicX[A_Index]
				; } Else If (ScrollCount = 2) {
				; 	GuiControl, Move, % BumperLights.1.1[A_Index], % " x" ScrollListviewX.3[A_Index]
				; 	GuiControl, Move, % MaskQuadLabels.1.1[A_Index], % " x" ScrollPicX[A_Index]
				} Else If (ScrollCount = 3) {
					GuiControl, Move, % BumperLights.1.1[A_Index], % " x" ScrollListviewX.1.4[A_Index]
					GuiControl, Move, % BumperLights.1.2[A_Index], % " x" ScrollListviewX.2.4[A_Index]
					GuiControl, Move, % MaskQuadLabels.1.1[A_Index], % " x" ScrollPicX[A_Index]
				}
				; GuiControl, Move, % BumperLights.1.1[A_Index], % " x" ScrollListviewX.1.1[A_Index]
			}
	ResetBumpers()
	Return
}
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Having trouble with this graphical mouse gesture flyout GUI

31 Jan 2018, 21:28

- This might be worth a look, if you haven't seen it before. I haven't really looked at it myself.
Radial menu scripts - updates 2017-07-25 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=12078
- Great to hear about my tutorials being looked at. Yeah, I try to keep things really simple.
- I will take a closer look at your script soon, it does look much more readable than your previous one.
- In my example script, each time I highlighted a region, I recorded that, then as I highlighted a different region, I checked for any regions that had been previously highlighted, and unhighlighted them, to minimise the number of changes made. Also, in my script, if a check reveals that the mouse is over the same region as last time, nothing happens.
- I would recommend you to consider creating a very simple small script that demonstrates any of the problems that you are experiencing.
- I would hope that someone else could look at your animated gifs and have some suggestions, I don't do too many fancy things with graphics. One curious thing is how the round corners become rectangles again. I don't know whether Gdip might be better than using controls or not.
- [EDIT:] Btw:

Code: Select all

directionA.1
directionA[1]
directionA[A_Index]
directionA[vNum]

directionA[A_Index] ControlArray[A_Index]
directionA[A_Index] . ControlArray[A_Index]
- [EDIT:] If I want two numbers based on A_Index:

Code: Select all

;different arrays
vIndex1 := oArray1[A_Index]
vIndex2 := oArray2[A_Index]

;different keys
vIndex1 := oArray.1[A_Index]
vIndex2 := oArray.2[A_Index]

;different letters of the alphabet
vIndex1 := Chr(96+A_Index)
vIndex2 := Chr(97+A_Index)

vIndex1 := A_Index-1
vIndex2 := (A_Index-1)*4
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Fredrik F, Joey5, maxkill, Rohwedder and 385 guests