Show menu below the button

Get help with using AutoHotkey and its commands and hotkeys
think
Posts: 65
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: 1561
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
think
Posts: 65
Joined: 09 Feb 2014, 05:20

Re: Show menu below the button

18 Nov 2019, 03:44

Many thanks! :)

Return to “Ask For Help”

Who is online

Users browsing this forum: Alexander2, Bing [Bot], blenderfish, boiler, hackkk745, moszt, RubbeH, temoridao, Zamfir and 42 guests