Menu object

Discuss the future of the AutoHotkey language
Helgef
Posts: 2674
Joined: 17 Jul 2016, 01:02
Contact:

Menu object

27 Dec 2017, 14:34

Hello :wave:.

For reference, ahk v2 docs, Menu object. This is excellent, both in regards to the documentation and usage :clap:.

Minor comments, questions, suggestions...

  • Perhaps add an EventObj parameter for the menuCreate() function, similar to the guiCreate() EventObj (event sink) parameter.
  • I wonder if there are any plans on adding features, such as additional properties (count, isChecked , ...? ) and/or an enumerator? (I did see the count example)
  • I like the handle property better than file object's __handle, why the double underscore?

@ lexikos, Thank you very much for AutoHotkey Christmas Edition :xmas:
lexikos
Posts: 5686
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Menu object

28 Dec 2017, 22:38

  • There's only one event (Click) and it is per-item, not per-menu. It therefore makes no sense to pass an event sink object to MenuCreate().
  • There are no plans, only open-ended potential and a lack of urgency (i.e. adding these features later should not cause problems).
  • Handles are low-level (like the underscore...). Interacting with a file handle in the wrong way may cause the File methods to behave unexpectedly, as the File object cannot compensate for changes it does not detect. However, I will probably remove the underscores to be consistent with the newer objects (Gui and Menu).
wolf_II
Posts: 1705
Joined: 08 Feb 2015, 20:55

Re: Menu object

28 Dec 2017, 23:09

Helgef wrote:@ lexikos, Thank you very much for AutoHotkey Christmas Edition :xmas:

+1
Helgef
Posts: 2674
Joined: 17 Jul 2016, 01:02
Contact:

Re: Menu object

29 Dec 2017, 07:24

There's only one event (Click) and it is per-item, not per-menu.

I'm satisfied with your answer, and I agree that having only one event makes the suggested addition less important. Regarding the per-item part, from the viewpoint of a simple user, that is me, there was no difference in per-item in a menu, and per-control in a gui. I thought it could be convenient to specify a method name for the Label-or-Submenu parameter. BoundFuncs will do fine ofc.
Handles are low-level (like the underscore...).
I didn't make the visual connection before :D.

Thanks for your time, cheers.

Hello wolf_II :wave:
lexikos
Posts: 5686
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Menu object

30 Dec 2017, 00:28

Helgef wrote:I thought it could be convenient to specify a method name for the Label-or-Submenu parameter.
I see. I'm not sure if I thought that would be inconsistent with GUI or just didn't think it through. Now I see the only difference would be in passing the name/function to Add() vs. passing it to OnEvent(), and that difference already exists. It's not the event sink that makes no sense for MenuCreate(), but OnEvent(). I was probably forgetting that the GUI object's event sink is used by both the GUI and its controls.

In any case, my goal for the initial Menu object API was merely parity with the v1 commands, minus the global menu names. I may use your suggestion.

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 2 guests