So basically I already have an application built. And I'd like to create an NSPanel or an NSWindow that will basically appear to the right of my application when a button is clicked. And then it auto-collapses when the button is clicked again.
I've been googling randomly but I feel like I'm not searching for the right things.
Ideally it will operate EXACTLY like [NSApp beginSheet] except it won't take control of the application, it will just be another window to the right a user can interact with.
How can I get started with this?
Thanks!
3 years later.
If you wish to add the Drawer to an existing Window.
Bingo. Disclosure Button will open/close the Drawer
SIDENOTE:
The Drawer concept clashes with the iPhone/iPad UI/UX since there is no side real-estate for something to slide out into. Drawers are cool in my opinion. And killer easy to add. And perfectly sized to the Window.
It sounds like you want a drawer (NSDrawer). Drawers have fallen out of favor with most app designers but are still an official, supported part of Cocoa on Mac OSX. You might use a drawer to hide a bunch of controls that you don't want to be cluttering up your main window all the time.
Search for "Drawer" in the Xcode and under Titles you'll see a Drawers guide and DrawerMadness sample code. You can have a button open and close the drawer with very little code.
A good pro/con discussion of using drawers
A more general solution is a child window. It's just a completely separate window (probably without a titlebar) that is attached to your document or other window (I'm assuming "right of my application" in your question means "right of my window"). See documentation for NSWindow addChildWindow:ordered: The child window will remain attached to its parent window even when the window is dragged. But child windows are a lot more work than drawers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.