menuet icon indicating copy to clipboard operation
menuet copied to clipboard

Question: Close after Clicked

Open gregod-com opened this issue 5 years ago • 3 comments

hey guys, really love how fast I can write my little menu bar app with your framework. Thank you for that! I got a question about the behaviour of the dropdown when clicking a MenuItem: Is there a way to leave the dropdown open when a MenuItem is being clicked? Right now every func behind a Clicked event closes the menu. So to clarify: when I want to start a few funcs behind several MenuItems by clicking on them, it is a bit tedious since I have to click on the menu icon in between each func call. Is there a way to not close the menu dropdown and just use menuet.App().MenuChanged() to update the state or is the bridge to ObjectiveC limiting this "feature"?

Cheers Gregor

gregod-com avatar Aug 02 '19 22:08 gregod-com

Hi Gregor, glad you're finding it useful!

That's an interesting request. I think doing it would require subclassing NSMenuItem and handling the events ourselves. That would also mean a custom view, our own text drawing, highlighting, flash animation, etc. So probably not something I will get to in the near future. I do want to eventually do it to create an inline text menu item (like the Apple help search box).

What's the use case, a list of options to toggle? Have you seen any Apple apps doing something similar?

caseymrm avatar Aug 03 '19 01:08 caseymrm

So probably not something I will get to in the near future.

Thats fine, I just wanted to make sure I'm not missing a toggle or something.

What's the use case, a list of options to toggle?

More or less, yes. I have items that switch their parent dependent on their inner 'state'. Works fine and if I set a sleep on the toggle I can even see the switch from one parent to the other when opening the app fast enough.

Have you seen any Apple apps doing something similar?

No.

Well thanks anyways for the project, really having fun with this as my first go project.

gregod-com avatar Aug 03 '19 08:08 gregod-com

Gotcha, I'll keep that use case in mind when I do custom views.

If you have experience (or interest) in Objective C, I do think you could get something working by adding a new type in the populate function.

Another thing that's a bit hacky but might give you what you want is to add a way to programmatically pop up a menu, then you could call it to re-open the menu after it was selected. Looks like it's possible: https://stackoverflow.com/questions/33585109/how-to-programatically-open-status-bar-app

caseymrm avatar Aug 05 '19 07:08 caseymrm