Seeking a graceful way to end a program

2010-04-29 Thread Paul Johnson
I would like to have some guidance on the proper way to 'gracefully' terminate a program that cannot proceed, for example, when some critical resource can't be created or doesn't exist. I've look through all my reference books and searched the internet for sample code but have come up empty handed

Re: Seeking a graceful way to end a program

2010-04-29 Thread Paul Johnson
al termination of the program, so I should probably be writing a general way of handling such events. I hope I'm on the right track. Thanks all for your replies. On Thu, Apr 29, 2010 at 1:48 PM, Fritz Anderson wrote: > On 29 Apr 2010, at 1:31 PM, Paul Johnson wrote: > >> I w

Re: Seeking a graceful way to end a program

2010-04-29 Thread Paul Johnson
ad ended. Maybe this is a bug -- looks like that to me at least.) On Thu, Apr 29, 2010 at 3:14 PM, Jens Alfke wrote: > > On Apr 29, 2010, at 12:56 PM, Paul Johnson wrote: > >> I found one possible tip in "Cocoa Design Patterns" (p. 253.) The >> sample code uses

Core Data and reading a data file

2010-05-06 Thread Paul Johnson
I have two programs. The first one (Setup) creates a file that the second one (Main) reads to initialize an array. I want to use the Data Modeler and Core Data. Setup is a Core Data Command Line Tool while Main is a Cocoa document-based application that also uses Core Data. In Main's application

Filling a drawer (Core Data and a newbie problem)

2010-05-13 Thread Paul Johnson
I have a Core Data application with a drawer. The drawer contents is an array that I want to initialize from a file created by a Core Data Command Line tool. In applicationDidFinishLaunching: I have set up the Managed Object Context. I've initialized the Persistent Store Coordinator, read the .mo

Using popup to select table items to display (Core Data app)

2010-05-23 Thread Paul Johnson
I'm looking for an example of the use of a popup menu to determine the array items to display in a tableview. I'm trying to use Core Data and do this in Interface Builder as much as possible. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please

Creating an Application Support folder

2010-02-11 Thread Paul Johnson
I'm trying to find a best way to create the Application Support folder. I'm rather new at Cocoa so it's taking me a while to do even this simple thing. I'm also interested in ensuring my application can be localized easily. I have a function "- (NSString *)applicationSupportFolder" that returns th

Proper way to initialize application support file

2010-02-17 Thread Paul Johnson
I am working on a Document-based application that needs to have a certain file in ~/Library/Application Support/ before it can do anything. It needs to be created the first time the program is run (or if it has been deleted by the user). I've created a class XXAppDelegate and declared it as implem

Re: Proper way to initialize application support file

2010-02-17 Thread Paul Johnson
the app to function normally. Files that are > necessary should be inside your app bundle, usually. > -Steven > > On Wed, Feb 17, 2010 at 4:21 PM, Paul Johnson wrote: >> >> I am working on a Document-based application that needs to have a >> certain file in ~/Library/Applic

Re: Proper way to initialize application support file

2010-02-17 Thread Paul Johnson
Kyle, I've reread your post and now see your last sentence, where you mention Library/Caches. I guess that could be an acceptable location for the data I download from the internet. I still feel the data as being more "persistent" than data associated with a 'cache' though. I'm considering adding

Using Core Data in Command Line utility

2010-03-08 Thread Paul Johnson
I've created an Xcode project using the Command Line Tool template with the Type set to "Core Data". I defined an Entity with 3 Properties. Two of the Properties are strings and one is an integer (Int 16). I fetch data from 3 files read from the internet and use a scanner which extracts the strin

Re: Using Core Data in Command Line utility

2010-03-08 Thread Paul Johnson
romData:ofType:error:. Instead of the save: method when would one archive the data using dataOfType:error:? On Mon, Mar 8, 2010 at 7:48 PM, Roland King wrote: > > > Paul Johnson wrote: >> >> In the innermost scanner loop, I am trying to use >> NSEntityDescription >> i

What controller functions should be implemented in what files?

2010-09-18 Thread Paul Johnson
I'm really unclear on how to structure my program, in particular the controllers. In IB I dragged a 'Window and Drawer' to the document window. In the drawer I have a Table View, and I have another Table View in the Main Window. I want to be able to drag a selection from the Drawer to the Window.

