I'm implementing an NSPopover and having it appear in the status bar by setting it as a custom view. I've set its behavior to Transient, and also added a global event monitor so that when any other application gets focus, the NSPopover goes away.
This is working fairly well but the only problem I'm running into is that click on the popover brings to focus the main window of the application. If I put the window on one space and view the popover on another space and interact with the popover, I get thrown back to the space with the main window and it gets focused. Is there a way to prevent this? Perhaps allow interaction with the popover without activating the application?
Related
I have an Objective-C application with a main window and a small progress window with a stack view to show the current progress.
If the application is put in the background by activating any other application and then clicking on the Dock icon, both the Main and secondary windows is brought to the front and shown.
But, if I just click one of the windows when in the background, only that window is activated and brought to the front, the other stays in the back.
I want to implement so that when I click on the main window it does the same thing as clicking on the Dock icon, it should show both windows on top with the Main window activated.
But if I click on the progress window, I don't want the main window to be brought to the front.
I haven't been able to find a way to do this, how should I go about achieving this?
You can detect the window being clicked with the window delegate's -windowDidBecomeKey: or -becomeKeyWindow, or the app delegate's -didBecomeActive:.
Then depending on your exact needs, you can use [NSApp activateIgnoringOtherApps:] or [[NSRunningApplication currentApplication] activateWithOptions:] (and possibly NSApplicationActivateAllWindows).
I'm making a statusbar application and load a new xib containing the main window for the application when clicking on a statusbar menu item. However, in the process I deleted the application menu bar. I don't see a way to hook up the NSMenu object I created in the interface builder.
The window loads just fine, and the status bar icon is still present, but when I make the main window the key window, the application menu bar doesn't change, it just shows the previous app that was active.
I have followed the instructions/suggestions here and here, but neither of them work. Is there some other step I've missed?
Thanks!
The behavior you're describing is normal for background applications. If you don't have an icon in the Dock, you don't get your own menubar, even if you have a window in the foreground.
I am developing an application with an NSTabView with multiple NSTabViewItems. Each of the NSTabViewItems has a WebView subview. The WebView works as expected except when Flash or Silverlight are running in one of the WebViews. If, while Flash or Silverlight are running, a different tab is selected, the media will stop. When that tab is selected again, the media will restart. Is there any way around this (i.e. to allow the media to continue to run when a different NSTabViewItem is selected)? Does the NSTabViewItem send a message to its subviews when a different NSTabViewItem has been selected?
I'm not sure if this is why, but try check your webviews if their shouldUpdateWhileOffscreen is enabled. If it's enabled but the other tabs still doesn't load, then I'm guessing it's the design of the NSTabView, which is something on the lines of encoding it when the tab switches away, then decoding it when the user selects that tab again. In that case, I would probably do something like having a NSTabView with empty views and put the WebViews as subviews of the content view, overlaying each other and set the WebViews as hidden/visible whenever another tabview is selected.
I've seen a couple of apps that show a transparent view on top of the current ui while the keyboard is present and if clicked it hides the keyboard. I looked around the web and couldnt find a solution for this problem.
Simply add a UIButton, custom type, the size of your screen and add it to your view when your text field (or other entry) takes focus. Make sure your edit view is brought to the front of its superview at the point you add the button (to ensure the edit view still responds to touch).
Add a target to the button which dismisses the keyboard ([myTextfield resignFirstResponder]) and removes the button.
Also make sure to remove the button when the textField dismisses normally.
In the iPhone Objective-C app, I want to pop-up a window (which is smaller than the main view, and the app does not stop running) when a button is tapped, with textField for the user to input text, and dismiss it when it is done.
This is widely used but I really cannot google the relevant content out.
What view should I use to connect it with the button? AlertView (which seems you cannot add dialogue in), ModalView?
Are there relevant info somewhere?
Thanks.
Make the popup it's own, full-sized window. Put a UIImageView in behind your popup screen, and duplicate the results of the normal window. That way, it will look like a popup window, but it still has the proper animation speed and everything. If you do it as a real popup, the game itself will slow down and look jumpy.
You can create any view and use UIViewController's presentModalViewController: to display a modal view controller (and even animate it).