Re: CD: subclassing NSArrayController
Re: CD: subclassing NSArrayController
- Subject: Re: CD: subclassing NSArrayController
- From: Yann Bizeul <email@hidden>
- Date: Mon, 26 Sep 2005 21:34:15 +0200
In my app, what I'd like to do is have a tableview that lists all
the objects that I have added. But instead of having a Master
Interface, I would like to have 2 buttons, add and remove. When I
would click on the add button, I would get a sheet with things I
can fill in and when I close the sheet, by clicking save or
something, this object should get added to the tableview.
What's the best way to do this? I was thinking of subclassing the
NSArrayController that represents my objects and override the add
method to show up a sheet. When I then click on save, I then call
[NSEntityDescription
insertNewObjectForEntityForName:inManagedObjectContext:context],
setup the values of the object to the ones from the TextFields and
other elements and close the sheet.
Is that a good method or is there another solution?
I would do the same (in fact, i did the same, the difference is I add
an "Untitled" object before showing the sheet).
Also, I noticed that relationship show up as popupmenu in the
TableView. I don't want that, instead I would like to display what
is selected, without the popupmenu. I tried removing the data cell,
but that didn't work too well.
Did you automatically create GUI elements by drag&dropping entities
in IB ? If so, this should be the standard behavior; you can change
the NSCell associated with the NSTableColumn : Drag&drop another
NSCell (like NSTextFieldCell ("Text") from Cocoa Data Views toolbar
icon of IB Palette) to your NSTableColumn.
Yann Bizeul • yann at tynsoe.org
Cocoa Developer
Tynsoe Projects
BuddyPop • GeekTool • SSH Tunnel Manager • ...
http://projects.tynsoe.org/ _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden