RE: Opening persistent data store -- Problem solved, thanks.
RE: Opening persistent data store -- Problem solved, thanks.
- Subject: RE: Opening persistent data store -- Problem solved, thanks.
- From: John Velman <email@hidden>
- Date: Wed, 12 Nov 2008 11:42:50 -0800
Bcc:
Subject: Problem Solved,and Thanks Re: Opening persistent data store
Reply-To:
In-Reply-To: <email@hidden>
A note of thanks to Jerry, Charles, and Quincey
And an update on my progress.
Sorry this took so long, but I haven't had much chance to work on this
during the past week.
Here is the update:
First, a main issue that caused me to do the hack was an emotional failure
to recognize that a method named "readFromURL.." didn't actually have to
read the file! This was really dumb on my part. Your responses helped me
overcome that particular dumbness.
Second, I needed to get the "openPanel" somehow. From your responses, I
concluded that this should be a non-problem. The documentation on this was
kind of sparse (the way I read it anyway), but going back over "Document
Based Applications" overview carefully, and doing some other stuff, lead me
to the right conclusion: NSDocumentController has a delegate method
"openDocument" that handles this. All I had to do was connect the menu
item to "First Responder"'s openDocument in the MainMenu nib. I think
Hillgass should have indexed this.
Third, I didn't get "Open Recent" because I hadn't filled in my info.plist
completely!
And Finally, to clean things up some more I added an AppController to the
MainMenu NIB so I could prevent the "untitled document" opening.
OK. Everything works great. Once I open the database with the program, it
shows up with the icon in finder, and I can open it by double clicking the
database icon. Also, file -> open, and file -> open recent. work just
fine.
My situation wasn't nearly as grim as suggested by Jerry, since I had in
fact tried to follow the document and architecture and MVC pattern
(although as a newbie, I'm certainly doing some other things in suboptimal
ways..).
I do have a question though: Jerry, you said "you'll have discovered two
or three more little features that don't work.." Did you have anything in
particular in mind? I don't need undo and redo (all changes to database
are directly to database via sql, and one table in database keeps a
historical record which can be used for undo ...). Likewise, I don't need
'save', 'save as' , 'new'...
Well, Thanks Again.
Best,
John Velman
On Sat, Nov 08, 2008 at 07:49:15PM -0800, John Velman wrote:
> This is not a "how to" question, it's an "is there a better way" question.
> Needless to say, I'm new at this.
>
> My app uses a sqlite3 database for it's document data. I'm NOT using core
> data for a variety of reasons.
>
> The app is document based and has multiple windows with multiple views into
> the data for browsing, editing and adding. So far I'm doing just fine,
> having learned a lot from this list, from Hillgass, and Anderson, and lots
> of other sources.
>
> Now, to open the database I use the File -> Open menu, connected to a
> method findDatabase in the "first responder" of the NIB. This falls
> through to MyDocument, which implements that method, following along more
> or less with Hillgass, third edition, page 255 with
> -beginSheetForDirectory and -openPanelDidEnd.
>
> Works like a charm. But is this the "right" way to go, or is there a more
> cocoa-ish way to do it using?
>
> One thing that leads me to this question is that I can't seem to find
> simple a way to hook up File->Open Recent. Documentation says of
> -noteNewRecentDocumentURL:(NSURL *)aURL that "NSDocument automatically
> calls this method when appropriate for NSDocument-based applications."
>
> Is there a NSDocument method I should be overriding? It's probably
> obvious, but there is sooo much to read...
>
> Thanks,
>
> John Velman
> _______________________________________________
>
> 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
_______________________________________________
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