Making an NSTableView Display Articles From An RSS Feed.

2009-08-23 Thread Joshua Garnham
How would I make an NSTableView display an RSS Feed (just one)?
I think it would have something to do with NSURL and Setting the Table Views 
Data Source.
But how exactly would I do this?

Cheers,
Josh.



  
___

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


Starting editing for a Row as soon as it is Added.

2009-08-27 Thread Joshua Garnham
I have an NSOutlineView and what I want to happen is that when a row is
added I want the row that has been added to Start Editing immediately
like when you double click on a row.

Cheers,
Josh.




___

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


Re: Starting editing for a Row as soon as it is Added.

2009-08-28 Thread Joshua Garnham
Thanks Very Much Sean.
Just 2 Questions, Where do I put the Code? and How will the method know when a 
Row is Added?

Cheers,
Josh.

>
>From: Sean McBride 
>To: Joshua Garnham ; cocoa-dev@lists.apple.com
>Sent: Thursday, 27 August, 2009 20:18:10
>Subject: Re: Starting editing for a Row as soon as it is Added.
>
>On 8/27/09 4:42 PM, Joshua Garnham said:
>
>>I have an NSOutlineView and what I want to happen is that when a row is
>>added I want the row that has been added to Start Editing immediately
>>like when you double click on a row.
>
>@implementation NSTableView (RRExtra)
>
>- (void)makeEditableSelectedCellOfColumnIdentifier:
>(NSString*)inColumnIdentifier
>{
>NSTableColumn* column = [self tab
>leColumnWithIdentifier:inColumnIdentifier];
>if (column && ![column isHidden])
>{
>if ([self numberOfSelectedRows] == 1)
>{
>NSInteger columnIndex = [self
>columnWithIdentifier:inColumnIdentifier];
>NSInteger selectRowIndex = [self selectedRow];
>if ((columnIndex != -1) && (selectRowIndex != -1))
>{
>[self editColumn:columnIndex row:selectRowIndex
>withEvent:nil select:YES];
>}
>}
>}
>}
>
>@end
>
>--
>
>Sean McBride, B. Engs...@rogue-research.com
>Rogue Researchwww.rogue-research.com
>Mac Software Developer  Montréal, Québec, Canada
>
>
>




___

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


Making an Outline View delete a rows children when the parent is deleted.

2009-09-05 Thread Joshua Garnham
How would I make a rows children be deleted when the parent is deleted?

Cheers,
Josh.



___

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


Re: Making an Outline View delete a rows children when the parent is deleted.

2009-09-06 Thread Joshua Garnham
I would like the Data to be deleted permanently.

Cheers,
Josh.





From: Jack Carbaugh 
To: Joshua Garnham 
Cc: cocoa-dev@lists.apple.com
Sent: Saturday, 5 September, 2009 22:37:00
Subject: Re: Making an Outline View delete a rows children when the parent is 
deleted.

That depends on your meaning.

Do you only want them deleted visibly in the table/outline view OR do  
you want the data to be deleted permanently

The table/outline is SEPARATE from the actual data.


On Sep 5, 2009, at 2:14 PM, Joshua Garnham wrote:

> How would I make a rows children be deleted when the parent is  
> deleted?
>
> Cheers,
> Josh.
>
>
>
> ___
>
> 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/intrntmn%40aol.com
>
> This email sent to intrn...@aol.com



___

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


Making an NSAlert be displayed when the User attempts to delete a row from an NSOutlineView when it has children.

2009-09-07 Thread Joshua Garnham
How would I do this?
The Outline View is being used with Core Data.

Cheers,
Josh.




___

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


Re: Making an NSAlert be displayed when the User attempts to delete a row from an NSOutlineView when it has children.

2009-09-07 Thread Joshua Garnham
Steven,

The Outline View isn't being displayed with an NSArrayController rather an 
NSTreeController, but I think you can still override -remove:.
Also, how would I check to see whether the row the user wants to delete has any 
children?

Cheer,
Josh.



From: Steven Degutis 
To: Joshua Garnham 
Cc: cocoa-dev@lists.apple.com
Sent: Monday, 7 September, 2009 17:20:50
Subject: Re: Making an NSAlert be displayed when the User attempts to delete a  
row from an NSOutlineView when it has children.

Josh,

The outline view is probably being displayed with an NSArrayController, not 
just "Core Data", which is an abstract term for a ton of APIs. As well, 
NSArrayController falls into part of Cocoa, as well as Core Data, but that's 
another story.

Assuming your row is "removed" via an outlet to your NSArrayController's 
-remove: method, and assuming you're using NSArrayController for this in the 
first place, simply subclass your NSArrayController and provide the NSAlert 
behavior by overriding -remove: and then call super's -remove: once the NSAlert 
has come back positive (for chlamydia).

-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/



On Mon, Sep 7, 2009 at 10:14 AM, Joshua Garnham  
wrote:

>How would I do this?
>>The Outline View is being used with Core Data.
>
>>Cheers,
>>Josh.
>
>
>
>
>>___
>
>>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/steven.degutis%40gmail.com
>
>>This email sent to steven.degu...@gmail.com
>



___

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


Re: Making an NSAlert be displayed when the User attempts to delete a row from an NSOutlineView when it has children.

2009-09-07 Thread Joshua Garnham
This.

- (IBAction)remove:(id)sender {
NSArray *selectedRow = [treeController selectedObjects];
NSInteger childrenCount = [selectedRow.children count];
if ([childrenCount != 0]) 
{
NSLog(@"Display Alert");
}else{
NSLog(@"Delete Imediately");
}
}





From: Kyle Sluder 
To: Joshua Garnham 
Cc: "cocoa-dev@lists.apple.com" 
Sent: Monday, 7 September, 2009 17:52:26
Subject: Re: Making an NSAlert be displayed when the User attempts to delete a 
row from an NSOutlineView when it has children.

