How to make MDIForms in objective c? - objective-c

I need to have multiple windows on main window. same as MDIForms. That means having parent and child relationship between main window and other windows.
But I am not getting how to implement this. can anyone help me for this...

Have you read the Window Programming Guide for Cocoa?
In essence, Apple's opinion of MDI is...
"The MDI tendency directly contradicts
Mac OS X, in which windows are
document-centric rather than
application-centric. No parent
application "main window" exists--the
menubar and other interface elements,
like palettes, are used to constantly
indicate which application is active.
Document windows are only constrained
by the user's desktop size (which
might span single screen or multiple
monitors)."
Taken from Apple's Switch to Mac OS X developer document (see the "Mac OS X Doesn't Use MDI" section). Whilst this is quite an old document, nothing has changed in this respect.

Related

Limiting options a user can select - OS X

I am currently creating a settings page for my Mac Application in OS X. I want to present a few predetermined options to the user that they can select. For example, for their region ID they can either select North, South, East, or West. Is there I way I could present these options to the user and then determine what they selected? I tried searching for "predetermined options", "radio button for OS X", "scroll wheel", but I didn't come up with much. I am also not sure if there is some sort of name that everyone calls a predetermined list. If there is just let me know. I am kind of new to the Objective C game and this is my first OS X app. Just looking for a nudge in the right direction here.
"Radio button(s)" is the term used, although it may help to search with "Cocoa" rather than "OS X". Using radio buttons in Cocoa is slightly more complicated than you might expect as a novice, since the radio buttons are usually organized within a matrix (NSMatrix). You could also use a pop-menu, a list (which is a simple table view), or some other UI.
A good place to start when deciding how to design your UI is Apple's OS X Human Interface Guidelines document. There's a whole chapter on controls. There's also a separate document about buttons: Button Programming Topics.

Enhance OS X Save dialogs in Cocoa (and/or Carbon)

I would like to enhance the OS X Standard Save dialog with some features (add some controls).
DefaultFolderX actually achieved this
http://www.stclairsoft.com/DefaultFolderX/faq.html
.
They note:
"This means that Default Folder X loads a small piece of program code into each application's memory space (in RAM) so that it can communicate with Navigation Services, the OS X service that provides the Open and Save dialogs."
The question is, is this the easiest way to do this?
If yes, how would someone start on this endeavor (e.g. what kind of Project in Xcode, how to handle the "hook" mechanism if at all necessary, what documentation to read)?
If you want controls at the bottom of the open/save dialog in your app, the NSSavePanel and NSOpenPanel have a function where you can set your own custom view that will sit on the bottom of the dialog. If you want to modify the NSOpenPanels and NSSavePanels differently, or across the whole system, that will take a lot of work that might just break every time Apple updates their OS.

How does "Cinch App" do it?

If you aren't familiar with Cinch, its an application on Mac App Store that allows you to resize ANY window to half/full screen size if you drag the window to the edge of the screen. Exactly like the functionality in windows 7.
Now my question is, how is it done? I have looked all over cocoa apis looking for notifications/delegate methods for whenever a window is being dragged (ALL windows, not just windows owned by the app from which code is running from) but can't find it. Looked in Core Graphics API...Quartz Display Services....but can't find it.
Any help will be greatly appreciated as I have been looking for the past week....Thanks!
Edit: Resize the window is easy since it can be done through applescript bridge..
Are you developer behind i-Snap or some other Mac App Store clone of Cinch?
I'm the developer behind Cinch, and while I try to maintain an "abundance mentality" which basically says "There's enough out there for everyone", I've been upset by the Mac App Store lowering the barrier for entry to this market which has produced a number of half-backed competitors.
I would be thrilled to see some real innovation around the work I have done, and not just clones looking to make a quick buck.
Anyway, you want to look at the Accessibility APIs. It's a Carbon C API. This is probably your best reference: http://developer.apple.com/library/mac/#samplecode/UIElementInspector/Introduction/Intro.html%23//apple_ref/doc/uid/DTS10000728
I've not used the Cinch app, but if I were to do this I'd expect to be using cocoa events. (Also see here) Specifically the mouse handling events, combined with where the mouse is currently on-screen. They probably set a variable when a window is grabbed and then track the mouse pointer until it hits an edge or until they release the mouse button.
Events are very powerful and provide very low level access to what is happening, but can also be very complex. Good luck!
I'm not sure. Maybe the developers combine apple script and carbon events. You can create carbon events to know when the mouse has been clicked or dragged

How do I create a preferences window in Objective-C?

I would like to create a preferences window like in the standard Mac OS X apps (Safari etc.). I have found resources like DBPrefsWindowController from back in 2008 that matches the Apple HIG.
Just wondering if there is a new way to accomplish this? I can't locate any standard windows in Interface Builder so I assume Apple doesn't provide those, nor can I locate a official Apple sample code for providing this standard UI.
Thank you
It seems DBPrefsWindowController is no longer available.
For now, I would recommend the up to date RHPreferences framework.
Available on GitHub. BSD Licensed.
It’s a simple and easy Preferences window controller with multiple tabs for your next Mac application.
It also provides:
Auto resizing between different sized tab views (With animation)
Custom NSToolbarItem support
Persistence of the last used tab
Support for placeholder NSToolbarItems (eg NSToolbarFlexibleSpaceItemIdentifier & NSToolbarShowFontsItemIdentifier)

Multiple windows or "pages" in an application

I am a newbie in Mac application development. I want to write a GUI application in Cocoa using Interface Builder. I want multiple screens i.e. when one button on a screen is clicked, another screen should be displayed. How can I activate a new screen at button click event?
I would heartily recommend Aaron Hilegass's book Cocoa Programming for Mac OS X. It took me from feeling like everything was impossible to being relatively competent in the space of a few short weeks. I was very impressed with it.
Apple's documentation is amazingly good, but it takes a while to get used to the style, and you will need to know which objects actually exist before you can look up how to use them, which is where Aaron's book comes in.
Your library may have a copy of it, or be able to order one for you if they don't.
I think you mean windows, not screens. Screens are the displays (monitors) on which all the user's windows from all the user's applications appear.
And I second Jonathan's recommendation of the Hillegass book.
The button has a target. That should link to the new window. As its action you can tell the window to show itself.
Take a look at:
http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/WinPanel/WinPanel.html
I think what you want is the type of interface like that seen in Coda, or System Preferences where there is a toolbar on the top of the screen that can be used to select between the content of the window.
The simplest method I have found is to use BWToolkit.
Another method is to use a series of views, and switch between them when the toolbar is clicked. I've found one description here, but that's not the one I used first (which may have been originally in Ruby Cocoa, IIRC).
NSTabView.