Hide NSWindowToolbarButton - cocoa

What do I have to do for hiding this NSWindowToolbarButton in windows with a NSToolbar?

There's a checkbox for this in the appearance section of the attributes tab of the inspector for a window in Interface Builder.

I have it...
[NSWindow setShowsToolbarButton:NO]

FYI, if you ever need access to any of the window buttons, or to find out if a particular window even has a certain button, you can use standardWindowButton: Take a look at the corresponding Apple Docs

Related

Firefox User Agent Switcher - how do I get to it?

https://addons.mozilla.org/en-US/firefox/addon/user-agent-switcher/
I've installed it in Firefox, but, how do I actually get to it? I don't see it in my toolbar, I don't see if it I right click anywhere close to my toolbar. It's not one of the Chrome-looking extension buttons. Thanks.
Right click your navigation toolbar and click "Customize", then scroll down and
find User Agent Switcher icon. You can drag&drop it to your navigation toolbar.
You can start using it this way.
Instructions here: http://chrispederick.com/work/user-agent-switcher/screencasts/#access-firefox-4-video
Underneath tools you should see a "Default User Agent" drop down. Roll over this menu item and you should see alternative User Agents. Screenshot # http://www.bemoko.com/training/help/product/useragent-switcher including an import file with a good collection of mobile user agents (nicely organised and annotated with screen dimensions)

Detect click on OS X menu bar?

I'm curious if there's a trick to detecting a click on the Menu Bar as a whole. I know I can detect a click on an NSStatusItem or NSMenu, but I am looking for events pertaining to the empty space of the Menu Bar.
Looking through the documentation, it does not seem possible. However, I wanted to know if anyone had a workaround for this functionality?
You can install a local event monitor using NSEvent addLocalMonitorForEventsMatchingMask:handler:
See the documentation located here.

Spy++ and windows closed when they lose focus

I would like to know if there is a way with Spy++ to get the properties of a window that is automatically closed when it loses the focus (which is what happens when I switch to Spy++). Thanks!
Please try - Active Accessibility Object Inspector (32-bit UNICODE Release) , it may useful.
if not then please explain your question briefly.
Thanks.
You need to use Messaging service in order to get the properties of the window. For example, if you want to know WID for menu item, you need to identify the target window by using Window Finder Tool from Window Tab of Message Option dialogue and then clear all messages from Message tab. You only need to choose VM_COMMAND. After that when you click any menu item from target window menu list, associated ID will be shown in Spy++ main window.
Hopefully the answer will be useful for you.
Thanks.
When the SPY mode is active in QTP, hold the CONTROL-button down for mouse clicks to re-establish the correct context for the AUT (application under test). Basically these control-mouseclicks will be ignored by the spy and pass through to the application.
Good question!
Ziggy

Win32 newbie: Firefox-like find bar

Firefox has this nice find-a-text-on-the-page dialog, which is non-modal and shows up at the bottom of the window. How to do something similar using just Win32? I guess there has to edit control but do I have to position it manually on parent window WM_SIZE? How do I dismiss the dialog, i.e. how to make it disappear?
As said above, use a rebar and put an edit control and the buttons that you need on it. You'll have to manage all the rest yourself, manually (close button, showing/hiding it, etc.).
I guess that is what you call a rebar...http://msdn.microsoft.com/en-us/library/bb774373(VS.85).aspx. Google if you need more info...

how do you display an NSMenu programmatically?

I wrote a little app that lives in the NSStatusBar. I want to have a global shortcut that when hit, the menu bar's content is displayed, exactly like the behavior of spotlight.
I have added a global key shortcut to my application, but I am unable to get the meun bar to display. How can I do this? I tried with "popUpContextMenu" , but that method displays the menu in the bottom left hand corner, I want the menu to open up right under the NSStatusBar menu icon.
You can do it, apple provides a method for it popUpStatusItemMenu:
I don't think there is a supported way to do this without perhaps using the Accessibility framework to simulate a click on your status item. Regardless, it's probably not a good idea to abuse a menu in this way.
The Spotlight menu bar item does not use an NSMenu, it uses a custom window/view. You might consider going this route if you have some sort of custom view to display.

Resources