On Sep 7, 2009, at 8:14 AM, Joshua Garnham  wrote:

> How would I do this?

http://www.whathaveyoutried.com

--Kyle Sluder




___

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


Retrieving the selected object in an NSOutlineView.

2009-09-16 Thread Joshua Garnham
 
I
am looking to retrieve the selected object in an NSOutlineView so I can
see if the selected object has any children. How would I do this?
I know the NSTreeController has selectedObject but how would I implement this 
and then check if it has children.

Cheers!




___

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


Making the Text in a Text Cell change color when the Rows Checkbox has been checked.

2009-09-21 Thread Joshua Garnham
I have a NSOutlineView and I want to make the text for a row change color when 
the check box on that row has been checked.
How would I do that?

Thanks.




___

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


Deleting CalTasks through an Array.

2009-09-30 Thread Joshua Garnham
I have an Array of strings and want to remove CalTasks with titles of any of 
the strings. 
I know I can loop through a array with

for(NSString *title in array) {
}

and delete tasks with 

removeTask:title error:nil
But it won't let me delete a CalTask object with the strings from the Array 
instead it wants the actual CalTask object.How would I delete a CalTask object 
by matching it's title to a string in an array?

Cheers.



___

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


Re: Deleting CalTasks through an Array.

2009-10-01 Thread Joshua Garnham
Hi,

Thanks, It works now I've fixed the warnings.

Cheers.



From: Stamenkovic Florijan 
To: Joshua Garnham 
Cc: cocoa-dev 
Sent: Thursday, 1 October, 2009 13:32:20
Subject: Re: Deleting CalTasks through an Array.

Hi Joshua,

You're welcome, but you need to also learn some stuff on your own.

1. Browse the docs: NSArray does not have a contains: method, it has a 
containsObject: method. My mistake, but one that's easy to spot.
2. Check the method signatures for CalCalendar store. I believe I gave you the 
right ones (in which case your imports are somehow messed up). If I gave you 
the wrong ones, change them.

Also please keep all communication *on* the list.

F

On Oct 01, 2009, at 01:54, Joshua Garnham wrote:

> Thanks!
> I've got a few warnings though : http://snapplr.com/zm6w.
> Especially with the NSPredicate.
> 
> From: Stamenkovic Florijan 
> To: Joshua Garnham 
> Cc: cocoa-dev@lists.apple.com
> Sent: Wednesday, 30 September, 2009 20:24:59
> Subject: Re: Deleting CalTasks through an Array.
> 
> 
> On Sep 30, 2009, at 12:32, Joshua Garnham wrote:
> 
> > I have an Array of strings and want to remove CalTasks with titles of any 
> > of the strings.
> > I know I can loop through a array with
> >
> > for(NSString *title in array) {
> > }
> >
> > and delete tasks with
> >
> > removeTask:title error:nil
> > But it won't let me delete a CalTask object with the strings from the Array 
> > instead it wants the actual CalTask object.How would I delete a CalTask 
> > object by matching it's title to a string in an array?
> 
> Joshua,
> 
> You need to use CalCalendarStore's method "taskPredicateWithCalendar", 
> passing it all calendars to get the tasks, then compare titles and delete if 
> necessary.
> 
> // make a predicate for all tasks
> NSPredicate* allCalendarsTaskPredicate = [CalCalendarStore 
> taskPredicateWithCalendar:[CalCalendarStore calendars]];
> 
> // fetch all the tasks
> NSArray* allTasks = [[CalCalendarStore defaultCalendarStore] 
> tasksWithPredicate:allCalendarsTaskPredicate];
> 
> // delete them
> for(CalTask* task in allTasks)
> if([arrayOfTitles contains:tast.title])
> // delete task
> 
> More or less... Sorry for the typos, I am writing directly to mail.
> 
> What would be more efficient and *might* work is creating a compound 
> predicate out of the allTasks predicate and a predicate that would 
> discriminate tasks that don't have a matching title. However, I am not sure 
> that predicate would work with the CalendarStore. Something to explore if the 
> performance is an issue.
> 
> HTH
> 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


Triggering a Method when a Core Data Property is Altered.

2009-10-06 Thread Joshua Garnham
Hi.

I am trying to trigger a method when A Core Data property is changed, e.g A 
Text Fields Text in a Table (connected to Core Data) is changed. I have looked 
into Key Value Observing but haven't had much luck.

Cheers.




___

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


Re: Triggering a Method when a Core Data Property is Altered.

2009-10-06 Thread Joshua Garnham
Volker,


I have tried using the below code to add my self as an observer then trigger an 
action but it doesn't work.


- awakeFromNib {
[self addObserver: self
forKeyPath: @"name"
   options: NSKeyValueObservingOptionNew
   context: NULL];
}

-(id)init {
dispatch = [[NSDictionary 
dictionaryWithObjectsAndKeys:@selector(doSomething:),@"name", nil] retain];
}
...
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
{
[self performSelector:msg withObject:object withObject:keyPath];
}

Is there something wrong that is blatantly obvious?

Cheers,
Josh.





From: Volker in Lists 
To: Joshua Garnham 
Cc: cocoa-dev@lists.apple.com
Sent: Tuesday, 6 October, 2009 18:57:59
Subject: Re: Triggering a Method when a Core Data Property is Altered.

Josh,

depending on where you need to get a notification:

a) within the same NSManagedObject or a relationship: 
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueObserving_Protocol/Reference/Reference.html#//apple_ref/occ/clm/NSObject/keyPathsForValuesAffectingValueForKey:

b) in any other object: just register as observer as described in KVO basics: 
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/KVOBasics.html

Take note: The triggering happens not on the change of the TextFieldCell in a 
table, but due to a property changing.

When you have looked into KVO - what have you tried already?


