Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
57 views

How to get Menustyle for Views in SwiftUI Without using Menu?

I have an status menu that uses NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength). I am porting a MenuBarExtra that has many Views and state attributes. I want to avoid using ...
Elijah's user avatar
  • 2,055
-1 votes
1 answer
29 views

How do I get the macOS app-specific Help menu search bar to appear?

I have a macOS app written in objective-c. Initially, I didn't want to provide a Help menu, so I removed the 'Help' top-level menu item from the storyboard. Now I want to add a help facility, and ...
steveo1951's user avatar
0 votes
1 answer
59 views

How to pass a Rust function as a selector into NSMenuItem.action using objc2?

I have the next code to build an application menu in AppDelegate (an AppDelegate code was taken from the official example): impl AppDelegate { fn new(mtm: MainThreadMarker, menu: Option<Menu>...
Denis Steinman's user avatar
1 vote
0 answers
76 views

Mac app's Enter Full Screen functionality is not working

I'm encountering an issue while developing my Mac app and I have a question. Even in a test app with no additional features, after Hide (cmd + h) or Minimize (cmd + m) and then activating the app ...
I have a question's user avatar
1 vote
0 answers
57 views

Why is a dummy NSMenuItem needed to make the next NSMenuItem actually appear?

I want to programmatically populate an NSMenuToolbarItem's NSMenu. let toolbarItem = NSMenuToolbarItem(itemIdentifier: ...) toolbarItem.image = ... toolbarItem.label = ... toolbarItem.menu.delegate = ...
user10711707's user avatar
0 votes
0 answers
143 views

NSMenuItem not clickable after updating to Sonoma

I have a CEF application where the menu bar is set programatically. On Ventura, the menu bar behaved as expected, but after updating to Sonoma, clicking on any menu item does not expand it. This ...
mrrxgers's user avatar
2 votes
0 answers
211 views

How to use SwiftUI in NSMenu?

I'm new to Swift and I am developing a menubar app. I have a SwiftUI view with a bunch of Picker and Text views, and display data. The SwiftUI in menubar NSMenu is not clickable and greyed out. struct ...
Huang's user avatar
  • 21
1 vote
0 answers
97 views

Unable to dismiss "NSWindowController" for a Mac app

I have created a menu bar app for Mac. I want to open the app when clicking on menu bar icon. After updating the OS to Ventura (13.4 (22F66)) I am observing an issue where the NSWindowController is ...
subin272's user avatar
  • 753
0 votes
0 answers
61 views

NSCollectionView inside NSMenu don‘t update properly when menu not shown

I want to put an NSCollectionView inside a menu. It's pretty simple: private func configurePlaylistLibraryMenu() { let playlistlibraryvievController = PlaylistLabraryViewController(player: ...
Nikolai Nagornyi's user avatar
1 vote
1 answer
602 views

Displaying NSMenuItem in SwiftUI on it's own

I have been trying to display a custom NSMenuItem (for a preview page of a menu manager) inside a SwiftUI view. But I can't achieve it. I have figured it needs to wrapped inside a menu first, and ...
norwegiandev's user avatar
2 votes
0 answers
61 views

NSMenu Subclass does not respond to mouse click

I am subclassing an NSPopUpButton with the purpose of having control over the drawing methods of the button itself, but also the NSMenu that will pop up. Therefore I am also subclassing NSMenu and - ...
MassMover's user avatar
  • 539
0 votes
2 answers
171 views

Application main NSMenu not responding without window reactivation

I'm trying a minimalistic Cocoa app as described in this page using code: #import <Cocoa/Cocoa.h>; int main () { [NSAutoreleasePool new]; [NSApplication sharedApplication]; [NSApp ...
Oldes's user avatar
  • 989
0 votes
0 answers
67 views

MacOS Cocoa Detect When Keyboard Macro Program Presses Modifier Keys

I am working on a third-party plugin in a host application (Finale). My plugin can tell Finale to create any number of menu options in its designated menu. My plugin can then fish them out and ...
rpatters1's user avatar
  • 434
0 votes
1 answer
236 views

refresh NSMenuItem on click/open of NSStatusItem

I have the following extension where I have a NSMenuItem with it's state being either on or off: extension AppDelegate { func createStatusBarItem() { let sBar = NSStatusBar.system ...
Christian's user avatar
2 votes
0 answers
226 views

NSMenuItem.separator() is a blank space rather than a line

I'm building a Finder extension for OSX, I want to add a separator to the contextMenu of Finder, but I can't see the separator line: The separator I want to add is like this: Here is the related ...
EssExx's user avatar
  • 49
0 votes
1 answer
252 views

Swift NSMenu items are grey out

I have a menu with menu items. The problem is that my menu items are all greyed out or not enabled public override init() { super.init() let menu = NSMenuItem(title: "Debug", action: ...
jerry seigle's user avatar
0 votes
1 answer
777 views

How to customize a NSPopUpButton and its NSMenu?

I want to style a NSPopUpButton with my own colors. I've gotten pretty much everything else to work except for the caps at the top and bottom of the menu and I can't get the NSPopUpButton to show an ...
Melodius's user avatar
  • 2,725
0 votes
1 answer
605 views

Show NSMenu when clicking on a Button in SwiftUI view

I'm trying to show a NSMenu when clicking on a Button in a SwiftUI view, but nothing is displayed with the code I'm using. Here it is: HStack { Spacer(minLength: 100) Button(action: { ...
Andrea Mario Lufino's user avatar
1 vote
0 answers
24 views

Disable clicking on FinderSync extension submenu

I am writing a FinderSync extension in Swift, and am creating a submenu like such: let menu = NSMenu(title: "") let newsub = NSMenu(); newsub.addItem(withTitle: "Folder", action: #...
orlp's user avatar
  • 116k
-1 votes
1 answer
507 views

Adding NSMenuItem to NSApp.MainMenu not inserting new menu item

I'm using the following code to add a new menu item programatically override func viewDidLoad() { let mainMenu = NSApp.mainMenu let myMenu = NSMenuItem(title: "MenuTitle", action: ...
techno's user avatar
  • 6,418
0 votes
0 answers
240 views

Cocoa macOs NSMenu, contextMenu, right click

I searched the all posts and around on the internet but couldn't find anything for mac app that could solve my problem. The contextMenu is not displayed when I start the app and right click. // MARK: -...
devSwift's user avatar
0 votes
4 answers
220 views

Where can I declare my trigger for NSMenu?

I manually created an NSMenu in my AppDelegate like so: class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate { func applicationDidFinishLaunching(_ notification: Notification) { ...
Willey3x37's user avatar
1 vote
0 answers
160 views

Is there a way to get keyboard input inside an NSMenuItem?

I'm trying to make an NSMenu which contains an NSMenuItem, and inside that NSMenuItem I want a TextField that I can interact with. My goal is to make a menubar note taking app, so in theory I could ...
Zac's user avatar
  • 821
2 votes
1 answer
585 views

How do I detect if an NSMenu is closed?

I started down this rabbit hole because a SwiftUI button, designated to pop up a menu, with a .buttonStyle(BorderlessButtonStyle()) style wasn't behaving correctly when switching from a light to a ...
tyirvine's user avatar
  • 2,233
0 votes
0 answers
181 views

Populate submenu when NSMenu/NSMenuItem are moused over?

On MacOS, I have a submenu with dynamic contents that would be expensive to constantly rebuild. It would be great if when the user moves the mouse over the parent item -- before the submenu is ...
SMGreenfield's user avatar
  • 1,720
4 votes
2 answers
537 views

How to create an NSMenu containing an NSMenuItem which only appears while holding a keyboard modifier key?

I'd like to create an NSMenu containing an NSMenuItem which is hidden by default, and only appears while the user is holding a keyboard modifier key. Basically, I'm looking for the same behaviour as ...
Noah Nuebling's user avatar
0 votes
1 answer
570 views

Open and bring new window to front when pressing NSMenuItem

I have a macOS menu application that is running as an agent (LSUIElement). I need it to have a companion settings window. There is a "settings" NSMenuItem in the NSMenu, and the requirement ...
Chris's user avatar
  • 8,342
1 vote
1 answer
265 views

View in NSMenu not clickable if window is invisible

I experience a really strange behaviour with an NSMenu in an "Application is agent"-Application. I have the following simple code to setup a titlebar icon with an NSMenu. The menu contains a ...
user688262's user avatar
1 vote
1 answer
689 views

How to add a button to a NSMenu that is used as Status bar menu?

I am using following code to create a statusbar menu for my app on MacOS: let statusBarItem = NSStatusBar.system.statusItem(withLength: -1) func applicationDidFinishLaunching(_ aNotification: ...
user688262's user avatar
0 votes
2 answers
90 views

Create Cocoa application without NSMenu

I'd like to create an application that pops up dialogs based on system events. However, this application should not have an NSMenu associated with it. What I've tried, none of which worked: Removing ...
rein's user avatar
  • 33.4k
3 votes
2 answers
380 views

Toggle NSStatusItem's Menu Open/Closed Using Hot Key - Code Execution Queued/Blocked

I'm editing this question because I think I may have oversimplified the way in which my status item's menu opens. It's ridiculously complicated for such a simple function! My status item supports both ...
William Gustafson's user avatar
0 votes
1 answer
269 views

Is NSMenu willClose notitfication possible?

Is it possible for an NSMenu object to notify BEFORE it'll close, not after? Its delegate has method didClose(_:) but I want to update its items before it actually closes, since the disappearing ...
Vitalii Vashchenko's user avatar
1 vote
1 answer
626 views

How to create Cocoa app main menu application programatically [closed]

I am creating simple Cocoa application from scratch, just to learn the process. However I am not able to create Application Menu. I have this code: - (void)applicationDidFinishLaunching:(...
RuLoViC's user avatar
  • 845
11 votes
1 answer
3k views

SwiftUI: How to implement Edit menu in macOS app

I am building a macOS-app using SwiftUI and the new App lifecycle. All the default macOS menu items (like cut, copy, paste) are already there after starting a new project but they’re greyed out. How ...
ixany's user avatar
  • 5,941
8 votes
4 answers
3k views

SwiftUI: Change “About View” in macOS app

I am building a macOS-app using SwiftUI and the new App lifecycle. I would love to change the contents of the “About Window” (that appears when you tap “About DemoApp” in the apps’ menu) but have no ...
ixany's user avatar
  • 5,941
4 votes
1 answer
410 views

How to enable auto generation of Window MenuItems (e.g. Tile Window to Left/Right of Screen and Open file with checkmark) in macOS menubar

I am currently creating a macOS menubar for an app without using any interface builder (no XIB/NIB files), just pure code. However I was expecting some items to be auto-generated during the start-up ...
ujin's user avatar
  • 41
0 votes
2 answers
554 views

NSMenuItem with custom view disappears while scrolling

I implement a NSMenu with NSMenuItem and set custom view to it. When menu is scrollable, mouse hovering on ▼ button to scroll will cause some menuItem disappear (or not draw correctly). Hope someone ...
Yueh-Ming Chien's user avatar
1 vote
2 answers
277 views

Listen for Actions on a NSStatusItem With a Menu

I have a NSStatusItem with a menu attached. How can I get mouse/touch events from the status item without losing the menu? I was thinking perhaps some kind of workaround where I take in the events and ...
Kyle Berezin's user avatar
6 votes
0 answers
503 views

NSMenuItem with custom view in macOS 11 Big Sur

macOS 11 Big Sur in its current iteration (beta 1 through beta 6) has a bug/feature that makes it hard to have NSMenuItem with the custom view. Specifically, the custom view of an item won't get a ...
Vitalii Vashchenko's user avatar
0 votes
1 answer
195 views

Enable menu items and call function when activated in AppleScript

I'm trying to enable the NSMenuItems that I have but it doesn't seem to be working. I'm not sure what I'm doing wrong and I'm fairly new at AppleScript. When the menu items are clicked they need to ...
Anmol's user avatar
  • 3
3 votes
1 answer
547 views

How do I use isAlternative with an NSMenuItem with a customView?

I'm attempting to use the isAlternative property with an NSMenuItem with a custom view. It is not behaving as a standard NSMenuItem without a custom view. How do I get the standard modifier-key ...
Ian Gordon's user avatar
0 votes
0 answers
60 views

MacOS 11: NSMenu 3px too small

On MacOS 11.0 Beta (20A4299v), I created a new MacOS app project in XCode (11.4.1 (11E503a)). I added a NSPopUpButton to the default window, and introduced the following to customize this ...
phimuemue's user avatar
  • 35.7k
1 vote
1 answer
555 views

Objective-C, NSPopMenuButton & NSMenu Color

I have an NSPopMenuButton which is connected to an NSMenu in the standard way. I tried sub-classing both in an attempt to change the background color of the menu itself. I'm clearly not doing ...
Joe Habadas's user avatar
0 votes
0 answers
93 views

Find out from which control a popup menu is triggered

I have a series of NSButtons on a window, whose menu property is connected to a common NSMenu in the storyboard. In the action method triggered by that menu's item(s), I would like to find out which ...
fbitterlich's user avatar
1 vote
1 answer
735 views

Custom NSMenuItem with right-aligned detail text label

What I want to implement I am looking for a way to display a title label and a detail text label in a NSMenuItem. Preferably it would look something like this: The Title Label is left aligned with ...
dehlen's user avatar
  • 7,367
0 votes
1 answer
449 views

Why is my NSMenuItem is disabled when it has an action?

I'm implementing a custom NSToolbarItem that has a button and a dropdown, like Mail. The only thing that's not working, though, is that the NSMenuItem is disabled. Whatever I do, I can't get it ...
user4992124's user avatar
  • 1,594
0 votes
1 answer
225 views

Is `Control Click` meant to be the same as the `right click` for macOS?

I have a NSTableView in which cells are NSTextFields. I assign a menu to the text fields. Menus are supposed to open when I right click on a cell. I have this secondary click equal to click on the ...
Duck's user avatar
  • 35.8k
0 votes
1 answer
149 views

Why can my app only see selectors for menu items if they are in the AppDelegate?

I am building my first macOs app in Swift. I have managed to add a menu (NSMenu) to the Menu Bar Extra icon, but when the menu loads each menu item is shown as deactivated. I understand this is ...
thecloud_of_unknowing's user avatar
2 votes
1 answer
941 views

How to create a NSMenu Instance with SwiftUI?

I have look made some search, however could not find any information. Question is pretty straight-forward. I don't know if it is possible, but, in this link they could create a NSMenu item via xib ...
Faruk's user avatar
  • 2,439
2 votes
0 answers
555 views

NSMenuItem alternate item with no keyboard shortcut

I have a menu item that by default uses app state to trigger its enabled-ness. But in very rare situations (usually during interaction with customer support), we need to allow the user to trigger the ...
Mike Woodworth's user avatar

1
2 3 4 5
8