Hey Florijan!

Thanks for your guidance: TBQH, i already came along your described way: started out with the obvious "Hello World" stuff, playing around with IB and different techniques to deal with object's etc. Eg i already had a working version of a window with a popup box feeded from a MySQL table content (i will need this later on), i strayed accross Core Graphics to load a PNG, cut it into tiles and draw the tiles in a scroll view, etc.

I know that core data might be overkill for just storing the configuration info, but i need core data along the way (only with transient properties) so i figured it may be ok to handle everything in there.

Your hint with just creating a object controller in ConfigView did the trick! :) Sometimes you can't see the forest because of lots of trees standing in your view...

This means i need the ObjectController in every view i want to have access to the connection parameters.

However, i am now troubling around: I set the value Binding of the Textfield to the object Controllers.selection.<value> in IB, however i wont see the defaultvalue i have set in the model designer in Xcode. I already fiddled around with "Enabled" and "editable" bindings, but i didnt get it to work...?

Anyone able to point me in the right direction?

thanks
Marc


Am 22.10.2009 um 16:10 schrieb Stamenkovic Florijan:

Hi Marc,

On Oct 20, 2009, at 16:11, Marc Rink wrote:

Heyas,

I am quite new to Objective-C (and to some extend to OO concepts as well), so please be gentle with me :)

I have a core data based document application that purpose is to access a mysql database (i am using the MCP Kit). The documents in my context are Views that contain different aspects of the database (small portions consisting of some tables related to each other).
One document contains the connection parameters for the database.

I am switching the views according to Aaron Hillegass' example using a view controller (the downloadable examples are http://www.bignerdranch.com/solutions/Cocoa-3rd.tgz) .

I want to achive the following:
Upon application start the first view "ConfigViewController" is shown. It contains all connection related parameters (such as host, port, user, password and database) and a "Connect" button. Upon clicking the "Connect" button, the connection to the database is established. The result is a connection object, that i wanted to pass around the different Views.

First approach was to pass the resulting connection to the superclass of the view's (all my view's are derived from a custom superclass which extends NSViewController). For reasons i dont know, i didnt get this to work. The resulting object was invalid (nil) in the other view's.

Second approch (and better one imho) is to add a core data entity "DBConfiguration" holding all connection parameters (persistent, so you dont have to enter the stuff every time) and a transient property for the connection object (of type undefined). I added a Object Controller to my documents xib file, set the mode to "Entity" and the entity name to "DBConfiguration". My Problem now is: The view containing the textfields and the "connect" button are in a different xib file (ConfigView.xib, whose Files Owner is of Type "ConfigViewController". I dont know how to bind the ConfigView's text fields to the Object Controller in MyDocument.xib.

OK, this was a lot of info. What is your actual problem? Can't you simply make another object controller for DBConfig in ConfigView.xib?

Also note that CoreData is probably not the right solution for storing your connection info. From what you say the user defaults system seems much more appropriate.

I am still new to the different frameworks and unsure about whether my design is acceptable or if i am on a completely wrong way.

When taking on so much at once (as you claim to be inexperienced), it is almost guaranteed you are not doing things the right way. Still, your app seems quite complex and it does not make sense trying to explain it all when looking for a solution for a reasonably small problem. I am sure you'd get more answers if you put the question to the point.

Also, if you are really new to all of this stuff, this sounds like a big first step. Too big. Start with small, isolated functionalities and practice.

F

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to