Cheers,
Volker

Am 06.10.2009 um 18:45 schrieb Joshua Garnham:

> Hi.
> 
> I am trying to trigger a method when A Core Data property is changed, e.g A 
> Text Fields Text in a Table (connected to Core Data) is changed. I have 
> looked into Key Value Observing but haven't had much luck.
> 
> Cheers.
> 
> 
> 
> 
> ___
> 
> 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/volker_lists%40ecoobs.de
> 
> This email sent to volker_li...@ecoobs.de

Send instant messages to your online friends http://uk.messenger.yahoo.com
___

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


Re: Triggering a Method when a Core Data Property is Altered.

2009-10-07 Thread Joshua Garnham
Hi,

That works now, Thanks Very Much!!!

Josh.



From: Volker in Lists 
To: Joshua Garnham 
Cc: cocoa-dev@lists.apple.com
Sent: Wednesday, 7 October, 2009 18:04:59
Subject: Re: Triggering a Method when a Core Data Property is Altered.

Hi,

awakeFromFetch is only called when the object is loaded from the persistent 
store (=fetched). So all newly inserted objects are not observed. 

this might be one reason for not getting triggered for rows 2/3 if they were 
not fetched but created. Otherwise I have no idea why it doesn't work yet-

Volker


Am 07.10.2009 um 18:54 schrieb Joshua Garnham:

Hi,
>
>Ok, I have changed it to awakeFromInsert: and have removed the observer in the 
>NSManagedObjects dealloc: method.
>And have already fixed the performSelector: problem.
>
>So the NSManagedObject sub-class looks like …
>
>- (void) awakeFromFetch {
>[self addObserver:[NSApp delegate] forKeyPath:@"name" 
> options:NSKeyValueObservingOptionNew context:nil];
>}
>
>- (void)dealloc {
>[self removeObserver:[NSApp delegate] forKeyPath:@"name"];
>[super dealloc];
>}
>
>
>… and the App Delegate …
>
>- (void)observeValueForKeyPath:(NSString *)keyPath 
>  ofObject:(id)object 
>change:(NSDictionary *)change 
>context:(void *)context {
>[self performSelector:@selector(doSomthing:)];
>}
>
>It builds without any warnings but it only half works.
>What happens is as follows …
>In my table view I have added three rows, each have text fields bound to the 
>'name' property.
>The method is triggere when I change the text for the first row however it is 
>not triggered when I change the text for the 
>other rows. Do you have any idea why this is? 



___

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


Removing an Object with A Certain Title from an NSTreeController.

2009-10-10 Thread Joshua Garnham
Hi,

I am wondering how I could delete an object depending on it's title for the 
CoreData 'name' property I have.
To Add an Object I use this code: 
NSManagedObjectContext *moc = [self managedObjectContext];
JGManagedObject *theParent = 
[NSEntityDescription insertNewObjectForEntityForName:@"projects"
  inManagedObjectContext:moc];
[theParent setValue:nil forKey:@"parent"];
// This is where you add the title from the string array
[theParent setValue:@"myTitle" forKey:@"name"]; 
[theParent setValue:[NSNumber numberWithInt:0] forKey:@"position"];

But I can't seem to find an equivalent function to remove An object. 

You See, I have an array of strings so I was hoping I could loop through it 
deleting the objects with the title of any of the strings.

Cheers.



___

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


Re: Removing an Object with A Certain Title from an NSTreeController.

2009-10-10 Thread Joshua Garnham
Ok, I'll post the actual code that I am using and is giving the problem.

Here it is:

for(NSString *title in oldTasks) {
// Get the moc and prepare a fetch request for the required entity
NSManagedObjectContext *moc = [self managedObjectContext];
NSEntityDescription *entityDescription = [NSEntityDescription 
entityForName:@"projects" inManagedObjectContext:moc];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:entityDescription];

// Create a predicate for an array of names.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"title IN 
%d", oldTasks];
[request setPredicate:predicate];

NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] 
initWithKey:@"name" ascending:YES];
[request setSortDescriptors:[NSArray arrayWithObject:sortDescriptor]];

// Execute the fetch request put the results into array
NSError *error = nil;
NSArray *resultArray = [moc executeFetchRequest:request error:&error];
if (resultArray == nil)
{
// Diagnostic error handling
NSAlert *anAlert = [NSAlert alertWithError:error];
[anAlert runModal];
}

JGManagedObject *objectToDelete = [resultArray objectAtIndex:0];
// Delete the object.
[moc deleteObject:objectToDelete];
}


-
Josh


________
From: Abizern 
To: Joshua Garnham 
Sent: Saturday, 10 October, 2009 13:04:06
Subject: Re: Removing an Object with A Certain Title from an NSTreeController.

2009/10/10 Joshua Garnham 

>Hi,
>
>>I am wondering how I could delete an object depending on it's title for the 
>>CoreData 'name' property I have.
>>To Add an Object I use this code:
>>NSManagedObjectContext *moc = [self managedObjectContext];
>>JGManagedObject *theParent =
>>[NSEntityDescription insertNewObjectForEntityForName:@"projects"
>>  inManagedObjectContext:moc];
>>[theParent setValue:nil forKey:@"parent"];
>>// This is where you add the title from the string array
>>[theParent setValue:@"myTitle" forKey:@"name"];
>>[theParent setValue:[NSNumber numberWithInt:0] forKey:@"position"];
>
>>But I can't seem to find an equivalent function to remove An object.
>
>>You See, I have an array of strings so I was hoping I could loop through it 
>>deleting the objects with the title of any of the strings.
>
>>Cheers.
>
>

Didn't I answer this on Stack Overflow? 
http://stackoverflow.com/questions/1535778/, even posting a suggested method.

You'd be better off posting the actual code that you've tried that you're 
having trouble with. You've already done so in a comment to me.-- 
Abizer


