Menu-like popup Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Gabby
Posts: 28
Joined: 19 Aug 2017, 03:55

Menu-like popup

19 Aug 2017, 04:14

I'm a complete newby with AHK (1 day experience), but OK with VBA and Delphi, so it all makes sense so far, and looks amazing. I can process keystrokes to launch and paste OK, so now I'm looking at something a bit more complex.

I want to activate a form or popup menu which will then take various actions (mostly pastes) depending on keystrokes from the user. It looks like a menu will do this, but I was looking for something a bit more controllable in terms of format, like a form with buttons. The reason for avoiding a popup menu is that there are likely to be 20-30 options.

So the idea is that I launch the form with eg Ctrl-Alt-P, then select an item either using a key or key combination or by mouse selection, which makes changes to the active form.

I would really appreciate some pointers on what might meet this need.

Gabby
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Menu-like popup  Topic is solved

19 Aug 2017, 05:10

Controllable in terms of format would suggest a GUI for your form. You can put buttons on that. Your script can create a GUI first and not show it straight away. Add a hotkey to show the GUI, Add subroutines to do the work (e.g. pasting text). Try this:

Code: Select all

Gui, -Caption
Gui, Margin, 0, 0
Loop, 24
    Gui, Add, Button, w80 gAction, Action #%A_Index%
Return

^!p:: Gui, Show

Action:
    Gui, Hide
    MsgBox, %A_GuiControl%
Return
I hope that gets you started.
User avatar
Capn Odin
Posts: 1352
Joined: 23 Feb 2016, 19:45
Location: Denmark
Contact:

Re: Menu-like popup

19 Aug 2017, 05:12

If you want more control you will need to make the GUI yourself.
You can make a new GUI with

Code: Select all

Gui, New [, Options, Title]
add controls with

Code: Select all

Gui, Add, ControlType [, Options, Text]
and show it with

Code: Select all

Gui, Show [, Options, Title]
Please excuse my spelling I am dyslexic.
Gabby
Posts: 28
Joined: 19 Aug 2017, 03:55

Re: Menu-like popup

19 Aug 2017, 19:01

Thanks for the suggestions, particularly to the use of a GUI (elsewhere known as a form - who'da thunk it).
I've decided that a ListView probably meets my needs best, with a few other controls.

Gabby

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 254 guests