How to embed a control in a Dialog box?

Discussion in 'Mac Programming' started by Tortoise001, May 14, 2008.

  1. Tortoise001 macrumors newbie

    Joined:
    May 14, 2008
    #1
    Hi,
    I have used Window's MFC to embed controls like comboBox, pushBottons to a Modal dialog box, I am wondering how similar things can be done with XCode and Cocoa, I am very new to Mac GUI programming, I need some directions as to where to start...
    E.g. In Windows, I first create a placeholder (picture frame) in Dialog Box using resource editor (similar to Mac's interface builder), then I wrote code to create controls using that placeholder ID. Are there similar concepts in Mac?
    Thanks a lot...
     
  2. Krevnik macrumors 68040

    Krevnik

    Joined:
    Sep 8, 2003
    #2
    How modal is modal? Is this like a "This application failed" modal, or "This document needs to do something" modal?

    On OS X you have two levels of modal. Sheets (usually recommended) are modal for a particular window, usually a document or the main app window if you aren't document-based. Then you have application modal windows.

    In OS X, a dialog is simply a window (if they are application modal), a sheet is usually a panel. You can add this to your UI in interface builder, and lay out the sheet or window like any other window. There are a couple APIs that let you setup a window to run as modal in Cocoa.

    Application Modal:
    http://developer.apple.com/document...ef/occ/instm/NSApplication/runModalForWindow:

    Window Modal (Sheet):
    http://developer.apple.com/document...dow:modalDelegate:didEndSelector:contextInfo:
     

Share This Page