Send instant messages to your online friends http://uk.messenger.yahoo.com
___

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


Adding 'Help' to your App.

2009-10-13 Thread Joshua Garnham
Hi,

Just wondering if there is some documentation on how to add 'help' to your app.

Cheers.




___

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


Re: Adding 'Help' to your App.

2009-10-13 Thread Joshua Garnham
Thanks, I'll take a look at that. 





From: Eric Gorr 
To: Joshua Garnham ; Mailing List Cocoa 

Sent: Tuesday, 13 October, 2009 17:44:17
Subject: Re: Adding 'Help' to your App.

On Oct 13, 2009, at 12:37 PM, Joshua Garnham wrote:

> Just wondering if there is some documentation on how to add 'help' to your 
> app.

I would suggest starting with:

http://developer.apple.com/mac/library/documentation/Carbon/Conceptual/ProvidingUserAssitAppleHelp/user_help_intro/user_assistance_intro.html
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/OnlineHelp/OnlineHelp.html



___

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


Re: Adding 'Help' to your App.

2009-10-13 Thread Joshua Garnham
Some good links in that email, thanks!





From: M. Moore 
To: Eric Gorr 
Cc: Joshua Garnham ; Mailing List Cocoa 

Sent: Tuesday, 13 October, 2009 17:55:43
Subject: Re: Adding 'Help' to your App.

You might be interested in another thread going on in this same
mailing list. Here is the last email.
-- Forwarded message --
From: Jerry Krinock 
Date: Tue, Oct 13, 2009 at 7:01 AM
Subject: Re: register a help book
To: Wesley Smith , Cocoa Developers




On 2009 Oct 13, at 06:45, Wesley Smith wrote:

> thanks for any pointers,

* You didn't mention adding this "magic tag":
   
to the  of your root html file.

* Watch Matt Neuberg's screencast:
  http://www.apeth.com/writersua/implementAppleHelp.mov
   (I never have, but Matt is the Apple Help guru.)

* Post further questions to
  apple-help-author...@lists.apple.com






You might also want to look at helpify if you have omnioutliner
http://blog.omnigroup.com/2008/10/02/helpify-the-omni-help-emitter/


On Tue, Oct 13, 2009 at 9:44 AM, Eric Gorr  wrote:
> On Oct 13, 2009, at 12:37 PM, Joshua Garnham wrote:
>
>> Just wondering if there is some documentation on how to add 'help' to your
>> app.
>
> I would suggest starting with:
>
> http://developer.apple.com/mac/library/documentation/Carbon/Conceptual/ProvidingUserAssitAppleHelp/user_help_intro/user_assistance_intro.html
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/OnlineHelp/OnlineHelp.html
>
>
> ___
>
> 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/ahero2late%40gmail.com
>
> This email sent to ahero2l...@gmail.com
>


Send instant messages to your online friends http://uk.messenger.yahoo.com
___

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


Re: Triggering a Method when a Core Data Property changes.

2009-10-17 Thread Joshua Garnham
Hmm. Ok.

Could I sub class NSManagedObject then add the following code to make it 
observe objects as they are added or fetched?

- (void) awakeFromFetch {
[self addObserver:[NSApp delegate] forKeyPath:@"name" 
options:NSKeyValueObservingOptionNew context:nil];
}

- (void) awakeFromInsert {
[self addObserver:[NSApp delegate] forKeyPath:@"name" 
options:NSKeyValueObservingOptionNew context:nil];
}

But how would I trigger an action when the name property changes?

Cheers,
Josh.





From: Kyle Sluder 
To: Joshua Garnham 
Cc: macosx-...@omnigroup.com
Sent: Friday, 16 October, 2009 19:02:10
Subject: Re: Triggering a Method when a Core Data Property changes.

On Fri, Oct 16, 2009 at 10:57 AM, Joshua Garnham
 wrote:
> I am trying to trigger a method when A Core Data property is
> changed, e.g A Text Fields Text in a Table (connected to Core Data) is
> changed. Basically I want to be Key Value Observing the CD 'name' property of 
> all
> the objects in my Tree Controller, so that when the 'name' property of
> one of my objects is changed it triggers an action. How would I do this 
> though?

You need to observe each object as it is added to the tree controller.
This means observing the arrangedObjects property of the tree
controller, using that change notification to observe the children
property of the arrangedObjects proxy, using those change
notifications to observe the children property of each of those
objects, and so on.

--Kyle Sluder



___

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


Sending a Selector to another Class.

2009-10-21 Thread Joshua Garnham
How would I send a Selector to another class?
I know to send it to a selector in the same file you do 
[self performSelector:@selector(doSomething)];

and for sending it to another class I've tried 
[otherClass performSelector:@selector(doSomethingElse)];

But I just get an error in the Debugger saying
+[otherClass doSomethingElse]: unrecognized selector sent to class 0xe5c4

What have I done wrong?

Thanks.



___

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


Re: Sending a Selector to another Class.

2009-10-21 Thread Joshua Garnham
Hi,

That was all that showed up in the debugger, but in the class otherClass there 
is a method called doSomething. 
I have also tried what you suggested - [otherClass doSomethingElse] - but i get 
a warning in xcode, http://cld.ly/7c4la.
(JGManagedObject is what replaces otherClass)

Thanks.




From: Shawn Erickson 
To: Joshua Garnham 
Cc: cocoa-dev@lists.apple.com
Sent: Wednesday, 21 October, 2009 18:02:55
Subject: Re: Sending a Selector to another Class.




On Wed, Oct 21, 2009 at 9:23 AM, Joshua Garnham  
wrote:

>How would I send a Selector to another class?
>>I know to send it to a selector in the same file you do
>>[self performSelector:@selector(doSomething)];
>

Why not simply... [self doSomething] ?
 
