Show menu below the button

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
think
Posts: 137
Joined: 09 Feb 2014, 05:20

Show menu below the button

17 Nov 2019, 13:13

I cannot figure it out how to show the menu aligned with the button. Here is what I tried to show the menu exactly below the button. What am I doing wrong?

Code: Select all

gui, add, button, w75 h23 vMyButton gShow, Button
gui, show, w300 h300
return

Show:
loop 3
	Menu, MyMenu, Add, Menu%A_Index%, MenuHandler
GuiControlGet, Pos, Pos, MyButton
Menu, MyMenu, Show, posX, posY+posH
return

MenuHandler:
return
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Show menu below the button

18 Nov 2019, 01:47

Use ControlGetPos instead of GuiControlGet, also you can't omit % for this command.

Code: Select all

gui, add, button, w75 h23 vMyButton gShow HWNDhBtn, Button
gui, show, w300 h300
return

Show:
loop 3
	Menu, MyMenu, Add, Menu%A_Index%, MenuHandler
ControlGetPos, cX, cY, cW, cH,, ahk_id %hBtn%
Menu, MyMenu, Show, % cX+1, % cY+cH
return

MenuHandler:
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 178 guests