Drag and drop between 2 table views

2010-10-25 Thread Paul Johnson
I have two table views and I want to drag and drop from one to the other. I'm using Core Data and Bindings, and the I'm able to select items in the source table and I'm copying an index set listing indexes of the selected items to the pasteboard. I haven't been able to drop the selected items

Drag and drop between two table views.

2010-10-25 Thread Paul Johnson
I am trying to drag and drop from one text view to another. I can write an index set of copied rows to the pasteboard using: - (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard { // Copy the row numbers to the pasteboar

Re: Drag and drop between two table views.

2010-10-27 Thread Paul Johnson
I think I've made some progress. I've rewritten tableView:writeRowsWithIndexes:toPasteboard: for the source table view: - (BOOL) tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard { NSArray *rows = [self arrangedObjects

Re: Drag and drop between two table views.

2010-10-27 Thread Paul Johnson
Thanks, Graham. I've almost got it working. I did implement the drop validation method and in my initWithNib method I did set up the destination to receive the drag type. That's all working fine. I took your suggestion to archive the array to a NSData object. I needed to implement encodeWithCoder

Re: Drag and drop between two table views.

2010-10-28 Thread Paul Johnson
Thanks, Graham. Let me restate the "drag and drop" problem I'm having and maybe someone with Core Data experience can give me some further help: I have been trying to get drag and drop working to copy from one tableview to another in the same application. Each table view uses Core Data to obtain i

Re: Drag and drop between 2 table views

2010-10-28 Thread Paul Johnson
Sean, the sample code you refer to doesn't use Core Data. My issue is with the use of Core Data along with drag and drop. On Thu, Oct 28, 2010 at 4:34 PM, Sean McBride wrote: > On Mon, 25 Oct 2010 12:55:32 -0500, Paul Johnson said: > > >I have two table views and I want to drag

Re: Drag and drop between two table views.

2010-10-28 Thread Paul Johnson
:20 pm, Paul Johnson wrote: > > > The model for the data in the destination tableview is essentially the > same > > as for the source tableview. The only difference is that the data model > for > > the destination tableview has an additional entity and a relationship. &

Re: Drag and drop between 2 table views

2010-10-28 Thread Paul Johnson
0 at 5:47 PM, Kyle Sluder wrote: > On Thu, Oct 28, 2010 at 3:43 PM, Paul Johnson wrote: > > Sean, the sample code you refer to doesn't use Core Data. My issue is > with > > the use of Core Data along with drag and drop. > > No, your issue is that you haven't learned h

Re: Drag and drop between 2 table views

2010-10-28 Thread Paul Johnson
I believe I've found the answer to my drag and drop problem: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html Drag and Drop is just a glorified copy/paste and on that web page I found: "If you just want to copy a managed object’s attributes,

Re: Drag and drop between 2 table views

2010-10-28 Thread Paul Johnson
Thanks to everyone who helped me out on this problem. ___ 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/Unsubsc

Programmatic initialization of a NSManagedObject with a Relationship

2010-10-30 Thread Paul Johnson
I have 2 tableviews (A and B) in a window. Both use Core Data. A 3rd tableview (in a drawer) has a complete list of items that I can selectively Drag and Drop to tableview B. I have almost implemented the Drag and Drop, but one step is missing. Tableview B has a Relationship to an item in tableview

How to remove 'not found in protocol' compiler warning

2010-11-12 Thread Paul Johnson
I'm getting a compiler warning message at the following line of code: NSArray *selectedObjects = [[secondTableView dataSource] selectedObjects ]; The warning message is <'selectedObjects' not found in protocol>. Can someone suggest what I need to do to remove the warning? ___

Re: How to remove 'not found in protocol' compiler warning

2010-11-12 Thread Paul Johnson
rm Pendley wrote: > > > On Fri, Nov 12, 2010 at 9:09 AM, Paul Johnson wrote: > > > >> I'm getting a compiler warning message at the following line of code: > >> > >> NSArray *selectedObjects = [[secondTableView dataSource] > >> selectedOb

Problem saving in a Core Data application

2010-11-13 Thread Paul Johnson
I'm getting the following error message when I try to Save after deleting rows from a tableview: *AppKit called rmdir("/private/var/folders/FA/FAQBcfcBF9icyTATSBmeVE+++TI/TemporaryItems/(A Document Being Saved By MyApp)"), it didn't return 0, and errno was set to 66.* Do I need to implement a m

Re: Problem saving in a Core Data application

2010-11-13 Thread Paul Johnson
message: I also get the console message that I gave in my initial post.) I hope that explanation more clearly describes the problem I'm experiencing. On Sat, Nov 13, 2010 at 12:50 PM, Jerry Krinock wrote: > > On 2010 Nov 13, at 09:21, Paul Johnson wrote: > > > If there is mo

Re: Problem saving in a Core Data application

2010-11-13 Thread Paul Johnson
e in my initial post.) I hope that explanation more clearly describes the problem I'm experiencing. On Sat, Nov 13, 2010 at 12:50 PM, Jerry Krinock wrote: > > On 2010 Nov 13, at 09:21, Paul Johnson wrote: > > > If there is more I need to state to define the problem, please tell m

Re: Problem saving in a Core Data application

2010-11-13 Thread Paul Johnson
ms like a deficiency to me. Thanks a lot for this very important piece of information! On Sat, Nov 13, 2010 at 2:31 PM, Jerry Krinock wrote: > > On 2010 Nov 13, at 11:29, Paul Johnson wrote: > > > > Oh, that's good because this error message is much easier to dea

Re: Problem saving in a Core Data application

2010-11-13 Thread Paul Johnson
> > On 2010 Nov 13, at 13:24, Paul Johnson wrote: > > > So, what I understand is that there are some "race conditions" within > Core Data that make it impossible to specify that a property be required and > that it is necessary to include in one's code any ch

Using bindings to lessen amount of code

2010-12-13 Thread Paul Johnson
I want to obtain the value at a particular row and column in a table. I implemented the datasource protocol method tableView:objectValueForTableVColumn:row: In this method I return [[self.arrangedObjects valueForKey:@"symbol"] objectAtIndex:rowIndex]. Is there a way to solely use bindings to

Warning message using stringWithContentsOfFile:encoding:error:

2012-10-27 Thread Paul Johnson
I get a compiler warning message at the following line of code: NSString *text = [NSString stringWithContentsOfFile:fullPath encoding: NSUTF8StringEncoding error:&error]; The warning message is: Class method '+stringWithContentsOfFile:encoding:Rf_error' not found (return type defaults to 'id')

Re: Warning message using stringWithContentsOfFile:encoding:error:

2012-10-27 Thread Paul Johnson
Thanks for your reply. On Sat, Oct 27, 2012 at 5:37 PM, Nick Zitzmann wrote: > > On Oct 27, 2012, at 4:04 PM, Paul Johnson wrote: > > > I get a compiler warning message at the following line of code: > > > > NSString *text = [NSString stringWithContentsOfFile:fullPath en

Re: Warning message using stringWithContentsOfFile:encoding:error:

2012-10-28 Thread Paul Johnson
string. I'm guessing you're using someone else's headers, > framework, or project, possible where error is redefined for some purpose, > possibly debugging or mapping to another set of code. > -- > Gary L. Wade (Sent from my iPad) > http://www.garywade.com/ >

Sorting NSTableView using Bindings

2012-11-05 Thread Paul Johnson
I have an NSTableView in a drawer. I'm using Core Data and I'm trying to have the drawer opening and showing the table rows sorted by the first column.. but have been unsuccessful. I can sort the table by clicking on column headers, but when the drawer is opened the data is unsorted. Obviously I

NSSlider, NSStepper, and NSTextfield with Bindings: how to display initial value?

2013-05-28 Thread Paul Johnson
I have a slider, a stepper, and a textField that are synchronized using bindings. I didn't write any code to do this, just used Xcode with its Interface Builder. When the program starts I don't see the slider set to the "Current" position I'd like and the textField doesn't show the "Current" value

Re: NSSlider, NSStepper, and NSTextfield with Bindings: how to display initial value?

2013-05-29 Thread Paul Johnson
Quincy Morisses reply completely resolved the issue I was having with bindings. I realized that we exchanged emails without copying this board. I think Quincy's reply might be helpful to others, so I'm reposting his reply on this board: On May 28, 2013, at 16:25 , Paul Johnson wrot