How to prevent my macOS Menu Bar app from disappearing - macos

I've been playing around with creating a Menu Bar app for macOS.
The app consists of an icon along with a title. The title displays additional context and can be dynamic width.
I've noticed that when the Menu Bar does not have enough room to display the icon AND context, it hides the whole app completely (icon and context) until there is space once again to show it.
Is it possible to prevent it from doing this somehow? Or at the very least maintain the icon visibility without the title, if room doesn't allow?

Unfortunately no, NSStatusItem lacks methods to indicate visibility or occlusion. The functionality you want might be possible via notification, but that is up to Apple to implement.

You may use two separate NSStatusItem. Looks like after creation they should be adjacent, until user reorders them with Cmd-drag.

Related

Windows Phone 7 - Possible to Put Textbox in Application Bar?

I want to create an application bar like IE has in Windows Phone 7.1 ... it has a textbox in it instead of buttons, and it still works as the application bar with menu items under it.
Is this possible. I don't see anything under the Shell namespace, and just adding a Grid to the Application bar is not working.
No, the application bar is not derived from UIElement. So you cannot add other UIElements to it.
The closest you can get is to add a Grid along the bottom of your phone screen, color it like the application bar and add a TextBlock to it. I wouldn't recommend this approach though, because it makes your app non-standard compared to all other apps available for the platform.
If you are to go this route, you can use the PhoneChromeBrush theme resource to set the color to match the application bar.

WP7 - Text Button on the Application Bar

On Windows Phone 7, go to Settings, email & accounts, add an account, the Windows Live (or any other). Note at the bottom there is the gray panel with a rectangular [sign in] button. Click in the email address field, and the on screen keyboard pops up ABOVE the gray panel. Rotate the phone, and the gray panel does not rotate, although the page does. That gray panel is the Application Bar, is it not?
I only find docs for adding an icon-based round button (and menu items). How do we put a rectangular textual button on the Application Bar?
Adding buttons in the Application Bar is not supported for third party developers. The Application Bar itself is not a Silverlight control; it's a native one. Only OEMs, certain partners and MS have access to the native SDK, so you won't be able to template the Application Bar to have buttons. Of course, you could create your own Application Bar that mimics the real one, but I don't recommend that approach as it would be very tricky to get it exactly right and be consistent between apps.
Yes, that's the application bar. Well, it's the non Silverlight version of it. (The built in apps are not built with Silverlight.)
Unfortuanately it is not possible to use text buttons on the application bar. It's only possible to use buttons with images.
Yes it would be nice/useful in a number of situations but it's just not possible with the current SDK (even Mango). I keep hoping it'll be there in a future version...
The applications that come with the phone are not restricted to using developer APIs and the one you mention likely uses C++ and / or restricted APIs. As a third-party developer your only option is to stick with icons on the application bar.
You can always create a Panel colored like the application bar, aligned along the bottom of the screen and display buttons or whatever other UI element you want to.

Using the Panorama for only part of the App

I'm new to WP7, coming from .Net/Silverlight.
I like the Panorama idea, which would work well with the application I have in mind. However, on the side of the panorama, I need to have a few other screens which do not interact with the main Panorama, so I was thinking of creating a menu at the beginning to select in which branch the user wants to go.
Can I use the Panorama app to meet this need, or do I need to do a classic app and handle myself the screen transitions?
You can do this with the panorama.
It's quite common for a panorama to have an item which is a menu containing links to other parts of the app.
This can help you have a better picture of how you can embed menu in your panorama control:
http://mobilewares.net/images/WP7/BSRV1/sm/panorama.png

How to add an application bar to a user control in wp7

I have built a wizard style user control that lets you add stackpanel based pages and flick between them.
I would like to add an application bar as part of the user control with next and previous buttons that enable/disable based on page displayed etc.
Application bar appears to be an attached property of PhoneApplicationPage. I have tried referencing Microsoft.Phone.Shell but get invalid type.
Any ideas how I can add it to my user control?
Application bar is such a pain in the a**. This control is not a Silverlight one but a native one. Maybe you can be more lucky with this solution:
http://blog.humann.info/post/2010/08/27/How-to-have-binding-on-the-ApplicationBar.aspx
The ApplicationBar is a service that is provided by the operating system, i.e. not part of the Framework, and can only be used at the page-level, not in your UserControl. In addition, the ApplicationBar does not support regular bindings as you've seen. As mentioned above there are a number of solutions that provide workarounds for this problem.
Alternatively, you could use the ApplicationBarButtonCommand and ApplicationBarButtonNavigation behaviors from the Silverlight Windows Phone Toolkit. It's a simple enough task to create your ApplicationBarMenuCommand if you need one.

NSWindow Mac App Store like Title Bar

How could I make an NSWindow's title bar look like that of the Mac App Store or of the app Feeder where it's height is increased and other controls are show in it.
To see what I mean just check out the website for the Mac App Store : http://www.apple.com/mac/app-store/.
Is it a custom NSWindow or is it a completely borderless window with an NSView made to look like the title bar?
https://github.com/indragiek/INAppStoreWindow
Title bar and traffic light customization for NSWindow
INAppStoreWindow is an NSWindow subclass that was originally developed to mimic the appearance of the main window in the Mac App Store application introduced in OS X 10.6.6.
The MAS application has since transitioned away from this design, but INAppStoreWindow is still being actively developed to provide extensive additional customization options for NSWindow title bars...
For iTunes (v9.x) Apple used no toolbar, but custom aligned icons and controls in the top bar, to achieve a similar effect. (see link below)
The window looks like a "textured & unified title and toolbar" window to me. (or a slight variant of such)
To reposition the traffic light buttons follow my answer to this question.
However, as Dave DeLong already (similarly) commented: "The UI is terrible. Please don't even think about it."
You can also take a look at http://orestis.gr/blog/2007/09/24/messing-with-windows/ . This uses some undocumented stuff, though, so it won't actually get approved FOR the App Store.

Resources