>
>and for sending it to another class I've tried
>>[otherClass performSelector:@selector(doSomethingElse)];
>

Why not simply [otherClass doSomethingElse] ?

...aka... Why are you using performSelector in the above?
 
>But I just get an error in the Debugger saying
>>+[otherClass doSomethingElse]: unrecognized selector sent to class 0xe5c4
>
>>What have I done wrong?
>

You are sending a message to an object that doesn't respond to that message 
(aka no implementation for it). The error message you listed should have more 
information about the class of the object you messaged incorrectly, what does 
the rest of it say?

Hard to tell what may be going wrong with the limited information you have 
posted. I rather not waste time guessing (can think of at least 4 common things 
you could be doing wrong).

-Shawn



___

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


Re: Sending a Selector to another Class.

2009-10-21 Thread Joshua Garnham
Ah, I see. so I need to send it to an instance of the class not the class it 
self.
How would I do that?


Thanks,
Josh.



From: Jens Alfke 
To: Jim Kang 
Cc: Joshua Garnham ; cocoa-dev@lists.apple.com
Sent: Thursday, 22 October, 2009 6:21:29
Subject: Re: Sending a Selector to another Class.



On Oct 21, 2009, at 9:43 AM, Jim Kang wrote:

That selector is a unique index that points to a method of a specific class.
>

No, that's not true of Objective-C (although it is of C++ method-pointers.) A 
selector is, basically, just a unique string: it defines a message, not a 
method, to use the old Smalltalk OOP terminology. Any class that implements a 
method with that name uses the same selector for it, regardless of inheritance.

To be specific, if I create two unrelated classes A and B, each of which 
implements a -foo method, the selector @selector(foo) is used for both.

Joshua's problem was, apparently, that he was trying to send an message to a 
class object instead of an instance, but the corresponding method was defined 
on instances, not the class.

—Jens



___

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


Method Signature Problem.

2009-06-12 Thread Joshua Garnham
I am getting the Error/Warning about a part of my code saying 'Messages
Without A Matching Method Signature will be assumed to return 'id' and
accept '…' as arguments.)'
I do not understand why I am getting this
error, so please help, below is a link to that part of code in the
implementation file. 

http://fwdr.org/h8xf

The error is happening on this line:

 if ([[self objectArray] indexOfObject:rootObj] % 2)




___

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


Adding Padding To The ‘left’ of a Text Field.

2009-08-07 Thread Joshua Garnham
I have a text field with a background but to make it look right the text
field needs to have some padding (or a slight indent) on the left side of it a 
bit like the
NSSearchField (because of the search image). How would I give the text field 
some padding on the left?

Thanks,
Josh.




___

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


Setting The Line Height Of A NSTextField.

2009-08-07 Thread Joshua Garnham
I have a Sub-Classed NSTextFieldCell and am looking for some code to adjust the 
line height for each line so it looks right on the background of my NSTextField.

Thanks,
Josh.




___

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


Giving the Root Object of an Outline View a Different Background Color.

2009-08-08 Thread Joshua Garnham
I am looking for some code to make the root object's in an outline view have a 
different background color to the other rows.
I am pretty sure I need to sub-class the outline view but I don't know what 
code to add to the sub-class to do what I want it to do (which is what I 
described above).
Could someone give me some code to make the root objects in an outline view 
have different background color to the other rows?

Thanks,
Josh.




___

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


Making an NSOutlineView by Default have 1 Parent and 1 Child.

2009-08-10 Thread Joshua Garnham
What I am trying to do is that when my App is first opened the NSOutlineView 
will already have A Parent and A Child, the child being inside the parent, like 
in this picture, 
http://www.grabup.com/uploads/7490ffebda697ef976c3d6a3b57323ba.png.

What code would I need to do this?

Thanks,
Josh.




___

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


Starting editing for a Row as soon as it is Added.

2009-08-19 Thread Joshua Garnham
Hi There,

I have an NSOutlineView and what I want to happen is that when a row is
added I want the row that has been added to Start Editing immediately
like when you double click on a row.

