Arrange menu Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Arrange menu

02 Jan 2022, 17:32

Hey,

Is it possible to arrange a menu so each category will have it's own column, instead of having to hover or click over the categories to see what's inside?
I basically want to see the entire menu when it's opened, instead of having to click on the categories. The problem is that if I try to do that now without the categories, it's just gets all the items into 1 big column that doesn't fit into my screen.

Appreciate your help, thank you :)
User avatar
boiler
Posts: 17392
Joined: 21 Dec 2014, 02:44

Re: Arrange menu

02 Jan 2022, 17:37

Then just make a GUI with a bunch of buttons in several columns. There doesn’t seem to be any reason to make it a menu per your description. Just have your script invoke the GUI instead of a menu. You can implement the equivalent of check marks if that’s one reason for using a menu.
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Arrange menu

02 Jan 2022, 17:50

Just not sure how to work with GUIs..

I only want a simple menu that will be displayed like I said, nothing more..
User avatar
boiler
Posts: 17392
Joined: 21 Dec 2014, 02:44

Re: Arrange menu

02 Jan 2022, 18:06

hemsith14_ wrote: Just not sure how to work with GUIs..
Not sure what to tell you if you’re not interested in learning the solution to your problem.
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Arrange menu

02 Jan 2022, 18:20

Could you make a simple GUI that will work like a menu?
User avatar
boiler
Posts: 17392
Joined: 21 Dec 2014, 02:44

Re: Arrange menu

02 Jan 2022, 18:22

What you described doesn’t work like a menu because all the options are always visible. It’s more like what I described, which is a GUI with a bunch of buttons. Yes, that’s standard GUI operation.
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Arrange menu

02 Jan 2022, 18:23

Could you show me an example script?
User avatar
boiler
Posts: 17392
Joined: 21 Dec 2014, 02:44

Re: Arrange menu

02 Jan 2022, 18:28

See Example #2 from the GUI documentation page. Just make a bunch of buttons and none of the other stuff.
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Arrange menu

02 Jan 2022, 18:32

hemsith14_ wrote:
02 Jan 2022, 18:23
Could you show me an example script?

Code: Select all

Gui, 1:+AlwaysOnTop
Index := 0
Loop, 10	{
	Gui, 1:Add, Button, xm y+10 w110 , % "Button " ++Index
	Loop, 9	{
		Gui, 1:Add, Button, x+10 yp wp , % "Button " ++Index
	}
}
Gui, 1:Show
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Arrange menu

02 Jan 2022, 18:35

Is it possible to just simply turn my existing menu into something like this?

Also, how do I get it to behave like a menu, so it would be opened from where my mouse is?
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Arrange menu

02 Jan 2022, 18:49

hemsith14_ wrote:
02 Jan 2022, 18:35
Is it possible to just simply turn my existing menu into something like this?
YES? NO? MAYBE?
Also, how do I get it to behave like a menu, so it would be opened from where my mouse is?
A variation of this.

Code: Select all


GuiClose:
	Gui, 1:Hide
	return

F1::
	CoordMode, Mouse, Screen
	MouseGetPos, x, y
	Gui, 1:Show, % "x" x " y" y
	return

User avatar
boiler
Posts: 17392
Joined: 21 Dec 2014, 02:44

Re: Arrange menu

02 Jan 2022, 18:53

Hellbent wrote: YES? NO? MAYBE?
I vote NO. What you showed is easier than trying to force a menu to do something it is not meant to do, so OP should follow your example.
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Arrange menu

02 Jan 2022, 19:01

I currently have this:

Code: Select all

^1::
MouseGetPos, X1, Y1
Gui, New,,Test
Gui, Font, s30, Verdana
Gui, +AlwaysOnTop -SysMenu +Owner
Gui, Add, Button, Y+10 W110 , TEST
Gui, Show
Return

ButtonTEST:
Send, {LWin}
Gui, Hide
Return
Couldn't get it to follow my mouse yet, and I also want it to be closed if I click on any other place rather than on the GUI (like a menu).

Also, not sure how to get the buttons to be aligned side by side.

Could you help me with that?
User avatar
boiler
Posts: 17392
Joined: 21 Dec 2014, 02:44

Re: Arrange menu

02 Jan 2022, 19:05

Hellbent showed examples of how to align buttons in columns and how to have it appear where the mouse is.

To get it to close when you click, make a hotkey ~LButton:: that is active only when your GUI exists, and if the click is outside of your GUI, then it would close the GUI.
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Arrange menu

02 Jan 2022, 19:20

I figured everything out but how to get it to follow the mouse and the exit function.

Do you mind helping me with that?

Code: Select all

^1::
CoordMode, Mouse, Screen
MouseGetPos, x, y
Gui, 1:New,,Test
Gui, 1:Font, s30, Verdana
Gui, 1:+AlwaysOnTop -SysMenu +Owner
Gui, 1:-Caption
Gui, 1:Add, Button, y+10 W110 , TEST
Gui, 1:Add, Button, x+10 W110 , TEST2
Gui, 1:Show
Return

ButtonTEST:
Send, {LWin}
Gui, Hide
Return

ButtonTEST2:
Send, {LWin}
Gui, Hide
Return
User avatar
boiler
Posts: 17392
Joined: 21 Dec 2014, 02:44

Re: Arrange menu

02 Jan 2022, 19:22

As Hellbent showed:

Code: Select all

Gui, 1:Show, % "x" x " y" y
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Arrange menu

02 Jan 2022, 19:27

Oh yea I got confused with the ordering there, it works now. Thank you!

Now would you mind helping me with the ~LButton solution you suggested?
User avatar
boiler
Posts: 17392
Joined: 21 Dec 2014, 02:44

Re: Arrange menu

02 Jan 2022, 19:30

Sure. Try this:

Code: Select all

^1::
CoordMode, Mouse, Screen
MouseGetPos, x, y
Gui, 1:New,,Test
Gui, 1:Font, s30, Verdana
Gui, 1:+AlwaysOnTop -SysMenu +Owner
Gui, 1:-Caption
Gui, 1:Add, Button, y+10 W110 , TEST
Gui, 1:Add, Button, x+10 W110 , TEST2
Gui, 1:Show, % "x" x " y" y
Return

ButtonTEST:
Send, {LWin}
Gui, Hide
Return

ButtonTEST2:
Send, {LWin}
Gui, Hide
Return

#If WinExist("Test ahk_class AutoHotkeyGUI")
~LButton::
	MouseGetPos,,, WinID
	if (WinExist("Test ahk_class AutoHotkeyGUI") != WinID)
		Gui, Hide
return
User avatar
flyingDman
Posts: 2848
Joined: 29 Sep 2013, 19:01

Re: Arrange menu  Topic is solved

02 Jan 2022, 19:36

Have you considered using menu with barbreak ?

Code: Select all

loop, 15
	Menu, scripts, Add, test%a_index%, Execute, % !mod(a_index - 1,5) ? "+barbreak" : ""
Menu, scripts, Show
return

execute:
return
14.3 & 1.3.7
User avatar
boiler
Posts: 17392
Joined: 21 Dec 2014, 02:44

Re: Arrange menu

02 Jan 2022, 19:39

@flyingDman :clap:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 175 guests