Core data model, bindings advice.

2008-05-12 Thread Steven Hamilton
Hi folks, Continuing my learning into Cocoa I'm developing a personal finance application. An admirable project I believe since none available suit my purposes and it always pays to have a project that one would use to learn from. I have a simple core data model consisting of

Re: Core data model, bindings advice.

2008-05-13 Thread Steven Hamilton
selection of your array controller. Take a look at: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html for lots of great examples of how to use bindings. Best regards, Steven Huey -- Steven Huey Software - http://www.stevenhuey.com On May 12, 2008, at 8:03 AM, Steven Hamilton wrote

object.selection inside predicate

2008-05-14 Thread Steven Hamilton
Hi folks, If I'm using a predicate in the attributes pane of IB for an entity, is it possible to reference the keypath in another object in that predicate? Not by following a relationship. e.g. entity is transactions. predicate; fromAccount == MLTreeController.selection.name kind of

Re: Core data model, bindings advice.

2008-05-15 Thread Steven Hamilton
://homepage.mac.com/mmalc/CocoaExamples/controllers.html for lots of great examples of how to use bindings. Best regards, Steven Huey -- Steven Huey Software - http://www.stevenhuey.com On May 12, 2008, at 8:03 AM, Steven Hamilton wrote: Hi folks, Continuing my learning into Cocoa I'm developing

Programmatically get treecontroller selection

2008-05-19 Thread Steven Hamilton
I have a core data master-detail interface that consists of a sourcelist on the left and a tableview. The source list displays object from a core data entity. THe table view will be populated by a custom datasource as I have to do some data munging on the way from core data to the

Re: Programmatically get treecontroller selection

2008-05-20 Thread Steven Hamilton
On 20/05/2008, at 5:18 AM, Jonathan Dann wrote: On 19 May 2008, at 13:29, Steven Hamilton wrote: I have a core data master-detail interface that consists of a sourcelist on the left and a tableview. The source list displays object from a core data entity. THe table view

Re: Programmatically get treecontroller selection

2008-05-21 Thread Steven Hamilton
Fixed that error now. I had a rogue arraycontroller in the NIB file from a previous predicate exercise. The nib is cleaned up and still no selection. It appears that I'm unable to get anything other than NULL from any objects instantiated in the NIB file. My appDelegate holds the code for

Re: Programmatically get treecontroller selection

2008-05-22 Thread Steven Hamilton
with me, and apologies for being such a n00b. (also, selectionIndexPaths binding is required in the NSOutlineView, no idea why either) On Wed, May 21, 2008 at 10:00 PM, Steven Hamilton [EMAIL PROTECTED] wrote: Fixed that error now. I had a rogue arraycontroller in the NIB file from

warning: 'NSEntityDescription' may not respond to

2008-05-30 Thread Steven Hamilton
Hi folks, I have a custom datasource that does a fetch from Core Data. My entity has a property in it called 'memo'. When I enumerate the returned array to check the results I get the following warning. warning: 'NSEntityDescription' may not respond to '-memo' The fetch appears to work

Re: warning: 'NSEntityDescription' may not respond to

2008-05-30 Thread Steven Hamilton
Thanks everyone. Good answers all round. On 31/05/2008, at 4:51 AM, mmalc crawford wrote: On May 30, 2008, at 3:09 AM, Peter Burtis wrote: The compiler only knows about methods declared somewhere or the headers, and Core Data accessor methods are handled at runtime and not declared

Re: Core data. Programmatically setting relationships

2008-06-01 Thread Steven Hamilton
] setValue:fetchedAccount forKey: [tableColumn identifier]]; } and set the transaction toAccount value to the actual fetched object itself. Can anyone confirm? On 01/06/2008, at 6:28 PM, Steven Hamilton wrote: Hi folks, Back again with more Core Data puzzles. I have entities like so

Core data. Programmatically setting relationships

2008-06-01 Thread Steven Hamilton
Hi folks, Back again with more Core Data puzzles. I have entities like so; Account; NSStringname relationshipcredit relationshipdebit Transaction; NSStringname NSDate date relationshiptoAccount (reverse of credit in Account entity) relationship

Re: Core data. Programmatically setting relationships

2008-06-02 Thread Steven Hamilton
, Steven Hamilton wrote: What I can't do is set change the relationships. In my tableView I'm displaying the Account name in the toAccount and fromAccount columns. I want to be able to type a new Account.name in there and have the Transaction object update the relationship to the new Account