I have had a go using the code below (but as I'm not that Confident with Cocoa) 
it did not work.

- (IBAction)add:(id)sender {
[treeController add:@"New Item"];
[outlineView rowForItem:(id)@"New Item"];
[outlineView editColumn:0 row:1 withEvent:nil select:YES];
}

The action is connected to the Add button in the Outline View.
What have I done wrong?

Thanks,
Josh.




___

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


Starting editing for a Row as soon as it is Added. (More Detail)

2009-08-19 Thread Joshua Garnham
Hi There,

I have an NSOutlineView and what I want to happen is that when a row is
added I want the row that has been added to Start Editing immediately
like when you double click on a row.

I have had a go using the code below (but as I'm not that Confident with Cocoa) 
it did not work.

- (IBAction)add:(id)sender {
[treeController add:@"New Item"];
[outlineView rowForItem:(id)@"New Item"];
[outlineView editColumn:0 row:1 withEvent:nil select:YES];
}

The action is connected to the Add button in the Outline View.

The line ->[outlineView rowForItem:(id)@"New Item"];
Is supposed to give the row number of the added row to the next line
->[outlineView editColumn:0 row:1 withEvent:nil select:YES];
instead of the number 1.
So what I am supposed to replace @"New Item" with in Lines 1 and 2 and make it 
do the above?  

Thanks,
Josh.




___

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


How do I make a header row have a gradient background in my NSOutlineView?

2009-08-20 Thread Joshua Garnham
I am using an NSOutlineView
in my App so i downloaded Apples Photo Search Sample App which uses an
NSOutlineView. While using it I noticed that it gives the root/header object
of the outline view a Gradient Background, so I looked through the code
but I couldn't see what did it. Would someone mind looking through the
code and then telling me what code gave the root object a background?
Here's the link to the Photo Search Download Page - 
http://developer.apple.com/Samplecode/PhotoSearch/index.html
Thanks!



___

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


Setting the Line Height/ Line Spacing in an NSTextView.

2009-12-24 Thread Joshua Garnham
How would I set the Line Height/ Line Spacing in an NSTextView? e.g How
tall each line is or how much space is between each line.

Thanks.




___

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


Setting the Line Height/ Line Spacing in an NSTextView.

2009-12-30 Thread Joshua Garnham
How would I set the Line Height/ Line Spacinh in an NSTextView? e.g How
tall each line is or how much space is between each line.

Here's what I've tried (but doesn't work), it is in a NSTextView subclass … 
- (void)setDefaultParagraphStyle:(NSMutableParagraphStyle *)paragraphStyle {
CGFloat spacing = 5.0f;
[paragraphStyle setLineSpacing:spacing];
[paragraphStyle setMinimumLineHeight:spacing];
[paragraphStyle setMaximumLineHeight:spacing];
}

What's wrong with it?




___

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


Re: Setting the Line Height/ Line Spacing in an NSTextView.

2009-12-30 Thread Joshua Garnham
But the methodssetLineSpacing: and others are NSMutableParagraphStyle methods 
only. 





From: Ross Carter 
To: Joshua Garnham 
Cc: cocoa-dev@lists.apple.com
Sent: Wed, 30 December, 2009 16:12:18
Subject: Re: Setting the Line Height/ Line Spacing in an NSTextView.

On Dec 30, 2009, at 10:43 AM, Joshua Garnham wrote:

> How would I set the Line Height/ Line Spacinh in an NSTextView? e.g How
> tall each line is or how much space is between each line.
> 
> Here's what I've tried (but doesn't work), it is in a NSTextView subclass … 
> - (void)setDefaultParagraphStyle:(NSMutableParagraphStyle *)paragraphStyle {
>CGFloat spacing = 5.0f;
>[paragraphStyle setLineSpacing:spacing];
>[paragraphStyle setMinimumLineHeight:spacing];
>[paragraphStyle setMaximumLineHeight:spacing];
> }
> 
> What's wrong with it?

A couple of things. First, the NSTextView method is - 
(void)setDefaultParagraphStyle:(NSParagraphStyle *)paragraphStyle. The argument 
is a regular NSParagraphStyle, not the mutable variety.

Second, rather than override - (void)setDefaultParagraphStyle:(NSParagraphStyle 
*)paragraphStyle, you simply use it as is. Construct your paragraphStyle 
elsewhere, and then send it to -setDefaultParagraphStyle:.



___

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


Fw: Setting the Line Height/ Line Spacing in an NSTextView.

2009-12-31 Thread Joshua Garnham
Thanks, there is no immediate need to override so I will try calling it.

So would this work?…

CGFloat spacing = 5.0f;
NSMutablePargagraphStyle *paragraphStyle;
[paragraphStyle setLineSpacing:spacing];
[paragraphStyle setMinimumLineHeight:spacing];
[paragraphStyle setMaximumLineHeight:spacing];
[textView setDefaultParagraphStyle:paragraphStyle];

- Josh





From: Fritz Anderson 
To: Joshua Garnham 
Cc: cocoa-dev List 
Sent: Wed, 30 December, 2009 17:24:21
Subject: Re: Setting the Line Height/ Line Spacing in an NSTextView.

On 30 Dec 2009, at 11:01 AM, Joshua Garnham wrote:

> But the methodssetLineSpacing: and others are NSMutableParagraphStyle methods 
> only. 

That's the point. You may _want_ to change the paragraph style's properties, 
but you can't. Casting the parameter doesn't turn an immutable object into a 
mutable one.

If you really want to substitute a paragraph style of your own (and please 
comment on the suggestions that you may not want to), make a mutableCopy, set 
that up as you wish, and pass it up to super.

You may be misconceiving the need to subclass in Cocoa. Subclassing is rare. 
Most modifications to object behaviors are done through delegates and property 
setters; Cocoa provides a lot of them. That's why you're getting told to _call_ 
setDefaultParagraphStyle:, not _override_ it. 

If you explained why you feel you must override, we might be better able to 
help you.

— 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


Re: Setting the Line Height/ Line Spacing in an NSTextView.

2010-01-01 Thread Joshua Garnham
That was a spelling mistake, it was meant to say NSMutableParagraphStyle.
I've tried doing this …

CGFloat spacing = 5.0f;
NSMutableParagraphStyle *paragraphStyle;
[paragraphStyle init];
[paragraphStyle setLineSpacing:spacing];
[paragraphStyle setMinimumLineHeight:spacing];
[paragraphStyle setMaximumLineHeight:spacing];
[textView setDefaultParagraphStyle:paragraphStyle]

But I get this error in the debugger:

-[NSSortDescriptor setLineSpacing:]: unrecognized selector sent to instance 
0x1b202a0



From: Graham Cox 
To: Joshua Garnham 
Cc: Cocoa-Dev List 
Sent: Fri, 1 January, 2010 0:16:04
Subject: Re: Setting the Line Height/ Line Spacing in an NSTextView.


On 01/01/2010, at 5:14 AM, Joshua Garnham wrote:

> So would this work?…

> NSMutablePargagraphStyle *paragraphStyle;
> [paragraphStyle setLineSpacing:spacing];

No - you haven't allocated/inited the paragraphStyle object, nor initialised 
the variable. Most probably this will crash. Also, there's no such class as 
NSMutablePargagraphStyle.

I'm guessing this is 'pseudocode', but it's really better not to do that but to 
write exactly what you mean. It saves a lot of potential misinterpretations.

--Graham



___

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


Re: Setting the Line Height/ Line Spacing in an NSTextView.

2010-01-01 Thread Joshua Garnham
Oh, I see. That works partly. The text that is already in the NSTextView at 
launch has the new Line Height but as soon as you start to type the line your 
typing on resets it's line height to default.





From: Graham Cox 
To: Joshua Garnham 
Cc: cocoa-dev@lists.apple.com
Sent: Fri, 1 January, 2010 9:16:36
Subject: Re: Setting the Line Height/ Line Spacing in an NSTextView.


On 01/01/2010, at 7:10 PM, Joshua Garnham wrote:

> That was a spelling mistake, it was meant to say NSMutableParagraphStyle.
> I've tried doing this …
> 
> CGFloat spacing = 5.0f;
> NSMutableParagraphStyle *paragraphStyle;
> [paragraphStyle init];


Well, this is just not how you allocate objects. In fact, you haven't allocated 
an object - you are calling -init on a piece of random memory. Usually that 
will crash but in this case it just so happens that the variable, by pure 
chance, happens to point to memory that contains a NSSortDescriptor which is 
rejecting the -setLineSpacing method call.

You need to do this:

NSMutableParagraphStyle* ps = [[NSMutableParagraphStyle alloc] init];

This is Cocoa 101. If you don't know about this, go back and make sure you read 
the most fundamental documentation. You won't get far without knowing how to 
correctly alloc/init objects, so fiddling with paragraph styles before you can 
alloc/init is definitely a case of running before you can walk.

--Graham



___

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


Re: Setting the Line Height/ Line Spacing in an NSTextView.

2010-01-01 Thread Joshua Garnham
How would I use that?





From: Paul Sanders 
To: Joshua Garnham ; Graham Cox 

Cc: cocoa-dev@lists.apple.com
Sent: Fri, 1 January, 2010 15:09:47
Subject: Re: Setting the Line Height/ Line Spacing in an NSTextView.

Check out NSTextView's setTypingAttributes: method.  And look up 
the meaning of NSParagraphStyleAttributeName.  It's really not 
so hard...

Paul Sanders.

- Original Message - 
From: "Joshua Garnham" 
To: "Graham Cox" 
Cc: 
Sent: Friday, January 01, 2010 12:35 PM
Subject: Re: Setting the Line Height/ Line Spacing in an 
NSTextView.


Oh, I see. That works partly. The text that is already in the 
NSTextView at launch has the new Line Height but as soon as you 
start to type the line your typing on resets it's line height to 
default.



___

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


Re: Setting the Line Height/ Line Spacing in an NSTextView.

2010-01-02 Thread Joshua Garnham
Thanks for the Guide/Walkthrough, Here's what I have come up with from that:

NSDictionary *tA = [textView typingAttributes];
NSMutableDictionary *tAM = [tA mutableCopy];
NSParagraphStyle *pS = [tAM objectForKey:NSParagraphStyleAttributeName];
NSMutableParagraphStyle *pSM = [pS mutableCopy];
[pSM setMinimumLineHeight:spacing];
[pSM setMaximumLineHeight:spacing];
[tAM setObject:pSM forKey:NSParagraphStyleAttributeName];
[textView setTypingAttributes:tAM];
[tAM release];
[pSM release];

All of it seems ok in XCode but when I run it I get an error in the debugger 
saying 

 *** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: 
NSParagraphStyle)

It seems to be saying that the NSMutableParagraphStyle is empty. I'll take a 
look at Aaron's Book, Thanks. 


Josh





From: Paul Sanders 
To: Graham Cox ; Joshua Garnham 

Cc: Cocoa-Dev List 
Sent: Sat, 2 January, 2010 11:04:52
Subject: Re: Setting the Line Height/ Line Spacing in an NSTextView.

Well, I have to say Graham has a point there, and I'm not going 
to write your code for you, but what I do goes something like 
this:

1.  Get the current typing attributes from my NSTextView (as an 
NSDictionary)

2.  Make a mutable copy (as an NSMutableDictionary)

3.  Retrieve the current NSParagrahpStyle from the dictionary 
(using NSParagraphStyleAttributeName as a key)

4.  Make a mutable copy of that (as an NSMutableParagraphStyle)

5.  Adjust this as desired (refer to docs)

6.  Add it to the NSMutableDictionary (again with key 
NSParagraphStyleAttributeName)

7.  Pass the dictionary to NSTextView's setTypingAttributes 
method

8.  Release your mutable copies

You can do something similar (using NSFont and 
NSFontAttributeName) if you want to change the font (which might 
be what you're after, I'm not sure).

If none of this makes any sense to you, you need to do some 
background reading (it's not something you can do in 5 minutes) 
and then write youself a little test program.  Mine is called 
Cocoa Testbench, and it taught me a lot.

As an aside, I remember when I first started learning Cocoa how 
tiring I found it, mentally (I am not the youngest of spring 
chickens).  There is a lot to know.  I think it's Hillegass who 
recommends getting plenty of sleep.  His book "Cocoa Programming 
for Mac OS X" might be worth buying (that will be $5 please 
Aaron :).

Paul Sanders

- Original Message - 
From: "Graham Cox" 
To: "Joshua Garnham" 
Cc: "Cocoa-Dev List" 
Sent: Saturday, January 02, 2010 10:13 AM
Subject: Re: Setting the Line Height/ Line Spacing in an 
NSTextView.



On 02/01/2010, at 6:57 PM, Joshua Garnham wrote:

> How would I use that?


RTFM:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextArchitecture/TextArchitecture.pdf

--Graham


___

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/p.sanders%40alpinesoft.co.uk

This email sent to p.sand...@alpinesoft.co.uk 



___

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


Re: Setting the Line Height/ Line Spacing in an NSTextView.

2010-01-02 Thread Joshua Garnham
Thanks that works now!





From: Paul Sanders 
To: Joshua Garnham 
Cc: cocoa-dev@lists.apple.com
Sent: Sat, 2 January, 2010 15:03:11
Subject: Re: Setting the Line Height/ Line Spacing in an NSTextView.

  
Yep, that looks ok.  I think pS is probably being returned as 
nil.  You can check this in Xcode.  In which case, you can add:
 
if (pS == nil)
pS = [NSParagraphStyle defaultParagraphStyle];
 
Paul Sanders.
 
- Original Message - 
From: Joshua 
Garnham 
To: Paul Sanders 
Cc: cocoa-dev@lists.apple.com 
Sent: Saturday, January 02, 2010 2:52 PM
Subject: Re: Setting the Line Height/ Line Spacing in an 
NSTextView.

Thanks for the Guide/Walkthrough, Here's what I have come up with from 
that:


NSDictionary *tA = [textView typingAttributes];

NSMutableDictionary *tAM = [tA mutableCopy];

NSParagraphStyle *pS = [tAM 
objectForKey:NSParagraphStyleAttributeName];

NSMutableParagraphStyle *pSM = [pS mutableCopy];

[pSM setMinimumLineHeight:spacing];

[pSM setMaximumLineHeight:spacing];

[tAM setObject:pSM forKey:NSParagraphStyleAttributeName];

[textView setTypingAttributes:tAM];

[tAM release];

[pSM release];

All of it seems ok in XCode but when I run it I get 
an error in the debugger saying 

 *** 
-[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: 
NSParagraphStyle)

It seems to be saying that the 
NSMutableParagraphStyle is empty. I'll take a look at Aaron's Book, Thanks. 


Josh





 From: Paul Sanders 

To: Graham Cox 
; Joshua Garnham 

Cc: Cocoa-Dev List 

Sent: Sat, 2 January, 2010 
11:04:52
Subject: Re: Setting 
the Line Height/ Line Spacing in an NSTextView.

Well, I have to 
say Graham has a point there, and I'm not going 
to write your code for you, 
but what I do goes something like 
this:

1.  Get the current 
typing attributes from my NSTextView (as an 
NSDictionary)

2.  
Make a mutable copy (as an NSMutableDictionary)

3.  Retrieve the 
current NSParagrahpStyle from the dictionary 
(using 
NSParagraphStyleAttributeName as a key)

4.  Make a mutable copy of 
that (as an NSMutableParagraphStyle)

5.  Adjust this as desired 
(refer to docs)

6.  Add it to the NSMutableDictionary (again with 
key 
NSParagraphStyleAttributeName)

7.  Pass the dictionary to 
NSTextView's setTypingAttributes 
method

8.  Release your mutable 
copies

You can do something similar (using NSFont and 
NSFontAttributeName) if you want to change the font (which might 
be what 
you're after, I'm not sure).

If none of this makes any sense to you, you 
need to do some 
background reading (it's not something you can do in 5 
minutes) 
and then write youself a little test program.  Mine is called 
Cocoa Testbench, and it taught me a lot.

As an aside, I remember when 
I first started learning Cocoa how 
tiring I found it, mentally (I am not the 
youngest of spring 
chickens).  There is a lot to know.  I think 
it's Hillegass who 
recommends getting plenty of sleep.  His book "Cocoa 
Programming 
for Mac OS X" might be worth buying (that will be $5 please 
Aaron :).

Paul Sanders

----- Original Message - 
From: 
"Graham Cox" 
To: 
"Joshua Garnham" 
Cc: 
"Cocoa-Dev List" 
Sent: 
Saturday, January 02, 2010 10:13 AM
Subject: Re: Setting the Line Height/ 
Line Spacing in an 
NSTextView.



On 02/01/2010, at 6:57 PM, 
Joshua Garnham wrote:

> How would I use 
that?


RTFM:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextArchitecture/TextArchitecture.pdf

--Graham


___

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/p.sanders%40alpinesoft.co.uk

This 
email sent to p.sand...@alpinesoft.co.uk 



___

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


Animating an NSView in from Below.

2010-01-04 Thread Joshua Garnham
I know there are tutorials
like Marcus Zarras which shows how to change from one view to another,
but I would like to animate in a view which isn't going to replace another
view. Here's what I have at the moment:http://drp.ly/9w86s (Test App).
The view seems to slide in but the view isn't actually displayed. What's wrong?

Thanks.




___

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


Coloring a Row in a NSTableView.

2010-01-10 Thread Joshua Garnham
What I am looking to do is set the background color of the selected row in an 
NSTableView when a I button is clicked.
I've seen other cases where people have used 
tableView:willDisplayCell:forTableColumn:row: and setBackgroundColor: but I 
don't think that will work in my situation where I want it to happen when a 
button is clicked.

I know that I can find the selected row with NSTableView's selectedRow method 
and set the Background color for a cell with setBackgroundColor:, but what I 
don't know how to do is get from a NSInteger for the selected row to an NSCell 
to set the background color of.
Here's what I have so far:
- (void)tableView:(NSTableView *)aTableView 
  willDisplayCell:(id)aCell 
   forTableColumn:(NSTableColumn *)aTableColumn 
  row:(NSInteger)rowIndex {
NSLog(@"Coloring Method Begun");
int selectedRow = [outlineView selectedRow];
if (selectedRow == nil) {
}else {
if (clicked == YES) {
[aCell setBackgroundColor:[NSColor lightGrayColor]];
clicked = NO;
NSLog(@"Coloring Method Ended");
}else {
}
}
}

- (IBAction)colorize:(id)sender{
NSLog(@"Click Method Begun");
clicked = YES;
NSIndexSet *selectedRowSet = [outlineView selectedRowIndexes];
NSIndexSet *selectedColumnSet = [outlineView selectedColumnIndexes];
[outlineView reloadDataForRowIndexes:selectedRowSet 
columnIndexes:selectedColumnSet];
NSLog(@"Click Method Ended");
}

But it seems that the delegate method is never triggered. 




___

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