Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

stadidas

macrumors regular
Original poster
Feb 27, 2006
243
0
Kent, United Kingdom
I've got only a couple of more things to do on my app before I can really start using it properly (thanks to everyone here who has helped).
First off I need to be able to undo edits that are made to a text field. I have a rough idea of what to do and have put this method in which I think will listen for any edits:
Code:
- (void)startObservingDetails:(NSObjectController *)details
{
	[details addObserver:self
			  forKeyPath:@"myBalance"
				 options:NSKeyValueObservingOptionOld
				 context:NULL];
}

I thought that calling this from the -init method would work, but it doesn't appear to.
I also need to get revert working. In my loadDataRepresentation: I have this code to check if revert was called:
Code:
if (currentDate != nil) {
		NSLog(@"Revert Code needs to go here.");
	}

This code appears to work, I just need to know how to tell the interface objects to update.

I have uploaded the project here, which will hopefully be the last time I have to do it as I have got pretty much everything working. Thanks again to everyone who was kind enough to help on these forums.
 

ATG

macrumors regular
Aug 7, 2005
187
0
First off I need to be able to undo edits that are made to a text field. I have a rough idea of what to do and have put this method in which I think will listen for any edits:
An NSTextField should have undos already hooked up for you. You shouldn't have to do it yourself.

I also need to get revert working. In my loadDataRepresentation: I have this code to check if revert was called:
Revert should work out of the box too I think. I'm not entirely sure.
 

stadidas

macrumors regular
Original poster
Feb 27, 2006
243
0
Kent, United Kingdom
NSTextField does register and edit and it undoable as long as you have the text box selected. If you tab out of it or click somewhere else the edit is forgotten, so it's not being put on the undo stack.
I have isolated the point in the code where revert is carried out using a NSLog call. At this point I need to tell the interface to update to show the model that has been reloaded.
Unfortunately I don't know how to correct either of these things.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.