• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
cocoa design for a database application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cocoa design for a database application


  • Subject: cocoa design for a database application
  • From: email@hidden
  • Date: Sun, 11 Jan 2009 12:52:42 -0500


I've developed some small Cocoa programs and now I'm looking to learn some of the more advanced topics (bindings, controllers, etc.). I'd like to create a Cocoa program that has multiple "document types" corresponding to tables in a database (i.e., I'll be able to open separate windows for various rows in various tables). I've worked through the NSArrayController example in chapter 8 of the Hillegas book.


So I'm starting out with a simple prototype to try to learn. I didn't use an NSDocument application because my application will eventually have multiple document types for the separate tables in the database.

What I want to do is have a window that I can click on a button that says "new person" and I want it to open a window (from a separate nib file) with text fields for entering a first and last name. I created a separate Window nib file (PersonWindow.xib) for this new window. I put a NSObjectController (PersonController) in that nib file that I will use for the bindings. What do I need to do in the new person button action to tell it to create and open the window for this nib file?

Looking through the documentation made me think I needed a NSWindowController so I tried this, but I'm fairly certain it's not correct.

-(IBAction)newPressed:(id) sender {
NSLog(@"newPressed");
Person *person = [[Person alloc] init];
person.firstName = @"blank";
PersonController *pc = [[PersonController alloc] initWithContent:person];
NSWindowController *wc = [[NSWindowController alloc] initWithWindowNibName:@"PersonWindow" owner:pc];
NSWindow *window = [wc window];
[window display];
}


The window never opens and I see the message:
Cannot create BOOL from object <NSTextField: 0x16bba0> of class NSTextField


I don't know if this is because I didn't set up the bindings correctly or if something else is wrong (I suspect both).

Also, should my Person class just have a NSMutableDictionary (for storing the first and last names) or should I declare NSString ivars for the first and last names in the person class (as properties so they have the settters/getters necessary to work with bindings).

Pointers to relevant documentation are also welcome.

Thanks in advance,
Dave


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: cocoa design for a database application
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Using UIImageView for animations
  • Next by Date: Re: 2 questions
  • Previous by thread: Re: Highlighting an NSPopUpButtonCell subclass
  • Next by thread: Re: cocoa design for a database application
  • Index(es):
    • Date
    • Thread