I am developing a menu bar application for os x. I am using NSPopover to create a popup window.
However when some other application is full screen that popup is not visible. What settings should be set, so that popup window is always on top.
I struggled with this as well. When I had this problem, I created a invisible window that would flow above all other windows, including full screen ones. The window would then activate the popover.
However, I found a much cleaner solution here.
Related
I am writing a menubar application with a popup view but no menu and no storyboard. Among other things, I want to activate a button with keyboard shortcut.
Everything I have found so far is either for Swift 2.0 or for menu based applications. I would like my application to run on Catalina, though by the time it is finished I know that Big Sur will be out.
Is there a way for a SwiftUI button to respond to a keyboard shortcut, or some other way for a view to do that?
I am on MacOS 10.15.6, and XCode 11.7.
Is it possible to add a "New Tab" button to the tabBar, like Safari and Finder has? My app is a Mac Catalyst app and has support for multiple windows, but to open new windows the user has to select it from the menu bar or use keyboard shortcuts.
The idea is to have this built-in Tab Bar work much like https://github.com/stuffmc/TabbedViews does.
.
The built-in one has:
No + button (and no New Tab menu either)
Only the option to display the full display of a window. This one can display the Tab Bar anywhere, and especially also on iOS.
This one though has no support yet for Move Tab to New Window and of course one need not to forget to remove Merge All Windows, otherwise both will conflict.
I have a simple Menubar app in which it has 2 options - namely Preferences & Quit
After clicking on Preferences it opens a new window but doesn't show the menu bar
I tried connecting from Main Menu to the Window Controller but it doesn't work.
I drag it from the Application Name to the Window Controller or View Controller using Ctrl+Drag but still it doesn't work.
Another issue is my Preferences Window is resizing even though I unchecked the resize button in the Attributes Inspector.
Even Maximise & Minimise checkboxes are disabled but they are still showing.
Any solutions?
See NSApplication.activationPolicy.
If you want the app's main menu bar to appear, you'll need to change the activationPolicy to NSApplicationActivationPolicyRegular. Once you do that, the app's main menu will appear when your app is the active one. (It will also appear in the dock.)
If you want this to happen only when your preferences window is open, then you'll need to change the activationPolicy when the window opens, then set it back again when it closes.
You don't need to connect any outlets for this; the Main Menu should already be a resource for your app and should be loaded automatically when your app launches.
I think I had given Storyboard Id to my View Controller rather than my Window Controller so it wasn't working.
I also checked some apps like Dropbox which didn't have Main Menu Bar because it was a background or accessory app so I ditched it.
Some apps like Focus have it though. But I went with the popular choice.
As for no resizing, no minimising & no maximising goes, I pasted below code & it worked
var myWindow: NSWindow? = nil
myWindow?.styleMask.remove(NSWindow.StyleMask.resizable)
myWindow?.standardWindowButton(.miniaturizeButton)?.isEnabled=false
myWindow?.standardWindowButton(.zoomButton)?.isEnabled=false
I have a horizontally scrolling NSCollectionView. The items are created but it is not scrollable until I manually resize the window in a horizontal direction. After that I scrolls fine. Does anybody know how to fix this? I looked at this question (question link) and tried the suggested solutions but I think its a different problem since it works after resizing the window.
EDIT:
The collection view is in a tableview cell. I have other collection views (although vertically scrolling and not in a tableview cell) in the same application and they work fine.
I solved it just by add this on my collectionView:
[self.yourCollectionView setFrameSize:self.yourCollectionView.collectionViewLayout.collectionViewContentSize];
I been experiencing similar issue for so many years and finally figured out that this is caused by Xcode.
When force quitting your application with Xcode (by ether clicking Run or Stop when application is running), Xcode saves the window's frame and restore it on next launch, even when your window is not configured to autosave its frame.
This is good for development but for some reasons, this causes the document view of the scroll view (mostly collection view) to not use the correct bounds in the next application run.
Manually setting collection view's frameSize as many people suggested doesn't always works. However, if you quit your application normally:
Click Application Menu and select Quit Application Name
Use keyboard shortcut ⌘Q
Right click on Dock icon and select Quit (with ⌥ or not)
Force quit in Force Quit Applications window (⌘⌥⎋)
...
Anything will works as you expected in the next application run (including launching from Xcode).
i'am using Eclipse and two monitors. My Laptos's screen is not enough big to show Console tap. Is there a way for showing Console Tab at different monitor screen?
Idea?
Yes, you can. You can drag the Console tap out of Eclipse workbench window. Then the view is detached from the workbench window. After the view is detached, you can move it to the other monitor screen.
Anyone else had the popped out console window move back to the primary monitor after it has been dragged to the secondary monitor? Seems to happen when eclipse pops up a dialog box for some reason.
This is a bit annoying. I like having a console window on a monitor I've got in portrait mode, very handy for watching unit tests execute.