warning: return makes pointer from integer without cast

2008-06-10 Thread Steven Hamilton
Hi folks, newbie here. A quickie query on a warning. Both returns in the following code give a 'warning: return makes pointer from integer without cast' - (id)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem: (id)item { if (!item) { return

NSSplitview. Stopping the split moving

2008-06-14 Thread Steven Hamilton
Hi folks, I have an NSplitview similar to Mails. I'm trying to fix the split so it doesn't move just like Mail but can't for the life of me figure out how to do it. My left split has an Outlineview and the right split a tableview. Resizing the window always moves the split upsetting the

Converting to NSPersistentDocument

2008-06-15 Thread Steven Hamilton
G'day!, I've been a busy bee learning Cocoa and core data (as my frequent postings may reveal) and now I wish to add NSPersistentDocument functionality. I started my project using the normal Core Data template so how do I change my program to use the NSPersistentDocument model instead of

Re: Converting to NSPersistentDocument

2008-06-19 Thread Steven Hamilton
On 16/06/2008, at 5:42 AM, Hamish Allan wrote: On Sun, Jun 15, 2008 at 11:42 AM, Steven Hamilton [EMAIL PROTECTED] wrote: I've been a busy bee learning Cocoa and core data (as my frequent postings may reveal) and now I wish to add NSPersistentDocument functionality. I started my project

Re: Converting to NSPersistentDocument

2008-06-19 Thread Steven Hamilton
You do rock sir! Thanks a lot. On 19/06/2008, at 7:45 PM, mmalc Crawford wrote: On Jun 19, 2008, at 2:38 AM, Steven Hamilton wrote: What I don't understand is how to bind to the managedObjectContext. As far as I can tell in each windows .nib file I set File's Owner to be my subclassed

Core data question in multiwindow doc app

2008-06-27 Thread Steven Hamilton
Easy one this I reckon (but not that easy or I wouldn't ask), I've converted my core data app to NSPersistentDocument and using a multi-nib model for my 3 windows. I have an account window using the IB wizard Master-Detail interface with bindings to add and manage Account entities. I also

Re: Core data question in multiwindow doc app

2008-06-27 Thread Steven Hamilton
On 28/06/2008, at 4:32 AM, Ben Trumbull wrote: When I add a new account entity my outlineview doesn't know. Should I be using a notification to find out when a new account entity is added. If so, which one? The easiest way to track insertions and deletions in the NSManagedObjectContext is

Re: Core data question in multiwindow doc app

2008-06-28 Thread Steven Hamilton
On 28/06/2008, at 2:41 PM, Chris Hanson wrote: On Jun 27, 2008, at 7:25 PM, Steven Hamilton wrote: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(buildSourceList) name:@NSManagedObjectContextObjectsDidChangeNotification object: [self.document

unsigning NSNumber

2008-07-26 Thread Steven Hamilton
Hi folks, Can anyone tell me the most efficient way to unsign a floatvalue in an NSNumber? Like change a -1.47 to 1.47 ? Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the

unsigning NSNumber

2008-07-26 Thread Steven Hamilton
Hi folks, Can anyone tell me the most efficient way to unsign a floatvalue in an NSNumber? Like change a -1.47 to 1.47 ? Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to

NSTableview Datasource and NSPopupbuttonCell

2008-07-26 Thread Steven Hamilton
Hi Folks, I have a NSTableview with a datasource consisting of an NSArray of dictionaries. One column in my table has an NSPopupbuttonCell. The content and contentValues are bound to a Core Data Account object. I use a name property as my contentValue. I'm having trouble changing the

Re: unsigning NSNumber

2008-07-26 Thread Steven Hamilton
Thanks all, fabs() is just what I need. ___ 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

Core data entity creation design

2008-08-24 Thread Steven Hamilton
Hi folks, I have a Core Data model which contains two entities. I have a tableview with the standard bindings arrangement and Add/Remove buttons handling one of the entities. What I need to achieve is that when the Add button is pressed both entity types are created, not just the one

NSManagedObject custom class for loop

2008-09-29 Thread Steven Hamilton
Hi folks, In my core data app I have an Account entity. I've subclassed this as I want to add a method that calculates the Account's balance by doing a fetch on Transaction entities and tallying up the amounts. I've created a custom class in xcode and added the following code in Account.m

inconsistent float behaviour

2008-10-10 Thread Steven Hamilton
Hi folks, I think I need some help understanding floats. I have a class that calculates a balance and places it in a table column. At the end of this method I NSLog the output like so; NSLog(@current balance is: %@,balance); and get current balance is: 18976.69 in the console. So far so

Re: inconsistent float behaviour

2008-10-10 Thread Steven Hamilton
: On 10.10.2008, at 13:04, Steven Hamilton wrote: NSLog(@current balance is: %@,balance); and get current balance is: 18976.69 in the console. So far so good. (...) The float calculation is exactly 2 decimal places, I know that for a fact and NSLog proves it. You may want to be aware that NSLog gives

Re: inconsistent float behaviour

2008-10-11 Thread Steven Hamilton
On 11/10/2008, at 11:59 AM, Kyle Sluder wrote: On Fri, Oct 10, 2008 at 9:58 PM, Kyle Sluder [EMAIL PROTECTED] wrote: This article It would help if I provided the link. http://www.setfiremedia.com/blog/7-top-tips-for-coding-with-currency Thanks Kyle. I didn't realise floating point were so

Re: inconsistent float behaviour

2008-10-11 Thread Steven Hamilton
: On 10.10.2008, at 13:04, Steven Hamilton wrote: NSLog(@current balance is: %@,balance); and get current balance is: 18976.69 in the console. So far so good. (...) The float calculation is exactly 2 decimal places, I know that for a fact and NSLog proves it. You may want to be aware that NSLog gives

NSTextfield in tableColumn changing color slow

2008-10-16 Thread Steven Hamilton
Hi Folks, I have a core data bound tableColumn that displays a currency balance. My NSManagedObject is a custom class that calculates the balance from a @sum of related transactions and returns the balance. The binding then displays this balance in the tableColumn. So far so good. This

Re: NSTextfield in tableColumn changing color slow

2008-10-18 Thread Steven Hamilton
On 16/10/2008, at 11:59 PM, Corbin Dunn wrote: Hi Steven, On Oct 16, 2008, at 2:03 AM, Steven Hamilton wrote: Hi Folks, I have a core data bound tableColumn that displays a currency balance. My NSManagedObject is a custom class that calculates the balance from a @sum of related

NSNumberFormatter: Display INT as decimal

2008-11-03 Thread Steven Hamilton
Hi Folks, Following on from my previous query regarding decimals and floats, I've decided to refactor my code to maintain a base component of any currency in use gnucash stylee. This means all values are kept as INT for accuracy. However, I wish to display the cent amounts as dollars

Slow scrolling after NSPopup implementation

2009-05-15 Thread Steven Hamilton
Hi folks, I hope I can explain this clearly enough. Here goes... ;) I have an NSTableview in my Core Data app. I have a custom controller providing the tableViews datasource and delegate methods as I need to mung the data a bit between the MOC and the View. This all works fine. In one

Re: Slow scrolling after NSPopup implementation

2009-05-15 Thread Steven Hamilton
On 15/05/2009, at 8:12 PM, Kyle Sluder wrote: On Fri, May 15, 2009 at 5:56 AM, Steven Hamilton o...@scorch.net wrote: - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row { if ([[tableColumn identifier] isEqualToString:@transfer

Re: Slow scrolling after NSPopup implementation

2009-05-15 Thread Steven Hamilton
On 15/05/2009, at 8:53 PM, Kyle Sluder wrote: On Fri, May 15, 2009 at 6:41 AM, Steven Hamilton o...@scorch.net wrote: Hmm, clearly I'm doing it all wrong. I assumed (from past problems) that the delegate method can't return a value to an popup in a tableView and that you use

Re: Slow scrolling after NSPopup implementation

2009-05-15 Thread Steven Hamilton
On 15/05/2009, at 9:24 PM, Kyle Sluder wrote: On Fri, May 15, 2009 at 7:10 AM, Steven Hamilton o...@scorch.net wrote: Hmm, so we're saying that - tableView:willDisplayCell:forTableColumn:row: cannot be used to set the value I want displayed in an NSPopupCell in a column? I must use

Re: Slow scrolling after NSPopup implementation

2009-05-19 Thread Steven Hamilton
Ok. I'm still struggling with this. My NSTableColumn is bound to an NSArrayController for content and content values. This works great. My custom controller has the following code in it to set the popup selection to display for each row. - (void)tableView:(NSTableView *)aTableView

NSNull and distinct objective-C type

2009-06-04 Thread Steven Hamilton
Hi folks, I need some advice on how best to handle an itchy problem. In order to tighten up my coding I'm compiling with warnings as errors which has showed up a big problem with my code. I have a tableView using a datasource array of dictionaries. Fairly standard stuff. 2 of the keys in

Re: NSNull and distinct objective-C type

2009-06-04 Thread Steven Hamilton
On 04/06/2009, at 10:36 PM, Graham Cox wrote: On 04/06/2009, at 10:31 PM, Steven Hamilton wrote: I'm getting the error because I initially declared my credit and debit objects as NSNumbers. Can I recast them without them losing scope? Yes, just do this: credit = (id)[NSNull null

Replacing a tableView Cell with null

2009-06-05 Thread Steven Hamilton
Hi, I have an NSTableview populated by bindings to Core Data. In one column I have a popupbutton (bad idea as its slow, I know) and in another I have a checkbox. I only want the checkbox to be available when certain items from the popupbutton are selected. To try and do this I've

Re: Replacing a tableView Cell with null

2009-06-05 Thread Steven Hamilton
Begin forwarded message: From: Steven Hamilton o...@scorch.net Date: 6 June 2009 11:59:18 AM To: Corbin Dunn corb...@apple.com Subject: Re: Replacing a tableView Cell with null On 06/06/2009, at 9:33 AM, Corbin Dunn wrote: On Jun 5, 2009, at 4:01 PM, Steven Hamilton wrote: Hi, I have

Re: Replacing a tableView Cell with null

2009-06-09 Thread Steven Hamilton
___ return [tableColumn dataCell]; also note you have a memory leak, you want return [cell autorelease], and probably don't want to alloc the cell until you need it. Gotcha. Thanks a lot. ___ Cocoa-dev mailing list

Model mapping crash

2008-11-13 Thread Steven Hamilton
Hi folks, I have a Core data application. I've versioned my model, created a new version and added one new entity. When I create a mapping model file and choose my two models. It creates a default mapping but if some of the entities are selected in teh mapping view, XCode hard crashes with

NSArrays and tableView delegates

2008-12-04 Thread Steven Hamilton
Hi folks, I'm looking for advice on usage of arrays in tableviews. I have a subclassed NSWindowController. In this class I have a method that extracts data from my core data model and formulates an array of dictionaries. Also in this class I have the tableview datasource methods. The

Re: NSArrays and tableView delegates

2008-12-05 Thread Steven Hamilton
On 05/12/2008, at 9:25 AM, Ashley Clark wrote: (Leopard 10.5.5 with GC on) If you're running this program under GC then none of what you said makes sense anyway since retain/release/autorelease are all no-ops under GC and -dealloc is never called there. Ah the benefit of a simple

NSArrayController, NSPopupMenu, defaults and arrangedObjects

2008-12-08 Thread Steven Hamilton
Hi folks, I've got a single NSPopupButton. The content is bound to an NSArrayController arrangedObjects and value bound an attribute. All good. THe ArrayController is sourcing a Core Data store for its array and this is all good too. The problem is when the window is loaded the

Re: NSArrayController, NSPopupMenu, defaults and arrangedObjects

2008-12-08 Thread Steven Hamilton
Hi folks, I've got a single NSPopupButton. The content is bound to an NSArrayController arrangedObjects and value bound an attribute. All good. THe ArrayController is sourcing a Core Data store for its array and this is all good too. The problem is when the window is loaded the NSPopupButton is

Re: NSArrayController, NSPopupMenu, defaults and arrangedObjects

2008-12-09 Thread Steven Hamilton
snip However, the arrangedObjects array, while existing, contains zero objects. I've checked the Outlet is connected ok. A timing issue of some sort? No. Based on the above, your code isn't KVO compliant. First of all, it's important to realize that nothing is ever bound to an instance

Re: NSArrayController, NSPopupMenu, defaults and arrangedObjects

2008-12-11 Thread Steven Hamilton
Great stuff. Thanks Guys. What I've done is register as an observer of the arrangedObjects keypath in my windowDidLoad method. Then when it changes I set the correct selectedIncomeEnvelope and remove the observer. Job done. On 09/12/2008, at 9:51 PM, Volker in Lists wrote: Hi Steven, as

KVC error from bound SortDescriptor

2009-01-14 Thread Steven Hamilton
Hi folks, I have a customer WindowController class and within it I have a method that returns a NSSortDescriptor. Like this; -(NSArray *)nameSortDescriptors { NSSortDescriptor *sorter; sorter = [[[NSSortDescriptor alloc] initWithKey: @name