How To Bind The Enabled Property of NSPopUpButtonCell Menu Items

2013-08-02 Thread Chris Tracewell
I've got a two column NSTableView that is bound to an array controller. Each of 
the elements in the array looks something like this...

NSMutableDictionary *theDictionary = [NSMutableDictionary 
dictionaryWithDictionary: @{@myOptions:theOptionArray,@myTitle: theTitle}];

Column 1 is bound to myTitle and column 2, whcih had an NSPopUpButtonCell in 
it, is bound to myOptions. This all works up to this point, the menus populate 
for each row in the table view and I can make selections and update things in 
my controller. What I need to do is bind the individual enabled state of each 
menu item in the myOptions array. Binding the enabled state for the column does 
not work as it disables the entire menu. I've tried binding to both 
NSPopUpButtonCell and its NSMenuItem but nothing happens (all menu items remain 
enabled). Just to test I tried binding these two to arrangedObjects @count of 
the array controller (using NSNegateBoolean) but still nothing.

The other two methods I have tried is a custom NSValueTransformer for the 
NSMenuItem and the validateMenuItem method. The transformer got called but I 
logged the value it was passing in and it's the array myOptions not the 
individual menu items. The validateMenuItem method worked for other UI 
NSPopUpMenus but not the ones in my tableview. 

Is this possible to do with bindings? Thanks for the help.


CT
___

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

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

Re: How To Bind The Enabled Property of NSPopUpButtonCell Menu Items

2013-08-02 Thread Chris Tracewell
Thanks for the suggestion, I had already done that to no avail. Where should I 
be binding the enabled property? NSPopUpButtonCell or NSMenuItem?


CT



On Aug 2, 2013, at 1:33 PM, Lee Ann Rucker lruc...@vmware.com wrote:

 Turn off Auto Enables Items in the popup's menu. If it's on it goes through 
 menu validation instead of bindings.
 
 On Aug 2, 2013, at 1:12 PM, Chris Tracewell wrote:
 
 I've got a two column NSTableView that is bound to an array controller. Each 
 of the elements in the array looks something like this...
 
 NSMutableDictionary *theDictionary = [NSMutableDictionary 
 dictionaryWithDictionary: @{@myOptions:theOptionArray,@myTitle: 
 theTitle}];
 
 Column 1 is bound to myTitle and column 2, whcih had an NSPopUpButtonCell in 
 it, is bound to myOptions. This all works up to this point, the menus 
 populate for each row in the table view and I can make selections and update 
 things in my controller. What I need to do is bind the individual enabled 
 state of each menu item in the myOptions array. Binding the enabled state 
 for the column does not work as it disables the entire menu. I've tried 
 binding to both NSPopUpButtonCell and its NSMenuItem but nothing happens 
 (all menu items remain enabled). Just to test I tried binding these two to 
 arrangedObjects @count of the array controller (using NSNegateBoolean) but 
 still nothing.
 
 The other two methods I have tried is a custom NSValueTransformer for the 
 NSMenuItem and the validateMenuItem method. The transformer got called but I 
 logged the value it was passing in and it's the array myOptions not the 
 individual menu items. The validateMenuItem method worked for other UI 
 NSPopUpMenus but not the ones in my tableview. 
 
 Is this possible to do with bindings? Thanks for the help.
 
 
 CT
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
 
 This email sent to lruc...@vmware.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: How To Bind The Enabled Property of NSPopUpButtonCell Menu Items

2013-08-02 Thread Chris Tracewell
I took a look, thanks for the files. I had both deselected already, still makes 
no difference. I created a new project and rolled a stripped down version and 
it acted the same way. I can't see how bindings and validateMenuItem can work 
together in this scenario. I'm going to try catching change selections and 
validate there as the revalidation only needs to happen after a change. I've 
posted my simple project displaying the project if you're interested.

http://tinyurl.com/k3y7432


CT



On Aug 2, 2013, at 2:27 PM, Lee Ann Rucker lruc...@vmware.com wrote:

 NSMenuItem. I noticed that the NSPopUpButtonCell also has an autoenables 
 items flag; a quick bit of hacking on the ButtonMadness sample app shows that 
 needs to be off too. I'll send you the files off-list.
 
 On Aug 2, 2013, at 1:56 PM, Chris Tracewell wrote:
 
 Thanks for the suggestion, I had already done that to no avail. Where should 
 I be binding the enabled property? NSPopUpButtonCell or NSMenuItem?
 
 
 CT
 
 
 
 On Aug 2, 2013, at 1:33 PM, Lee Ann Rucker lruc...@vmware.com wrote:
 
 Turn off Auto Enables Items in the popup's menu. If it's on it goes 
 through menu validation instead of bindings.
 
 On Aug 2, 2013, at 1:12 PM, Chris Tracewell wrote:
 
 I've got a two column NSTableView that is bound to an array controller. 
 Each of the elements in the array looks something like this...
 
 NSMutableDictionary *theDictionary = [NSMutableDictionary 
 dictionaryWithDictionary: @{@myOptions:theOptionArray,@myTitle: 
 theTitle}];
 
 Column 1 is bound to myTitle and column 2, whcih had an NSPopUpButtonCell 
 in it, is bound to myOptions. This all works up to this point, the menus 
 populate for each row in the table view and I can make selections and 
 update things in my controller. What I need to do is bind the individual 
 enabled state of each menu item in the myOptions array. Binding the 
 enabled state for the column does not work as it disables the entire menu. 
 I've tried binding to both NSPopUpButtonCell and its NSMenuItem but 
 nothing happens (all menu items remain enabled). Just to test I tried 
 binding these two to arrangedObjects @count of the array controller (using 
 NSNegateBoolean) but still nothing.
 
 The other two methods I have tried is a custom NSValueTransformer for the 
 NSMenuItem and the validateMenuItem method. The transformer got called but 
 I logged the value it was passing in and it's the array myOptions not the 
 individual menu items. The validateMenuItem method worked for other UI 
 NSPopUpMenus but not the ones in my tableview. 
 
 Is this possible to do with bindings? Thanks for the help.
 
 
 CT
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
 
 This email sent to lruc...@vmware.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

NSPopUpButtonCell - How To Get The Changed Value

2013-06-08 Thread Chris Tracewell
I have a tableview that has two columns. The second column has an 
NSPopUpButtonCell. The tableview content is supplied via an array controller of 
dictionaries. The first column shows the title key's value and the second 
column (the NSPopUpButtonCell) shows and array of choices in the dictionaries 
options key.  The array is a property of the view controller. All of the 
bindings are functioning correctly but I can't seem to make KVO work since it's 
an array in a dictionary inside an array. Ideally I would observe the change 
and then update a separate object with the new value. Each of the 
NSPopUpButtonCells in the tableview has it's own distinct set of options which 
is why I have put them as a property in the dictionary.

Since bindings seem impossible with this approach, I set the 
NSPopUpButtonCell's action to a method in my view controller with the thought 
of grabbing the new value and then updating my models property manually. 
However the action seems to be sent before bindings has actually updated 
anything so I still get the old value that is the value selected before I 
changed the selection in the menu. Anyway, I'm at a dead end and would really 
appreciate any help and critique.

-CT
___

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

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


Re: OutlineView shouldSelectItem Being Called Twice

2013-06-05 Thread Chris Tracewell
Thanks for the reply. This OV is acting as a master for a detail view that must 
be saved before the selection changes if it's dirty. Is there another method to 
intercept the OV row click before selection actually changes wherein I can 
validate and present an NSAlert for save,cancel,discard options if need be?


-CT



On Jun 4, 2013, at 7:31 PM, Graham Cox graham@bigpond.com wrote:

 
 On 05/06/2013, at 11:56 AM, Chris Tracewell ch...@thinkcl.com wrote:
 
 Is this normal behavior? Thanks for the help.
 
 
 Probably. This method should just answer the question, not attempt to 
 interrupt things by showing an alert etc. You'll need to put that 
 functionality elsewhere.
 
 --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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


OutlineView shouldSelectItem Being Called Twice

2013-06-04 Thread Chris Tracewell
I've got a view controller set up as the delegate for an outlineView. The view 
controller implements the -(BOOL)outlineView:(NSOutlineView *)outlineView 
shouldSelectItem:(id)item delegate method. I show an alert and return NO if the 
user has not saved some changes or return YES if all is well. The problem is 
that when I return no the delegate method fires twice. Even when I strip out 
all of my code and just log the method as shown below it shows two calls. 
Returnign YES works fine. I thought maybe it's because it was firing once for 
the original election change and then again to return back to the original 
selection but logging item showed its the same row for both calls.

-(BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item
{
NSLog(@firing);
return NO;
}

Is this normal behavior? Thanks for the help.

-CT



___

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

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


Re: Custom Delegate - Using _delegate works but not delegate or [self delegate]

2013-03-26 Thread Chris Tracewell
On Mar 25, 2013, at 7:33 PM, Conrad Shultz conrad_shu...@apple.com wrote:

 In the code you shared you had used delegate in one place and [self 
 delegate] in another; the second case is the correct one. If you replace all 
 naked uses of delegate with [self delegate] and you continue to get 
 compile-time errors please post your entire class or a reduced test case.

Okay, I am realizing that my original post was misleading about what the main 
issue is. The main point I should have made is that [self delegate] is not 
being allowed to handle my custom delegate methods. It is expecting a method 
from NSOutlineViewDelegate. The error I am getting is

No known instance method for selector 'outlineView:enterKetPressedForRow:'

Can I make a category on NSOutlineViewDelegate? Here's my original code with 
corrected [self delegate]


HEADER


#import Cocoa/Cocoa.h

@class TKOutlineView; // lets compiler know the @interface deleration is coming 
since we put @protocol before it

// delegate protocol
@protocol TKOutlineViewDelegate NSObject // NSObject because we need to use 
respondsToSelector
@optional
-(void)outlineView:(NSOutlineView *)theOutlineView 
enterKeyPressedForRow:(NSInteger)theRow;
-(void)outlineView:(NSOutlineView *)theOutlineView 
deleteKeyPressedForRow:(NSInteger)theRow;
@end

@interface TKOutlineView : NSOutlineView {}

@end



IMPLEMENTATION


#import TKOutlineView.h

@implementation TKOutlineView


-(void)keyDown:(NSEvent *)theEvent
{
if ([[theEvent characters] length] == 0)
{
// dead key
return;
}
else if ([[theEvent characters] length] == 1  [[theEvent characters] 
characterAtIndex:0] == NSEnterCharacter  [[self delegate] 
respondsToSelector:@selector(outlineView: enterKeyPressedForRow:)]) 
{
[[self delegate]  outlineView:self enterKeyPressedForRow:[self 
selectedRow]];  /* ERROR  THIS LINE */
}
else if ([[theEvent characters] length] == 1  [[theEvent characters] 
characterAtIndex:0] == NSDeleteCharacter  [[self delegate] 
respondsToSelector:@selector(outlineView: deleteKeyPressedForRow:)])
{
[[self delegate]  outlineView:self deleteKeyPressedForRow:[self 
selectedRow]];  /* ERROR  THIS LINE */
}
else 
{
[super keyDown:theEvent];
}
}

@end


How can I get [self delegate] to recognize my custom methods?

CT
___

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

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


Re: Custom Delegate - Using _delegate works but not delegate or [self delegate]

2013-03-26 Thread Chris Tracewell
On Mar 26, 2013, at 12:38 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 2. Redeclare the delegate property:
 
   @interface TKOutlineView : NSOutlineView {}
   @property (nonatomic,readonly) idTKOutlineViewDelegate delegate;
   @end
 
   @implementation TKOutlineView
   @dynamic delegate;
   …
   [[self delegate]  outlineView:self enterKeyPressedForRow:[self 
 selectedRow]];
   …
 
 The @dynamic statement says I don't have an implementation of the 'delegate' 
 property in this class, but that's just fine because it's already implemented 
 (in my superclass).

Aha, success. Thank you - a very elegant and sensible solution.

CT


___

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

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

Re: Custom Delegate - Using _delegate works but not delegate or [self delegate]

2013-03-26 Thread Chris Tracewell
On Mar 26, 2013, at 12:38 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 2. Redeclare the delegate property:
 
   @interface TKOutlineView : NSOutlineView {}
   @property (nonatomic,readonly) idTKOutlineViewDelegate delegate;
   @end
 
   @implementation TKOutlineView
   @dynamic delegate;
   …
   [[self delegate]  outlineView:self enterKeyPressedForRow:[self 
 selectedRow]];
   …
 
 The @dynamic statement says I don't have an implementation of the 'delegate' 
 property in this class, but that's just fine because it's already implemented 
 (in my superclass).

Aha, success. Thank you - a very elegant and sensible solution.

CT


___

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

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

Re: Custom Delegate - Using _delegate works but not delegate or [self delegate]

2013-03-26 Thread Chris Tracewell
On Mar 26, 2013, at 1:11 PM, Conrad Shultz conrad_shu...@apple.com wrote:

 If code expecting an NSOutlineView receives a TKOutlineView instance it may 
 break or behave unexpectedly since it may well try to set a delegate 
 conforming to NSOutlineViewDelegate but you have made your class require a 
 delegate conforming to the more specific TKOutlineViewDelegate.
 
 This is why I earlier suggested declaring a -customDelegate (or whatever 
 you'd like to call it) property that would not interfere with the expected 
 delegate behavior.
 
 -Conrad

I think I understand, but have I really required such code to conform to 
TKOutlineViewDelegate? Wouldn't it be in error to hand code expecting 
NSOutlineView a TKOutlineView? It seems that since TKOutlineView is a subclass 
of NSOutlineView that only code that handles TKOutlineView objects will gain 
these new delegate methods. In addition, those methods do check to make sure 
the delegate implements the method before I actually send to it. 

I'm obviously not fully clear on this topic so thanks in advance for any input.

CT
___

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

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


Custom Delegate - Using _delegate works but not delegate or [self delegate]

2013-03-25 Thread Chris Tracewell
I have a subclass of NSOutlineView that has custom delegate methods. In the 
implementation file I get an error for No known instance method for 
selector... when I call these declared methods using [self delegate] or 
delegate. However the compiler suggested using _delegate and that makes the 
error go away. I thought since my subclass inherits from NSOutlineView that 
delegate would be recognized and available.



HEADER


#import Cocoa/Cocoa.h

@class TKOutlineView; // lets compiler know the @interface deleration is coming 
since we put @protocol before it

// delegate protocol
@protocol TKOutlineViewDelegate NSObject // NSObject because we need to use 
respondsToSelector
@optional
-(void)outlineView:(NSOutlineView *)theOutlineView 
enterKeyPressedForRow:(NSInteger)theRow;
-(void)outlineView:(NSOutlineView *)theOutlineView 
deleteKeyPressedForRow:(NSInteger)theRow;
@end

@interface TKOutlineView : NSOutlineView {}

@end



IMPLEMENTATION


#import TKOutlineView.h

@implementation TKOutlineView


-(void)keyDown:(NSEvent *)theEvent
{
if ([[theEvent characters] length] == 0)
{
// dead key
return;
}
else if ([[theEvent characters] length] == 1  [[theEvent characters] 
characterAtIndex:0] == NSEnterCharacter  [[self delegate] 
respondsToSelector:@selector(outlineView: enterKeyPressedForRow:)]) 
{
[delegate outlineView:self enterKeyPressedForRow:[self 
selectedRow]];
}
else if ([[theEvent characters] length] == 1  [[theEvent characters] 
characterAtIndex:0] == NSDeleteCharacter  [[self delegate] 
respondsToSelector:@selector(outlineView: deleteKeyPressedForRow:)])
{
[delegate outlineView:self deleteKeyPressedForRow:[self 
selectedRow]];
}
else 
{
[super keyDown:theEvent];
}
}

@end


Is _delegate the correct usage here or have I done something else wrong? Thank 
you.

CT

___

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

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


Re: Custom Delegate - Using _delegate works but not delegate or [self delegate]

2013-03-25 Thread Chris Tracewell
On Mar 25, 2013, at 1:54 PM, Conrad Shultz conrad_shu...@apple.com wrote:
 [self delegate] is not the same as delegate - the former sends the 
 -delegate message, the latter references a variable named delegate (which 
 the compiler is telling you does not exist).

I assumed that since my subclass inherits from NSOutlineView which already has 
a delegate instance method that a delegate ivar already existed? Since this is 
occuring while converting to ARC could it be that _delegate is working because 
modern Objective-c adds the underscore to the front of ivars during synth? 
Still though, I do not understand why [self delegate] will not work. 

 this must be that my delegate declarations are incorrect.

 For example, here you correctly use [self delegate] in the if() condition 
 but improperly fall back to merely delegate for actually dispatching your 
 delegate message.

I had replaced [self delegate] with delegate while troubleshooting, but both 
trigger the error. I am transitioning to ARC, [self delegate] was working 
compiling in XCode 3.2 for 10.6.8.

___

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

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


ARC Help

2013-03-22 Thread Chris Tracewell
In a project I am moving from GC to ARC I'm trying to understand the nuances of 
the new declarations. I have many pre-ARC properties that look like...


@interface TKObject : NSObject
{
NSString *theString;
}

@property(readwrite,assign) NSString *theString;


After ARC conversion it looks like


@interface TKObject : NSObject
{
NSString *__strong theString;
}

@property(readwrite,strong) NSString *theString;


My question is, couldn't it just as easily be written the same as the pre ARC 
style sans assign in @property since strong is the default? I noticed that in 
most of my files that the ARC conversion tool changes it simply replaced 
properties with assign type with the strong and __strong designators. However 
three files out of about 50 it just dropped the assign form @property. Is there 
a difference or reason for this?


CT


___

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

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


Re: ARC Help

2013-03-22 Thread Chris Tracewell
On Mar 22, 2013, at 1:51 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 Note that you can likely just remove the ivar declaration completely, or at 
 worst move it to the @implemenation statement instead. There's really no need 
 to put a private ivar in a public interface file any more.

In this case this is a property though isn't it and not a private instance 
variable? It is synthesized in .m so there are public getters and setters. I'm 
a bit confused as I thought a synthesized property would require it to be 
declared in .h or it wouldn't compile. 

 If you're going through the code cleaning things up, I'd also suggest you 
 take the trouble to add 'nonatomic' to your properties generally, 

I don't have any need to worry about multi-threading so is your suggestion to 
declare nonatomic for speed since the default of atomic is overkill? 

 or to add an explicit 'atomic' in only those cases where atomicity is 
 required and (for custom accessors) actually implemented.


Do you mean to add 'atomic' by not declaring 'nonatomic'? I just read that 
'atomic' is not an actual keyword and will cause a crash... but that thread was 
from '09 -- 
http://stackoverflow.com/questions/588866/atomic-vs-nonatomic-properties

 By chance, did those 3 files have the ivars for the properties synthesized -- 
 not explicitly declared? 

Not sure I follow you. Each followed the same structure - declared in 
@interface, designated with their own @property and then synthesized in .m. I 
didn't think there was any other option when declaring synthesized properties, 
however I still have much to learn.

CT
___

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

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


Re: ARC Help

2013-03-22 Thread Chris Tracewell
On Mar 22, 2013, at 3:27 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 (sorry, this turned into a tome)

No need to apologize. Very, very helpful - thank you so much for the input, it 
clears everything up. I'll be reading up on the modern Objective-c changes. 

Thanks


CT


___

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

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


How can modal window pass messages to its parent window?

2013-03-18 Thread Chris Tracewell
I have a main window which has a child/auxilary window. When the user presses a 
button in the UI the main window controller inits the child, assigns itself as 
the object for the child window's myOwner property and then launches the child 
window as a modal via NSApp runModalForWindow. This worked fine in XCode 3 but 
now I'm finally making the leap to XCode 4.6 and converting to ARC and it does 
not like this semantic because it does not know what class myOwner is when I 
make method calls to it and thus gives me warnings all over the place. I can't 
really include the parent header in the child window controller as it is 
included in the parent window controller. How should I be doing this? 

myProductBuilderWindow = [[TKProductBuilderWindowController alloc] 
initWithWindowNibName:@ProductBuilder];
[myProductBuilderWindow setMyOwner:self];
[NSApp runModalForWindow:[myProductBuilderWindow window]];

Basically the main window controller has several properties, mostly arrays, 
that the child window needs access to to do its specialized work.


CT
___

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

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


Declaring Variables - Setting to nil VS Not Setting?

2012-04-26 Thread Chris Tracewell
I usually use the sample in line 1 when declaring vars inside my methods.

NSString *theString = [NSString string];
NSString *theString = nil; 
NSString *theString;

I thought lines 2 and 3 were the same thing. I was wrong. What is the 
difference and when do you use the style shown in line 3?

Thanks and pointers to docs are welcome.

--chris
___

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

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


Re: Declaring Variables - Setting to nil VS Not Setting?

2012-04-26 Thread Chris Tracewell
On Apr 26, 2012, at 1:17 PM, Fritz Anderson wrote:

 You should be able to get this from any elementary book about C.

I'm sure you are correct.

 NSString *theString = nil; 
 
 fills it with zero (not a pointer to anything).
 
 NSString *theString;
 
 and doesn't fill it with anything; the variable contains whatever junk was 
 left in the portion of memory the variable now uses.

Thank you these were excellent answers.
___

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

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


Re: Declaring Variables - Setting to nil VS Not Setting?

2012-04-26 Thread Chris Tracewell
On Apr 26, 2012, at 1:20 PM, David Duncan wrote:

 In C unless you explicitly initialize a local variable its value is 
 undefined, and Objective-C inherits this behavior.

Thank you, that was what I was after.

 I believe however that under ARC these lines are equivalent (at least thats 
 my reading of section 4.2 on initialization at 
 http://clang.llvm.org/docs/AutomaticReferenceCounting.html) but given your 
 comments I suspect you are not using ARC.

I'm using GC, still on 10.6 and XCode 3.2.6


--chris
___

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

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


Re: NSDrawTiledRects Only Draws One Side

2012-03-14 Thread Chris Tracewell

On Mar 13, 2012, at 5:27 PM, Jens Alfke wrote:

 
 On Mar 13, 2012, at 4:33 PM, Chris Tracewell wrote:
 
 NSDrawTiledRects(NSInsetRect(theVendorTextRect,10,10), theVendorTextRect, 
 theSides, theGrays, 1);
 NSDrawTiledRects(theBillToTextRect, theBillToTextRect, theSides, theGrays, 
 1);
 NSDrawTiledRects(theShipToTextRect, theShipToTextRect, theSides, theGrays, 
 1);
 
 The last parameter is 1, so you’re only telling it to draw one edge. It looks 
 like you meant to specify 4. (The count parameter should match the sizes of 
 the arrays you pass for sides and grays.)
 
 —Jens



Thanks Jen and also to John Brown. That fixed it. I had read the docs for the 
count parameter to mean stroke thickness.

--Chris
___

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

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

NSDrawTiledRects Only Draws One Side

2012-03-13 Thread Chris Tracewell
Using XCode 3.2.6, OSX 10.6.8 - GC is on


I have three rects I am trying to stroke on all four sides using 
NSDrawTiledRects however only the first side listed in my NSRectEdge list gets 
drawn. I'm using the boundsRect as the clippingRect but that shouldn't should 
it? I did experiment with insetting the bounds rect 10 points as you can see 
bleow just in case it was getting clipped but it makes no diff.

NSRectEdge theSides[] = {NSMinXEdge,NSMaxXEdge,NSMinYEdge,NSMaxYEdge};
CGFloat theGrays[] = {NSBlack,NSBlack,NSBlack,NSBlack};

NSDrawTiledRects(NSInsetRect(theVendorTextRect,10,10), theVendorTextRect, 
theSides, theGrays, 1);
NSDrawTiledRects(theBillToTextRect, theBillToTextRect, theSides, theGrays, 1);
NSDrawTiledRects(theShipToTextRect, theShipToTextRect, theSides, theGrays, 1);

Anyone have any suggestions?


--Chris
___

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

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


draggingEntered Not Working As Expected

2011-08-03 Thread Chris Tracewell
XCode 4, 10.6 GC -- I have an IKImageBrowserView which I have implemented drag 
and drop for. I have set my view controller as the image browser's drag 
delegate, registered for pasteboard drag types in awakeFromNib and implemented 
DnD protocol methods like so...

-(void)awakeFromNib
{
[myProductImageBrowser registerForDraggedTypes: [[NSArray 
arrayWithObjects:@productIndexObjectType,NSFilenamesPboardType, nil] 
arrayByAddingObjectsFromArray:[NSImage imagePasteboardTypes]]];
}

-(NSDragOperation)draggingEntered:(id NSDraggingInfo)sender
{
NSLog(@DND Entered);
return NSDragOperationNone;
}

-(NSDragOperation)draggingUpdated:(id NSDraggingInfo)sender // validate 
position
{
NSLog(@DND Uppdated);
if ([myProductImageBrowser dropOperation] == IKImageBrowserDropOn)
{
return NSDragOperationEvery;
}

return NSDragOperationNone;
}

-(BOOL)performDragOperation:(id NSDraggingInfo)sender // Drop Occured
{
NSLog(@DND Perform);
NSArray *theFileArray = [[sender draggingPasteboard] 
propertyListForType:NSFilenamesPboardType];

if ([theFileArray count] == 1)
{
NSImage *theImage = [[NSImage alloc] 
initWithContentsOfFile:[theFileArray objectAtIndex:0]];

if (theImage) 
{
TKProductMaster *theProductMaster = 
[[myProductMasterArrayController arrangedObjects] 
objectAtIndex:[myProductImageBrowser indexAtLocationOfDroppedItem]];
[theProductMaster setMyImage:theImage];
[theProductMaster setImageVersion:[theProductMaster 
imageVersion] + 1]; // up the version number so the image browser knows to 
trash onld image cache

[myProductImageBrowser reloadData];
return YES;
}
}

return NO;
}

QUESTION #1
I will test for the other pboard types later, but right now what is confusing 
me is that draggingEntered, which returns NSDragOperationNone, is not stopping 
anything. The logs are showing so it is getting called. I did read in the 
NSDraggingDestination Protocol Reference that draggingUpdated  draggingExited 
will still get called even if draggingEntered returns NSDragOperationNone. 
Okay, but when I comment out draggingUpdated the image browser still accepts 
drags. Why? Shouldn't it cut off dragging altogether if draggingUpdated is 
never called to return NSDragOperationEvery?

QUESTION #2
I do not understand the difference between prepareForDragOperation: and 
performDragOperation: as they both seem to be called at the same time and have 
access to the same sender / info. As it is, I am only implementing 
performDragOperation to validate the final drop and perform the final work.


--Chris___

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


Why am I getting May Not Respond warnings for Super

2011-07-21 Thread Chris Tracewell
I have a private framework that is included in a project. Many of the project 
classes descend from a class in the framework. All of these descendent classes 
implement copyWithZone, encodeWithCoder and initWithCoder and thus respectively 
calls each on super. I get warnings stating that MySuperClass may not respond 
to -copyWithZone and so on. I do declare each of these methods in super's 
header file, so why might these errors be getting triggered?

Thanks


--Chris___

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: Why am I getting May Not Respond warnings for Super

2011-07-21 Thread Chris Tracewell
On Jul 21, 2011, at 9:33 AM, Nick Zitzmann wrote:

 
 On Jul 21, 2011, at 9:51 AM, Chris Tracewell wrote:
 
 I have a private framework that is included in a project. Many of the 
 project classes descend from a class in the framework. All of these 
 descendent classes implement copyWithZone, encodeWithCoder and initWithCoder 
 and thus respectively calls each on super. I get warnings stating that 
 MySuperClass may not respond to -copyWithZone and so on. I do declare each 
 of these methods in super's header file, so why might these errors be 
 getting triggered?
 
 
 I don't know whether it will make a difference or not, but one thing you 
 ought to try is instead of declaring the methods in the header file, you 
 should declare the class's compliance with the proper protocols (NSCopying 
 and NSCoding in this case). That's the proper way of declaring support for 
 copying and coding. It's a little different from C++, you see.
 
 Nick Zitzmann
 http://www.chronosnet.com/

Nick,

Thanks, that did it. Added the protocol declarations in the interface and it 
cleared things up. For future reference you need to add the declaration of 
protocol conformity like so...

@interface MyClass : NSObject NSCopying

You can comma separate multiple protocols.


--Chris___

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: NSTableView auto sorting does not work

2011-02-14 Thread Chris Tracewell
 On Fri, Feb 11, 2011 at 5:14 PM, Chris Tracewell ch...@thinkcl.com wrote:
 I have experienced that an NSTableview which is bound to an array controller 
 will sometimes automatically sort when their column headers are clicked and 
 sometimes not. As an example, I currently have two windows, each with a 
 tableview bound to an array controller. One tableview sorts, the other does 
 not. For both tableviews each column is bound to the arranged objects of its 
 respective array controller and has Creates Sort Descriptor selected in 
 IB.Yes, I could use delegates and implement my own sort descriptors but 
 getting free sorting is really nice and it works for some of my tableviews, 
 so I'd like to find out what breaks this functionality.
 


I got this to work. I noticed in Tableview 1 that I never bound its content or 
selectionindexes to the array controller, only the actual columns were bound 
and automatic sorting worked. In tableview 2 I had those two properties bound 
and when I unbound them automagic sorting began working. I assume that since I 
had set the selectionIndexes and content properties of the tableview the 
automagic sortDescriptor creation and binding assumed I was taking over and 
stopped doing their thing. Also worthy of noting is that binding using display 
patterns on tv columns will also break auto sorting. That was fine for me as it 
made sense to provide a property via my model anyway.

I would really appreciate anyone pointing me to docs that explain this if it 
exists so I can be confident in my assumptions.

--Chris___

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: NSTableView auto sorting does not work

2011-02-12 Thread Chris Tracewell
 Did you actually bind the table view's sortDescriptors binding to the
 array controller's sortDescriptors property?
 

No, but that's why I posted, trying to figure out when this can be avoided. 

 In the simplest case (all columns bound to different keys on the same
 NSArrayController), NSTableView will automagically bind its
 selectedIndexes and its sortDescriptors bindings to the relevant
 properties on the array controller. But if your columns aren't all
 bound to the same array controller, the table view can't logically do
 this, so you are responsible for binding these yourself.

This is helpful, thanks for explaining. I am however, using only one 
NSArrayController between all of the columns and am not using any display 
patterns (I noticed they do not offer the Creates Sort Descriptor option). At 
this point I could just move on and set my Array Controller's sortDescriptor 
property but it just really bugs me to not know what line I am crossing that 
disables the automagic functionality.


--Chris




___

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


NSTableView auto sorting does not work

2011-02-11 Thread Chris Tracewell
I have experienced that an NSTableview which is bound to an array controller 
will sometimes automatically sort when their column headers are clicked and 
sometimes not. As an example, I currently have two windows, each with a 
tableview bound to an array controller. One tableview sorts, the other does 
not. For both tableviews each column is bound to the arranged objects of its 
respective array controller and has Creates Sort Descriptor selected in 
IB.Yes, I could use delegates and implement my own sort descriptors but getting 
free sorting is really nice and it works for some of my tableviews, so I'd like 
to find out what breaks this functionality.

___

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


NSScanner Failing with EXC_BAD_ACCESS

2010-10-15 Thread Chris Tracewell
NOTE :: GC Enabled

I am using an NSScanner in an NSString category but am crashing whenever I try 
to log the string I scanned into or to return it. If I comment out the NSLog 
there are no problems.

NSString *theScannedString;
NSScanner *theScanner = [NSScanner scannerWithString:theNewHTML];
NSCharacterSet *theCharacterSet = [NSCharacterSet 
characterSetWithCharactersInString:@1234567890abcdefghijklmnopqrstuvwxyz...@#$%^*()-_=+?,./:\;'[]\{}|
 ];
[theScanner scanCharactersFromSet:theCharacterSet intoString:theScannedString];

NSLog(@%@,theScannedString);

Does anyone have a hint as to what may be the issue?

Thanks

--chris___

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: NSScanner Failing with EXC_BAD_ACCESS

2010-10-15 Thread Chris Tracewell
Thanks all. I got it working, indeed the Scanner was failing, which as Kiel 
suggested, must have led to an invalid pointer by the time I tried to 
log/return it. Once I checked the BOOL it quit crashing and then with some 
reworking of my NSScanner code it processed and returned the string I wanted.

Thanks again for the help.

--chris


On Oct 15, 2010, at 12:08 PM, Kiel Gillard wrote:

 http://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Classes/NSScanner_Class/Reference/Reference.html#//apple_ref/occ/instm/NSScanner/scanCharactersFromSet:intoString:
 
 You pass by reference to the - [NSScanner scanCharactersFromSet:intoString:] 
 method an uninitialised pointer to a NSString object.
 
 Consider the return value of the - [NSScanner 
 scanCharactersFromSet:intoString:] method. If the method fails to scan the 
 given characters and returns NO, your theScannedString pointer is probably 
 still invalid.
 
 Kiel
 
 On 16/10/2010, at 5:44 AM, Chris Tracewell wrote:
 
 NOTE :: GC Enabled
 
 I am using an NSScanner in an NSString category but am crashing whenever I 
 try to log the string I scanned into or to return it. If I comment out the 
 NSLog there are no problems.
 
 NSString *theScannedString;
 NSScanner *theScanner = [NSScanner scannerWithString:theNewHTML];
 NSCharacterSet *theCharacterSet = [NSCharacterSet 
 characterSetWithCharactersInString:@1234567890abcdefghijklmnopqrstuvwxyz...@#$%^*()-_=+?,./:\;'[]\{}|
  ];
 [theScanner scanCharactersFromSet:theCharacterSet 
 intoString:theScannedString];
  
 NSLog(@%@,theScannedString);
 
 Does anyone have a hint as to what may be the issue?
 
 Thanks
 
 --chris___
 
 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/kiel.gillard%40gmail.com
 
 This email sent to kiel.gill...@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: NSImage is Caching

2010-10-06 Thread Chris Tracewell
Thanks for the suggestions, I did try that and -recache as well but neither 
works. I really think this has to be related to the URL caching but I am not 
sure where to start. I've been diggin through NSURL, NSURLConnection and 
NSURLCache but have yet to find the solution.

-chris



On Oct 6, 2010, at 4:45 AM, slasktrattena...@gmail.com wrote:

 NSImage has a -setCachePolicy: (?) method. Not sure if it's the right
 name, but you can look it up in the docs.
 
 On Tue, Oct 5, 2010 at 11:46 PM, Chris Tracewell ch...@thinkcl.com wrote:
 I have an NSImageView that accepts an image drop then sizes the image and 
 ftp's it to a web server. The image view is bound to myObject.myImage 
 property which set by a window controller calling its loadMyImage every time 
 the window opens...
 
 
 -(void)loadMyImage
{
NSImage *theImage = [[NSImage alloc] initWithContentsOfURL: theURL];
[self setMyImage: theImage];
}
 
 The problem is that the image is being cached and I cannot figure out how. I 
 can drop images galore and it ftp's them to their final destination -- 
 which is where the image is loaded from. However, the image will stay the 
 same even when I destroy myObject, create another one and it calls 
 loadMyImage method again. Even between application restarts.
 
 This must be a setting in NSURL or NSURLConnection or NSURLCache, anyone 
 have a clue as to where to start? FWIW - my web browser always shows the 
 freshest image.
 
 Thanks in advance.
 
 -- chris
 
 ___
 
 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/slasktrattenator%40gmail.com
 
 This email sent to slasktrattena...@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


NSImage is Caching

2010-10-05 Thread Chris Tracewell
I have an NSImageView that accepts an image drop then sizes the image and ftp's 
it to a web server. The image view is bound to myObject.myImage property which 
set by a window controller calling its loadMyImage every time the window 
opens...


-(void)loadMyImage
{
NSImage *theImage = [[NSImage alloc] initWithContentsOfURL: theURL];
[self setMyImage: theImage];
}

The problem is that the image is being cached and I cannot figure out how. I 
can drop images galore and it ftp's them to their final destination -- which 
is where the image is loaded from. However, the image will stay the same even 
when I destroy myObject, create another one and it calls loadMyImage method 
again. Even between application restarts. 

This must be a setting in NSURL or NSURLConnection or NSURLCache, anyone have a 
clue as to where to start? FWIW - my web browser always shows the freshest 
image.

Thanks in advance.

-- chris

___

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: NSImage is Caching

2010-10-05 Thread Chris Tracewell
Shoulda said I'm using GC


On Oct 5, 2010, at 2:56 PM, Jonathon Kuo wrote:

 You're missing a [theImage release] at the end of your method.
 
 On Oct 5, 2010, at 2:46 PM, Chris Tracewell wrote:
 
 I have an NSImageView that accepts an image drop then sizes the image and 
 ftp's it to a web server. The image view is bound to myObject.myImage 
 property which set by a window controller calling its loadMyImage every time 
 the window opens...
 
 
 -(void)loadMyImage
  {
  NSImage *theImage = [[NSImage alloc] initWithContentsOfURL: theURL];
  [self setMyImage: theImage];
  }
 
 The problem is that the image is being cached and I cannot figure out how. I 
 can drop images galore and it ftp's them to their final destination -- 
 which is where the image is loaded from. However, the image will stay the 
 same even when I destroy myObject, create another one and it calls 
 loadMyImage method again. Even between application restarts. 
 
 This must be a setting in NSURL or NSURLConnection or NSURLCache, anyone 
 have a clue as to where to start? FWIW - my web browser always shows the 
 freshest image.
 
 Thanks in advance.
 
 -- chris
 
 ___
 
 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/newslists%40autonomy.caltech.edu
 
 This email sent to newsli...@autonomy.caltech.edu
 
 
 

___

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: Cocoa-dev Digest, Vol 7, Issue 890

2010-09-08 Thread Chris Tracewell
On Sep 8, 2010, at 10:21 AM, cocoa-dev-requ...@lists.apple.com wrote:

 The message in the 'if' ([theNumOne compare:theNumTwo]) is an invocation of 
 [NSNumber compare:], not [NSDecimalNumber compare:]. It's not absolutely 
 clear what is supposed to happen when the compare parameter is an instance of 
 NSDecimalNumber. Yes, NSDecimalNumber is a subclass of NSNumber, but these 
 are abstract classes. The actual objects are (typically) concrete subclasses 
 of the abstract classes, such as NSCFNumber. It's possible that this muddies 
 the waters enough that the mixed comparison doesn't work as you would expect.
 
 In any case, why not simply do the comparison between 'self' and 
 '[NSDecimalNumber zero]'?

Quincy thanks for the response... I moved to NSDecimalNumber but am still 
getting strange behavior. I am truly perplexed - the boolean YES is being 
returned as -256. I think my problem is with how BOOL is being passed, cast, 
interpreted... I know it is  typedef, it's as if though something is getting 
lost in translation. Take a look at the three following code fragments to see 
the strangeness. I should mention that the category this is being called from 
is in a private linked framework, if that makes any difference.

The following are called by an NSDecimalNumber with a value of 192.2

// == WORKS :: returns 0

-(BOOL)isLessThanZero
{   
if ([[NSDecimalNumber zero] compare:self] == NSOrderedDescending)
{
return [[NSDecimalNumber zero] compare:self] == 
NSOrderedDescending;
}

return NO;
}

// == DOES NOT WORK :: returns -256

-(BOOL)isLessThanZero
{   
if ([[NSDecimalNumber zero] compare:self] == NSOrderedDescending)
{
return YES;
}

return NO;
}


// == DOES NOT WORK :: returns -256

-(BOOL)isLessThanZero
{
return [[NSDecimalNumber zero] compare:self] == NSOrderedDescending;
}


Any ideas?___

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: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Chris Tracewell

On Sep 8, 2010, at 10:21 AM, cocoa-dev-requ...@lists.apple.com wrote:

 The message in the 'if' ([theNumOne compare:theNumTwo]) is an invocation of 
 [NSNumber compare:], not [NSDecimalNumber compare:]. It's not absolutely 
 clear what is supposed to happen when the compare parameter is an instance of 
 NSDecimalNumber. Yes, NSDecimalNumber is a subclass of NSNumber, but these 
 are abstract classes. The actual objects are (typically) concrete subclasses 
 of the abstract classes, such as NSCFNumber. It's possible that this muddies 
 the waters enough that the mixed comparison doesn't work as you would expect.
 
 In any case, why not simply do the comparison between 'self' and 
 '[NSDecimalNumber zero]'?

Sorry for the last reply - I had the wrong subject line. I have nailed down 
that it seems that the BOOL is being returned as something other than char 1 || 
char 0 from the private framework where the category exists. The following 
works though, I know it's bad to use NSInteger values instead of BOOL but at 
this point I am at a dead end


//=== WORKS

-(BOOL)isLessThanZero
{
NSInteger theInteger = 0;

if ([[NSDecimalNumber zero] compare:self] == NSOrderedDescending)
{
theInteger = 1;
}

return theInteger;
}

--chris___

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: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Chris Tracewell

On Sep 8, 2010, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote:

 It's not YES that's being returned as -256, but NO. (The answer is NO in 
 all 3 cases.) -256 is 0xFF00, so you can see that NO (i.e. (signed char) 
 0) is being correctly returned in the low order byte, with trash in the high 
 order bytes that's left over from earlier code.
 
 So, the problem is not your 'isLessThanZero' method, but the calling code, 
 which is treating the returned value as an int (or something). Presumably the 
 calling code was compiled with an incompatible declaration of your method, or 
 of the BOOL type.

Thanks Quincey, your suggestion got me looking at the calling model and I got 
it working by first assigning the result as a BOOL rather than just using the 
result inside of an if logic statement like so...


// == Did NOT Work =//

if ([theDecimalNumber isLessThanZero])
{
... do something
}

// == DID Work =//

BOOL theResult = [theDecimalNumber isLessThanZero];
if (theResult)
{
... do something
}

I must admit that I do not understand why this is so. I can for example use if 
([someButton isEnabled])  and it returns a BOOL and the if statement works 
fine. If you have any pointers or docs that explains this further I would 
really appreciate it as right now I feel scared about how I have been 
evaluating BOOL's returned in all of my own custom methods.

--chris___

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: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Chris Tracewell

On Sep 8, 2010, at 1:29 PM, Greg Parker wrote:

 On Sep 8, 2010, at 12:40 PM, Chris Tracewell wrote:
 On Sep 8, 2010, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote:
 It's not YES that's being returned as -256, but NO. (The answer is NO in 
 all 3 cases.) -256 is 0xFF00, so you can see that NO (i.e. (signed 
 char) 0) is being correctly returned in the low order byte, with trash in 
 the high order bytes that's left over from earlier code.
 
 So, the problem is not your 'isLessThanZero' method, but the calling code, 
 which is treating the returned value as an int (or something). Presumably 
 the calling code was compiled with an incompatible declaration of your 
 method, or of the BOOL type.
 
 Thanks Quincey, your suggestion got me looking at the calling model and I 
 got it working by first assigning the result as a BOOL rather than just 
 using the result inside of an if logic statement like so...
 
 
 // == Did NOT Work =//
 
 if ([theDecimalNumber isLessThanZero])
  {
  ... do something
  }
 
 // == DID Work =//
 
 BOOL theResult = [theDecimalNumber isLessThanZero];
 if (theResult)
  {
  ... do something
  }
 
 I must admit that I do not understand why this is so. I can for example use 
 if ([someButton isEnabled])  and it returns a BOOL and the if statement 
 works fine. If you have any pointers or docs that explains this further I 
 would really appreciate it as right now I feel scared about how I have been 
 evaluating BOOL's returned in all of my own custom methods.
 
 I bet you have a compiler warning at this call site that says warning: 
 'NSDecimalNumber' may not respond to '-isLessThanZero'. That means the 
 compiler can't see the method declaration for -isLessThanZero at the call 
 site. In that case, the compiler guesses that the method returns `int`, which 
 is wrong and will cause incorrect handling of the BOOL value on some 
 architectures.
 
 You need to (1) put your category's @interface in a header file, and (2) 
 import that header file here.
 
 
 -- 
 Greg Parker gpar...@apple.com Runtime Wrangler



Greg,

That was it :-) I had not imported ANY category headers in my framework - 
most had worked anyway in my linking project so I figured it was some 
framework magic behind the scenes recognizing them and making them work. After 
linking them my warning count went way down and I am getting syntax coloring 
now too - bonus!

I wanted to sneak in one last question - is it safe to compare an 
NSDecimalNumber to an NSNumber  and visa versa?

Thanks for taking the time to respond.

-chris___

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


NSNumber compare: Giving Unexpected Results

2010-09-07 Thread Chris Tracewell
I have a category on NSDecimalNumber that seems very straight forward - yet is 
producing odd results. The code below shows my logging and everything outputs 
as expected - but the final evaluation does not work. Am I misunderstanding 
something?

-(BOOL)isLessThanZero
{
NSNumber *theNumOne = [NSNumber numberWithInteger:0];
NSNumber *theNumTwo = self;

NSLog(@theNumOne = %@,theNumOne);
NSLog(@theNumTwo = %@,theNumTwo);
NSLog(@NSOrderedSame = %d, NSOrderedAscending = %d, 
NSOrderedDescending = %d,NSOrderedSame,NSOrderedAscending,NSOrderedDescending);
NSLog(@SHOULD SAME = %d,[theNumTwo compare:theNumTwo]);
NSLog(@SHOULD ASCD = %d,[theNumOne compare:theNumTwo]);
NSLog(@SHOULD DESD = %d,[theNumTwo compare:theNumOne]);

if ([theNumOne compare:theNumTwo] == NSOrderedDescending)
{
return YES;
}

return NO;
}


The above NSLogs produce.

2010-09-07 17:52:52.559 TheApp[80337:a0f] theNumOne = 0
2010-09-07 17:52:52.559 TheApp[80337:a0f] theNumTwo = 191.2
2010-09-07 17:52:52.560 TheApp[80337:a0f] NSOrderedSame = 0, NSOrderedAscending 
= -1, NSOrderedDescending = 1
2010-09-07 17:52:52.560 TheApp[80337:a0f] SHOULD SAME = 0
2010-09-07 17:52:52.560 TheApp[80337:a0f] SHOULD ASCD = -1
2010-09-07 17:52:52.560 TheApp[80337:a0f] SHOULD DESD = 1

When I do the comparison from the controller instead of using the above 
category it works fine. Thanks in advance for any help.


--chris___

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 to search for specific bindings in IB

2010-08-09 Thread Chris Tracewell
On occasion I refactor a controller or model by deleting a property. I do my 
best to remove associated bindings in IB, but many times I miss something - a 
textfield bound to a deleted property for example. This leads to...

this class is not key value coding-compliant for the key myProperty.

In larger NIB files this can be hard to find and remove. Is there anyway to 
search IB for bindings other than selecting individual elements and looking at 
the bindings inspector?

Thanks


-- chris___

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


Best Way To Bind Sum/Difference of Two Arrays?

2010-07-31 Thread Chris Tracewell
I have two arrays, A and B, that each contain objects that have a myTotal 
property. In IB I use an array controller for each and show their contents in 
separate NSTableview's and then display the sum for each by binding to 
respective NSTextField's using the @sum array operator on their arrangedObjects 
property.

Now I want to bind the difference between array A and array B but am having 
problems. In my model where the arrays reside, I added a readonly property for 
myDifference. I implemented the method for -(NSDecimalNumber *)myDifference 
like so...

-(NSDecimalNumber *) myDifference
{
NSDecimalNumber *theTotalArrayA = [self 
valueForKeyPath:@myarra...@sum.mytotal];
NSDecimalNumber *theTotalArrayB = [self 
valueForKeyPath:@myarra...@sum.mytotal];
return [theTotalArrayA decimalNumberBySubtracting: theTotalArrayB];
}

This works when the view is first loaded but does not change myDifference when 
the user changes A or B total in the UI. To get myDifference to adjust I 
implementing in the model...

+(NSArray*)keyPathsForValuesAffectingMyDifference
{
return [NSArray arrayWithObjects: @myArrayA,@myArrayB,nil];
} 

This works if I add or remove items to the arrays but does not change 
myDifference if myTotal is changed for any of the objects in either of the 
arrays. How do I achieve this? Should I manually observe change in the 
controller using controlTextDidEndEditing delegate for the TableView's and then 
send a setMyDifference message to the model object? Or am I missing a more 
elegant solution?

Thanks

-- Chris___

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


Cannot Validate Property - ioValue

2010-07-26 Thread Chris Tracewell
Using GC, 10.6 and XCode 3.2.2 - I just implemented a validation method for the 
myQuantity property of one of my models and cannot get it to work. The 
problem is with the ioValue, it locks up the app whenever I try to read it. 
After much frustration I simplified the validation to below an it still hangs...

-(BOOL)validateMyQuantity:(id *)ioValue error:(NSError **)outError
{
NSLog(@%@,ioValue);

return YES;
}

If I use an integer or float formatter in the NSLog it works, but it just seems 
to be reading the memory address. This makes me think that the ioValue is not 
an object. However, the property myQuantity is an NSDecimalNumber and works 
fine throughout the app. The property validation is being triggered from an 
NSTableView column bound to an array - there are no value transformers or 
number formatters on the column.

Thanks


Chris___

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: Compile Error: undeclared (first use in this function) -- While Init'ing an Object

2010-06-25 Thread Chris Tracewell

On Jun 24, 2010, at 6:59 PM, Graham Cox wrote:

 
 On 25/06/2010, at 7:52 AM, Chris Tracewell wrote:
 
 Obviously, I have a setting wrong somewhere as it is seeing an older version 
 of the framework than I am linking to. Any thoughts where I should look?
 
 
 If the problem is that it can't see a certain class in the framework, have 
 you made sure that the header for that class has its role set to 'Public'? 
 That causes it to get copied into the framework's headers directory that your 
 client code should be looking for.
 
 The other thing you should do if the framework is embedded in the app is to 
 set both the framework and app to build to the same directory. The 
 documentation on embedding frameworks explains how.
 
 What you want to avoid is your framework ending up in ~/Library/Frameworks or 
 /Library/Frameworks so check those places for old versions.
 
 --Graham
 
 
 

Thanks Graham - I had made the headers all public. Also, I had the frameworks 
build directory set to @executable_path/../Frameworks. I did take your advice 
and checked /Library/Frameworks and ~/Library/Frameworks but neither had them 
there. 

I did get it working however, kind of by accident - I renamed the enclosing 
directory that houses all of the different versions of the framework which 
caused me to have to re-embed the framework into the linking app, like I had 
done a million times before trying to get this to work, an wallah, everything 
works. It sounds crazy, but somewhere there had to be a cached reference or 
setting that was causing it to stick with the previous fw version - even after 
cleaning and building and re-linking to the correct fw version over and over.

Maybe I'm crazy. (likely)


--Chris___

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: Compile Error: undeclared (first use in this function) -- While Init'ing an Object

2010-06-24 Thread Chris Tracewell
On Jun 22, 2010, at 2:11 PM, Kyle Sluder wrote:

 On Tue, Jun 22, 2010 at 2:03 PM, Chris Tracewell ch...@thinkcl.com wrote:
 I have my own custom framework. The framework builds fine but when I link to 
 it in one of my projects one class is causing a compile error of...
 
 'MyClass' undeclared (first use in this function)
 
 This occurs when I am trying to init MyClass inside a view controller's .m 
 file in one of it's methods like so...
 
 MyClass *theClass = [MyClass new];
 
 Did you remember to #import the header file that declares MyClass's interface?
 
 --Kyle Sluder
 

Okay - almost have this solved. I found that the linking project is still 
including an older version of the framework even though I have thrown out the 
build directories, cleaned and rebuilt for both it and the framework several 
times and have re-linked the new framework so many times it is silly.

Obviously, I have a setting wrong somewhere as it is seeing an older version of 
the framework than I am linking to. Any thoughts where I should look?

Thanks


--Chris


___

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


Compile Error: undeclared (first use in this function) -- While Init'ing an Object

2010-06-22 Thread Chris Tracewell
I have my own custom framework. The framework builds fine but when I link to it 
in one of my projects one class is causing a compile error of...

'MyClass' undeclared (first use in this function)

This occurs when I am trying to init MyClass inside a view controller's .m file 
in one of it's methods like so...

MyClass *theClass = [MyClass new];

In the framework the header file is set to public and I can see it in the build 
and the linking project colors the code to show it recognizes the class. The 
framework itself uses this class in several places and it does not throw any 
compile errors. I have cleaned and built both the framework and linking project 
a gizillion times hoping to jiggle something - but no luck. 

Any suggestions?

- Chris
XCode 3.2.2 :: GC :: OS X 10.6___

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: Compile Error: undeclared (first use in this function) -- While Init'ing an Object

2010-06-22 Thread Chris Tracewell
On Jun 22, 2010, at 2:11 PM, Kyle Sluder wrote:
 On Tue, Jun 22, 2010 at 2:03 PM, Chris Tracewell ch...@thinkcl.com wrote:
 I have my own custom framework. The framework builds fine but when I link to 
 it in one of my projects one class is causing a compile error of...
 
 'MyClass' undeclared (first use in this function)
 
 This occurs when I am trying to init MyClass inside a view controller's .m 
 file in one of it's methods like so...
 
 MyClass *theClass = [MyClass new];
 
 Did you remember to #import the header file that declares MyClass's interface?
 
 --Kyle Sluder
 

I did - I import one main header for the framework the imports all of the 
framework header files. I checked it in the linking project, it is there in the 
Copy phase of my target and it does import have the #import MyClass.h line 
plus I can see MyClass.h is in the Copy phase of the linking projects target as 
well. 

However, your suggestion prompted me to try importing just 
MyFramework/MyClass.h in the view controller class that is getting the error 
and it couldn't find it. Then I tried the same with other classes in the 
framework and it was fine. It's like it's there, I can see it, but it is not 
finding it. As I stated in the first post I have checked several times to make 
sure MyClass is set to public in the framework.

Thanks

--Chris___

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: My Custom Framework Is Not Exporting One of My Header Files

2010-06-09 Thread Chris Tracewell

On Jun 8, 2010, at 6:26 PM, Graham Cox wrote:

 
 On 09/06/2010, at 11:20 AM, Chris Tracewell wrote:
 
 Why would it not be exporting the file? Yes, I added it to the target when I 
 created the file.
 
 
 Right-click the file in Xcode and set its role to Public.
 
 This necessary step is very obscure and the menu doesn't reflect the 
 currently set role. File bugs.
 
 --Graham


Thanks to both Graham and Kiel - setting the Role to Public did the trick.

- Chris___

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


My Custom Framework Is Not Exporting One of My Header Files

2010-06-08 Thread Chris Tracewell
I just made my first private framework a few weeks ago. I took some common 
categories and custom classes I use across projects and put them in my new FW. 
All has been fine until today when I added a new class file to it. I clean and 
build the FW and then build my project that is utilizing the FW and I get an 
error saying there is No such file or directory - referring to my new class 
file in the FW. FWIW, I use #import MyFramework/MyFramework.h in my project 
as it imports all the FW headers - standard protocol.

After I build the FW I look in MyFramework - build - Release - 
MyFramework.framework - Headers and can see the header is indeed missing. I 
know this is the correct directory because I can see MyFramework.framework 
being deleted when I clean the FW target.

 Why would it not be exporting the file? Yes, I added it to the target when I 
created the file.

Thanks for the help


-Chris


___

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: Does XCode 3.2 Documentation Browser Stink?

2010-04-16 Thread Chris Tracewell
Noted... I'll file the bug report but will spare the xcode-users subscribers 
the post as you answered my question.

Thank you.

--Chris


On Apr 15, 2010, at 5:28 PM, Kyle Sluder wrote:

 On Thu, Apr 15, 2010 at 4:48 PM, Chris Tracewell ch...@thinkcl.com wrote:
 Okay, so now that I flew off the handle in this rant, will someone please 
 tell me I am wrong and there is a classic doc browser option or third 
 party browser?
 
 There is not.
 
 Regardless of its validity, this rant really belongs on xcode-users
 and in a bug report.
 
 --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


Does XCode 3.2 Documentation Browser Stink?

2010-04-15 Thread Chris Tracewell
Am I missing something or does the new Documentation viewer for XCode 3.2 suck? 
I just upgraded my dev machine to Snow Leopard and installed XCode 3.2 and went 
to look up some Obj-C classes and everything is wacked. Gone is the filtered 
search results TableView above my the documentation pages - and its nice 
sortable columns where I can quickly adjust results. In its place seems to be a 
crappy HTML/Javascript list view with no sort capabilities at all. 

In addition is there a way to turn off all of the stupid Full Text and 
Title results... I don't want those - they just slow things down and add 
visual clutter when trying to find API info - which is what I am after most of 
the time. Why has the Doc Browser regressed here where before I could make 
those choices?

Another gripe - I have to now click a pull down to see what Doc Sets I am 
searching in whereas before I could just look at the selected buttons.

Okay, so now that I flew off the handle in this rant, will someone please tell 
me I am wrong and there is a classic doc browser option or third party 
browser? ___

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: NSImageView Will Not Alias Images

2010-04-12 Thread Chris Tracewell


On Apr 6, 2010, at 8:16 PM, Ken Ferry wrote:

This was once true, but is out of date.  I'd like to see a test  
app.  For example, how do you know you aren't getting  
antialiasing?  It may be that you just don't like the output. :-)


Well - NSImageInterpolationHigh and NSImageInterpolationNone produce  
the same exact result - screen shot copy (control-command-shift-4)  
the imageView built once using NSImageInterpolationHigh  and once  
using NSImageInterpolationNone then paste each into a Photoshop  
layer, align them perfectly and then turn the top layer off and on  
at 800% and there is not a single pixel that moves or changes color.


The dropped image is roughly 1000 x 1000 (a screen shot PNG) and the  
imageView size is 200x200


To make sure the currentContext was correct - I log  
[[NSGraphicsContext currentContext] imageInterpolation] for each  
build and it shows the correct values 3 and 1 respectively. And then  
just to be super sure I I log [[NSGraphicsContext currentContext]  
isDrawingToScreen] inside drawRect of my NSImageView subclass and  
get YES.


I did implement my own image sizing in drawRect and then used [self  
setImage] and it works great. Not sure what could be the issue.




It would also be good to know what OS you are working on.

-Ken



I'm using 10.5.8. - XCode   3.1.2 - iMac Core 2 Duo and the app is GC.

What Jens is saying is probably true in 10.5, not in 10.6.   
Nevertheless, I would be interested to see a test app.


-Ken
Cocoa Frameworks



Thought I'd add some closure to this, even though it's a week later. I  
believe Ken's original assessment to be accurate - that I am just not  
happy with the resampling that NSImageView is doing. Using larger  
images with lots of detail, like a screenshot, the problem is more  
pronounced, the same is true for images with thin diagonal lines. More  
organic images that aren't too big produce acceptable results.


Of note, I tested an image in Photoshop that was struggling in the  
ImageView and found that by sizing to the same size as the ImageView  
using, Nearest Neighbor as the sampling method, resulted in  
identical distortion or lack of smoothness per se. Nearest Neighbor  
has been a resampling method in PS for as long as I can remember, but  
I isn't really an anti-alias resampling method - it chooses the pixel  
values by proximity and duplicates it - thus no new color values get  
produced. I have used it in the past when needing to take, for  
example, a small bit icon or type element that I want to enlarge  
without aliasing, to keep a pixel accurate representation at a larger  
scale. Using this method to downsize will give mediocre results at best.


All of that to say, it seems that an NSImageView in = 10.5 you'll be  
getting that method for resampling - so yes it resamples, but the  
method is not optimal.

___

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


NSImageView Will Not Alias Images

2010-04-06 Thread Chris Tracewell
I am trying to get NSImageView to alias dropped images, but it  
refuses. Just spent an hour looking and trying several variations to  
no avail. Here's what I have done in a subclass of NSImageView.


-(void)drawRect:(NSRect)rect
{   
	[[NSGraphicsContext currentContext]  
setImageInterpolation:NSImageInterpolationHigh];

[[NSGraphicsContext currentContext] setShouldAntialias:YES];

[super drawRect:rect];
}

I have assigned the ImageView in IB my subclass and used NSLog to  
verify that it is drawing through the above drawRect method of my  
subclass - but the images (PNG screen captures) will not alias.


Any suggestions?
___

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: NSImageView Will Not Alias Images

2010-04-06 Thread Chris Tracewell


On Apr 6, 2010, at 4:50 PM, Ken Ferry wrote:



On Tue, Apr 6, 2010 at 2:58 PM, Jens Alfke j...@mooseyard.com wrote:

On Apr 6, 2010, at 1:17 PM, Chris Tracewell wrote:

I am trying to get NSImageView to alias dropped images, but it  
refuses.


Nitpick: you mean antialias. Aliasing is what creates the jaggies,  
antialiasing smooths them away.



Just spent an hour looking and trying several variations to no  
avail. Here's what I have done in a subclass of NSImageView.


I remember having to deal with this too, years ago. It's too bad  
AppKit hasn't added support for this yet :(


The problem is that NSImageView internally keeps a scaled copy of  
the image. So the actual scaling that creates the aliasing isn't  
done in the drawRect: method at all.


This was once true, but is out of date.  I'd like to see a test  
app.  For example, how do you know you aren't getting antialiasing?   
It may be that you just don't like the output. :-)


Well - NSImageInterpolationHigh and NSImageInterpolationNone produce  
the same exact result - screen shot copy (control-command-shift-4) the  
imageView built once using NSImageInterpolationHigh  and once using  
NSImageInterpolationNone then paste each into a Photoshop layer, align  
them perfectly and then turn the top layer off and on at 800% and  
there is not a single pixel that moves or changes color.


The dropped image is roughly 1000 x 1000 (a screen shot PNG) and the  
imageView size is 200x200


To make sure the currentContext was correct - I log  
[[NSGraphicsContext currentContext] imageInterpolation] for each build  
and it shows the correct values 3 and 1 respectively. And then just to  
be super sure I I log [[NSGraphicsContext currentContext]  
isDrawingToScreen] inside drawRect of my NSImageView subclass and get  
YES.


I did implement my own image sizing in drawRect and then used [self  
setImage] and it works great. Not sure what could be the issue.




It would also be good to know what OS you are working on.

-Ken



I'm using 10.5.8. - XCode   3.1.2 - iMac Core 2 Duo and the app is GC.
___

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


Correct way to overide synthesized setter?

2010-02-28 Thread Chris Tracewell
I have two synthesized properties - A and B. Whenever A changes I need  
B to be updated to A.keypath. Is the correct way to do this to  
override the synthesized setter of A like so?


-(void)setA:(id)value
{
A = value
[self setB:A.keypath];
}

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: Correct way to overide synthesized setter?

2010-02-28 Thread Chris Tracewell

On Feb 28, 2010, at 9:28 AM, Jean-Daniel Dupas wrote:



Le 28 févr. 2010 à 17:23, Chris Tracewell a écrit :

I have two synthesized properties - A and B. Whenever A changes I  
need B to be updated to A.keypath. Is the correct way to do this to  
override the synthesized setter of A like so?


-(void)setA:(id)value
{
A = value
[self setB:A.keypath];
}

Thanks.


Overriding the setter is fine, but you should read how to do it  
properly first:


http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/Articles/mmAccessorMethods.html



-- Jean-Daniel







Thanks Jean - should mentioned I am using 
GC.___

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: Correct way to overide synthesized setter?

2010-02-28 Thread Chris Tracewell


On Feb 28, 2010, at 9:26 AM, Jens Alfke wrote:



On Feb 28, 2010, at 8:23 AM, Chris Tracewell wrote:

I have two synthesized properties - A and B. Whenever A changes I  
need B to be updated to A.keypath.


If B's value is entirely dependent upon A, you don't even need to  
synthesize it — you can just implement B's getter to return  
A.keypath, and declare B as dependent on A:


- (NSString*) b {return A.keypath; }
+ (NSArray*) keyPathsForValuesAffectingB { return [NSArray  
arrayWithObject: @a]; }


—Jens



Jens -

keyPathsForValuesAffecting looks like what I am looking for.

Thank you


___

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


NSPredicate Binding Problem

2010-02-16 Thread Chris Tracewell
In a window displaying a widget object I am using an outlineview  
bound to an NSTreeController as master view. When I notice the OV  
selection change via outlineViewSelectionDidChange I filter a  
tableview bound to an NSArrayController in one of two ways like so...


Method 1 :: use setFilterPredicate on the NSArrayController and set to  
a new NSPredicate
Method 2 :: In IB bind the NSArrayController's Filter Predicate to a  
property called myPredicate and use KVC to set a new NSPredicate


Either of these methods work fine - the tableview's content filters  
fine. The problem I am having is that when I load a new widget, thus  
releasing the current widget view from the window, along with it's  
NSViewController, I get the error...


Cannot remove an observer _NSArrayControllerExtensions 0x12c8b30 for  
the key path...


I have googled and found this is typically to do with non KVO  
compliant models. I have checked and rechecked my models and made sure  
that all properties are compliant with KVO. While debugging I removed  
resetting the NSPredicate in outlineViewSelectionDidChange and instead  
just set it once in awakFromNib and the issue goes away. This brings  
me to the conclusion that somehow resetting the NSPredicate for the  
NSArrayController is not allowed.


How should I go about filtering my tableview? Should it be okay to  
reset the NSArrayController's filterPredicate... ie is there something  
else going on?


Thanks in advance for any suggestions.
___

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: How Do I Statically Link to libcurl?

2009-07-01 Thread Chris Tracewell

On Jun 30, 2009, at 8:55 PM, Nick Zitzmann wrote:



On Jun 30, 2009, at 9:49 PM, Chris Tracewell wrote:

Finally, just to be sure to be sure to steer things back to my  
original question... whether I dynamically link or statically link,  
is there a manual anywhere that describes how to do this in XCode?



I'm not sure, but did you try the add - existing frameworks CM  
item and then navigating to /usr/lib in the resulting open panel  
(which you can do by pressing Shift-Cmd-G when it's open)?


Nick Zitzmann
http://www.chronosnet.com/


Okay thanks, that at least helped me find the library - which was step  
one. There were several version, I choose libcurl.4.dylib. I am not  
sure where to go now though. I added -libcurl in Other Linker Flags  
in my build settings and put #import curl.h  (a wild stab) in my  
header file but I still get errors when compiling stating that all of  
my CURL functions are undeclared.


Thank you
___

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: How Do I Statically Link to libcurl?

2009-07-01 Thread Chris Tracewell

On Jul 1, 2009, at 2:18 PM, Shawn Erickson wrote:


Apple's API contract with application developers is at the library
level and not below that. If the SDK you compile against has the
libraries you need you should not attempt to statically link them into
your application. Additionally any libraries that you do statically
link should utilize system provided libraries themselves and not
attempt to dive down lower (aka kernel interface, etc.). A statically
linked version is not guaranteed to work on a future (or earlier)
version of the operating system. Apple takes strong measures to ensure
the dynamic libraries they provide will work on each of the operating
system they ship on while not breaking compatibility with existing
applications.

Review the documentation on cross-development on Apple's developer  
site.


http://developer.apple.com/documentation/developertools/Conceptual/cross_development/Introduction/CrossDevelopment.html

-Shawn



Shawn,

Awesome. Thanks a ton for explaining, your post reversed my  
perspective and rested my fears about taking what really is the easier  
route.


Thanks to all contributers thus far, I have gotten the project to  
compile without errors. However I am stck with implementation  
details... I'll start a new thread for that.



Thanks

Chris
___

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


libcurl -- how to write a callback?

2009-07-01 Thread Chris Tracewell
I've gotten libcurl linked and ready to use thanks to many  
contributors from a previous post here. Does anyone have a snippet  
code or link of an example of writing a callback function for say  
CURLOPT_READFUNCTION?



Thank you


Chris
___

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: libcurl -- how to write a callback?

2009-07-01 Thread Chris Tracewell

Chris Tracewell wrote:


I've gotten libcurl linked and ready to use thanks to many
contributors from a previous post here. Does anyone have a snippet
code or link of an example of writing a callback function for say
CURLOPT_READFUNCTION?


What have you tried?

For example, I found a number of likely prospects simply by entering
CURLOPT_READFUNCTION as a google search term.

I narrowed it down by adding the keyword sample or example.

libcurl is not unique to Mac OS X, so a reasonable first step should
always be to google (or bing, yahoo, whatever) for examples.  A
reasonable second step would be to add the search term mac os x.

  -- GG



Uhmmm well sometimes the obvious comes to you after someone else  
makes you feel like an idiot. I googled the *$% out of


libcurl,
libcurl OS X,
libcurl Cocoa example,
libcurl Obj-C example

So, my apologies for not thinking of using the actual function name,  
which is where I typically start with NSXyz methods I need help with.



Thank you - it all seems so clear now.


Chris
___

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: libcurl -- how to write a callback?

2009-07-01 Thread Chris Tracewell


On Jul 1, 2009, at 3:21 PM, Geoff Beier wrote:

On Wed, Jul 1, 2009 at 5:42 PM, Chris Tracewellch...@thinkcl.com  
wrote:
I've gotten libcurl linked and ready to use thanks to many  
contributors from
a previous post here. Does anyone have a snippet code or link of an  
example

of writing a callback function for say CURLOPT_READFUNCTION?



That question is indubitably more appropriate for the libcurl  
mailing list:

http://curl.haxx.se/mail/list.cgi?list=curl-library

Look at the various examples that ship with the libcurl source
distribution (I know httpput.c has a simple sample) and if you have
any specific question after reading those, it's probably best to ask
there.

Also, read libcurl-tutorial(3) installed locally on your system.

HTH,

Geoff




Indeed, thanks I'll head over there and thank you for the httpput.c  
mention.


Chris
___

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: NSBitMapRepresentation -- JPEG compression?

2009-06-30 Thread Chris Tracewell

Marco,

Thanks for the exiftool pointer - very nice utility. There is indeed  
about 2KB of extra Header info in the Apple JPEG - mostly ICC profile  
info. There is also some subsampling differences as the Apple default  
is using 4:2:0 and Adobe is using 4:4:4 which may play a factor in  
quality.


I'll need to play with these a bit and see if I can find a common  
sense method of extracting the unneeded info. It's not a killer but  
with thousands of page views per day and web users expecting snappy  
page loads I'll throw a little effort into it. For those interested I  
here is the header info for the two files as regurgitated from  
exiftool - please comment if you see anything glaringly obvious that  
should be considered...



//== ADOBE JPEG ==//
 ExifTool 
ExifTool Version Number : 7.81
 File 
File Name   : 696-0.8-PS.jpg
Directory   : .
File Size   : 22 kB
File Modification Date/Time : 2009:06:29 15:36:26-07:00
File Type   : JPEG
MIME Type   : image/jpeg
Image Width : 305
Image Height: 259
Encoding Process: Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components: 3
Y Cb Cr Sub Sampling: YCbCr4:4:4 (1 1)
 JFIF 
JFIF Version: 1.02
Resolution Unit : None
X Resolution: 100
Y Resolution: 100
 Ducky 
Quality : 80%
 Adobe 
DCT Encode Version  : 100
APP14 Flags 0   : [14], Encoded with Blend=1  
downsampling

APP14 Flags 1   : (none)
Color Transform : YCbCr
 Composite 
Image Size  : 305x259


//== APPLE JPEG ==//
 ExifTool 
ExifTool Version Number : 7.81
 File 
File Name   : 696-0.8.jpg
Directory   : .
File Size   : 28 kB
File Modification Date/Time : 2009:06:30 09:23:05-07:00
File Type   : JPEG
MIME Type   : image/jpeg
Exif Byte Order : Big-endian (Motorola, MM)
Image Width : 305
Image Height: 259
Encoding Process: Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components: 3
Y Cb Cr Sub Sampling: YCbCr4:2:0 (2 2)
 JFIF 
JFIF Version: 1.01
Resolution Unit : None
X Resolution: 1
Y Resolution: 1
 ICC-header 
Profile CMM Type: appl
Profile Version : 2.0.0
Profile Class   : Display Device Profile
Color Space Data: RGB
Profile Connection Space: XYZ
Profile Date Time   : 2009:05:15 09:32:58
Profile File Signature  : acsp
Primary Platform: Apple Computer Inc.
CMM Flags   : Not Embedded, Independent
Device Manufacturer :
Device Model:
Device Attributes   : Reflective, Glossy, Positive, Color
Rendering Intent: Perceptual
Connection Space Illuminant : 0.9642 1 0.82491
Profile Creator : appl
Profile ID  : d3aacba427aa3e36c6c6c0beb9e6dff7
 ICC_Profile 
Red Matrix Column   : 0.35953 0.21156 0.02415
Green Matrix Column : 0.4537 0.70166 0.12245
Blue Matrix Column  : 0.15099 0.08719 0.67818
Media White Point   : 0.95047 1 1.0891
Chromatic Adaptation: 1.04788 0.02292 -0.0502 0.02957  
0.99049 -0.01706 -0.00923 0.01508 0.75165
Red Tone Reproduction Curve : (Binary data 14 bytes, use -b option  
to extract)
Green Tone Reproduction Curve   : (Binary data 14 bytes, use -b option  
to extract)
Blue Tone Reproduction Curve: (Binary data 14 bytes, use -b option  
to extract)
Video Card Gamma: (Binary data 1554 bytes, use -b  
option to extract)
Native Display Info : (Binary data 1598 bytes, use -b  
option to extract)

Profile Description : Color LCD
Profile Description ML  : Color LCD
Make And Model  : (Binary data 40 bytes, use -b option  
to extract)

Profile Copyright   : Copyright Apple, Inc., 2009
 ExifIFD 
Exif Image Width: 305
Exif Image Height   : 259
 Composite 
Image Size  : 305x259





On Jun 29, 2009, at 11:24 PM, Marco S Hyman wrote:


On Jun 29, 2009, at 4:12 PM, Chris Tracewell wrote:

The issue is that when using writeToFile my images have an extra 3  
to 10 KB of size whether the image is really small or really big -  
ie 5KB or 300KB

Re: NSBitMapRepresentation -- JPEG compression?

2009-06-30 Thread Chris Tracewell

Steven,

Thanks for the link very nice info.


Rob,

Thanks - that is a huge help to get going with file meta data  
manipulation!


___

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 Statically Link to libcurl?

2009-06-30 Thread Chris Tracewell
So... call me an idiot, but I am lost as how to get libcurl into my  
project. I can see libcurl.4.dylib  libcurl.3.dylib on my hard drive  
using spotlight. I have googled and googled and only found bits and  
pieces here and there but nothing concrete, that is a 1,2,3  
instruction on how to link against libcurl. Here is what I think I  
need to do but am not sure on specifics


1) Statically link against libcurl (3 or 4?) - (in forums everybody  
says just link against it ... how is this done?)
2) Edit Project Settings -- Build -- Other Linker Flags to some path  
where libcurl can be found ... which is???
3) import the curl.h or curl/ease.h into my controller class -  
(seems straight forward)


I have tried a bizillion combos of the above with enough revisions to  
make me sick. Any help is much appreciated.


Thanks

Chris
___

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: How Do I Statically Link to libcurl?

2009-06-30 Thread Chris Tracewell


On Jun 30, 2009, at 6:43 PM, Kyle Sluder wrote:


dylib means dynamic library...

Why do you need to link against libcurl statically?  Not saying there
aren't valid use cases, but please present yours.


I guess I assumed that static linking is prefered as it would include  
libcurl with the executable and thus ensure that the app would work  
consistently, even if someone had a different version or had deleted  
this library from their machine. In short it just seemed like a safe  
option, but I am un-educated in this regard, so it was my best guess.  
The deployment environment is fairly easy right now, about 10  
machines, mostly 10.5 with Intel iMac and Powerbooks which I can tweak  
if needed, but in the future this may grow and so you get the picture.




If you really need to, you can download the source and compile it into
a library yourself.

--Kyle Sluder


Well, honestly don't know a lot about libcurl and was not aware that I  
would need to download and compile to be able to statically link, I  
thought it was like curl and just already on the machine. I have  
already way over shot my time on this so dynamically linking is fine  
for now. I was going to use NSTask and curl but saw libcurl and  
thought it would be more efficient, but I am about to give up on it  
and go back to curl as I have wasted a half a day trying to link to  
it.


Finally, just to be sure to be sure to steer things back to my  
original question... whether I dynamically link or statically link, is  
there a manual anywhere that describes how to do this in XCode?


Thanks

Chris
___

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


NSBitMapRepresentation -- JPEG compression?

2009-06-29 Thread Chris Tracewell

--- Using GC ---

I am saving images to file from an NSImage dropped into an NSImageView  
using JPEG as the file format via the code below.


-(IBAction)saveImages:(id)sender
{
	TKProduct *theProduct = [[myProductArrayController selectedObjects]  
objectAtIndex:0];


	NSBitmapImageRep *theBitMapImageRep = [NSBitmapImageRep  
imageRepWithData:[[theProduct myImage] TIFFRepresentation]];
	NSDictionary *thePropertyDictionary = [NSDictionary  
dictionaryWithObjectsAndKeys:[theProduct  
myImageCompression],NSImageCompressionFactor,[NSNumber  
numberWithInteger:0],NSImageProgressive,nil];
	NSString *theFileName = [NSString stringWithFormat:@%...@-%@.jpg, 
[theProduct myID],[theProduct myImageCompression]];


	NSData *theData = [theBitMapImageRep representationUsingType:  
NSJPEGFileType properties: thePropertyDictionary];
	[theData writeToFile:[@/volumes/MyHardDrive/Users/myname/Desktop/ 
XCode-Image-Tests/ stringByAppendingString:theFileName]  
atomically:YES];

}

Ideally I am wanting to achieve quality and file size comparable with  
what I get out of Photoshop's File-Save For Web command. I am  
satisfied with the comparative quality of matching settings I get -  
that is an image saved from PS at JPEG quality 50 and non progressive  
is close enough (although not quite as good) as what I get from the  
same image run through the method above using NSImageCompressionFactor  
of 0.5. The issue is that when using writeToFile my images have an  
extra 3 to 10 KB of size whether the image is really small or really  
big - ie 5KB or 300KB. I am suspecting that my XCode generated images  
are bigger for one of two reasons...


1) Adobe's JPEG compression is just plain better and unless I develop  
my own JPEG compression algorithm I am hosed.
2) My Objective-C created images contain extra file meta data /  
headers that are inflating the size a bit


I mention scenario 2 because a few versions back, before Save For  
Web was in PS, you could uncheck an option for Include Extra File  
Headers (or something like that) when saving to JPEG and your files  
would always shrink by a few KB. The file size is important because  
the images will load on a a busy web site up to a hundred per page  
load and so 100 4KB image thumbnails loads a lot quicker than 100 8KB  
thumbnails. I have always used ImageReady and AppleScript to process  
these files in the past but want to skip that and do it solely in my  
App.


Does anyone have any suggestions as to how to squeeze a little more  
file size reduction out of these JPEG's without having to dive into  
JPEG compression algorithms (probably over my head, but willing to  
look if you want to point in a direction :-) ? I guess I am hoping  
there is something I have missed in NSData and writeToFile that allows  
me to not include custom OS X meta data / headers / Icons.


 I should also mention that if you have any pointers for PNG  
optimization, tutorials, tech docs, I would love the links as PNG is a  
format I would like to use down the road as well and the docs and  
Google didn't provide anything about how to actually produce a reduced  
color pallete (I know its probably right in front of me, please feel  
free to point out the obvious :-)


Thank you.
___

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: Enter Key Behavior in NSTableView

2009-06-18 Thread Chris Tracewell

raleigh,

I am not overriding textShouldEndEditing, but your suggestion did lead  
me to find that my File's Owner's superclass is implementing:


-(BOOL)control:(NSControl*)control textView:(NSTextView*)textView  
doCommandBySelector:(SEL)commandSelector


In there I had an if statement that was catching the insertNewLine:  
selector for every control in the view when I only intended it for  
some textFields.


Thanks for the help - it is working now.


Chris

On Jun 18, 2009, at 5:22 PM, Raleigh Ledet wrote:

I don't think this is normal. When a field editor is up, the Return  
should go to the Field Editor's keyDown: method, not TV. (for both  
cases)


Is your File's Owner overriding textShouldEndEditing:? and  
preventing the Field Editor from ending?


-raleigh

On Jun 17, 2009, at 4:03 PM, Chris Tracewell wrote:

I have a subclass of NSTableView which I have implemented keyDown  
to pick up delete and enter key presses. When the TV is bound to an  
array controller it works perfectly, I can detect keyDowns for the  
above mentioned and as a bonus when the user presses Enter or  
Return the field editor ends editing. Thats what I want.


The problem is that as soon as I hook up my File's Owner as the  
delegate for the TV the Field Editor no longer detects the Return  
and Enter key strokes. Is this normal? If so where do I look in  
docs to re-establish this behavior?

___

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/ledet%40apple.com

This email sent to le...@apple.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


Enter Key Behavior in NSTableView

2009-06-17 Thread Chris Tracewell
I have a subclass of NSTableView which I have implemented keyDown to  
pick up delete and enter key presses. When the TV is bound to an array  
controller it works perfectly, I can detect keyDowns for the above  
mentioned and as a bonus when the user presses Enter or Return the  
field editor ends editing. Thats what I want.


The problem is that as soon as I hook up my File's Owner as the  
delegate for the TV the Field Editor no longer detects the Return and  
Enter key strokes. Is this normal? If so where do I look in docs to re- 
establish this behavior?

___

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: Correct MVC code placement

2009-06-14 Thread Chris Tracewell
Thanks Kyle, I should've noted this is a non-document based app. That  
said, I think your suggestion would imply to let the controller to  
expose its own array property of the model's pipe-separated property?


Chris


On Jun 14, 2009, at 11:27 AM, Kyle Sluder wrote:


NSDocument is what's known as a model-controller object.  Your
actual model is the pipe-separated values; NSDocument allows you to
perform operations on that model.  As such, I'd probably expose an
NSArray property for my list of things, and only do the
pipe-separation when reading from or writing to disk.

--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


Re: Correct MVC code placement

2009-06-14 Thread Chris Tracewell

Ken,

Okay, that makes perfect sense. You are right, I was storing the pipe- 
separated string of values to avoid needing another DB table for  
single values that would not surpass more than 2 or 3 per record.  
However, your and Kyle's response now make it obvious that the pipe- 
string is not the natural/logical format for cocoa use, and should be  
a part of the model.


Chris



On Jun 14, 2009, at 3:08 PM, Ken Thomases wrote:

I think what Kyle meant is that your model is the values between the  
pipe separators.  The pipe-separated string format is part of your  
file format.  I don't know what your model represents, but I doubt  
that the pipe-separated string format is inherent to the thing which  
it represents.  Rather, it seems like the sort of thing which is  
only part of the storage format.


So, I think the model itself should parse the storage format and  
expose its state in the more natural format for Cocoa -- an array  
property.


Cheers,
Ken


___

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


Why is my object getting set two times?

2009-05-12 Thread Chris Tracewell
While debugging I noticed that a custom object's set method is being  
invoked twice. I have theViewController that is the files owner of my  
Nib. theViewController has a myObject property. myObject is bound in  
the Nib using an NSObjectController to the file's owner's myObject  
property. Automatically prepares content is unchecked in IB. In  
theViewController I override setMyObject to do some prep work, I also  
call [super setMyObject:sender] first as that is where the myObject  
property is defined.


When I load the window and thus the view everything works fine but all  
of the methods I perform in setMyObject show up twice when I log them.  
I have been trying to track down where I might be sending setMyObject  
twice, but am baffled. Here is the log output


2009-05-12 08:50:23.229 myApp[21135:10b] SVController BEFORE adding  
DetailController view to SV
2009-05-12 08:50:23.281 myApp[21135:10b] SENDER = TKProductGroup:  
0x12d7a50
2009-05-12 08:50:23.283 myApp[21135:10b] myIDAttributeSet = (null) ::  
(null)
2009-05-12 08:50:23.322 myApp[21135:10b] SVController AFTER adding  
DetailController view to SV
2009-05-12 08:50:23.324 myApp[21135:10b] SENDER = TKProductGroup:  
0x10afed0
2009-05-12 08:50:23.324 myApp[21135:10b] myIDAttributeSet = (null) ::  
(null)


I know this question is pretty difficult to answer without seeing all  
of the code, but wanted to ask in case this is a normal bindings issue  
and nothing to worry about OR if it is a sign of something serious  
screwed up in my code and thus needing further attention.




Thanks


Chris
___

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


NSButtonCell visibility binding in NSOutlineView

2009-04-29 Thread Chris Tracewell
I am looking for the best method of turning off the visibility of an  
NSButtonCell object for individual rows in an OutlineView/TableView. I  
have an OutlineView that is bound to a TreeController. There are two  
columns. In the last column I am using a checkbox cell that should  
only be visible to the user when a representedObject in the  
TreeController has a certain property value. There is no Visibility  
binding only Enabled which does not hide the control but just dims it.


I am using bindings to return a custom image for setImage and  
setAlternateImage to display a custom NSImage instead of the regular  
checkbox. It works nicely. I tried using conditional logic to return a  
transparent image when I want to hide the control but that affects the  
entire column. If I need to subclass I am suspecting I need to  
override NSTableColumn's dataCellForRow, but then how do I obtain the  
representedObject for that row?


Thanks for any help
___

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: NSButtonCell visibility binding in NSOutlineView [SOLVED]

2009-04-29 Thread Chris Tracewell

Kyle,

Thanks for the reply. Yes I know and agree on the issue of the  
usability. I struggled with this but ultimately felt it was essential  
as other options disassociated the property from the object too much  
or made it appear that a given object could indeed have the property  
enabled.


What I made work, and feels like the best solution is to use was a OV  
delegate I had missed. It's nice as it requires no custom drawing and  
allows me to inspect the object. It took one IBOutlet to bind to the  
column I wanted to modify.


-(NSCell *)outlineView:(NSOutlineView *)outlineView  
dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item

{
	if (tableColumn == myAttributeColumn  !item representedObject]  
representedObject] myType] isEqualToString:@style])

{
return [NSTextFieldCell new];
}

return [tableColumn dataCellForRow:item];
}


 Chris

On Apr 29, 2009, at 12:04 AM, Kyle Sluder wrote:

On Tue, Apr 28, 2009 at 1:12 PM, Chris Tracewell ch...@thinkcl.com  
wrote:

I am looking for the best method of turning off the visibility of an
NSButtonCell object for individual rows in an OutlineView/ 
TableView. I have
an OutlineView that is bound to a TreeController. There are two  
columns. In
the last column I am using a checkbox cell that should only be  
visible to

the user when a representedObject in the TreeController has a certain
property value. There is no Visibility binding only Enabled which  
does not

hide the control but just dims it.


Hm.  I'm conflicted as to whether or not from a usability standpoint
you should prefer to display a disabled cell or none at all.

NSTableView has a -tableView:dataCellForTableColumn:row: delegate
method, so you don't need to subclass NSTableColumn.  Perhaps the
better approach is to subclass NSButtonCell and implement
-drawWithFrame:inView: somewhat like this:

-(void)drawWithFrame:(NSRect)frame inView:(NSView *)view {
 if([self shouldDisplayCheckboxForObject:[self objectValue]])
   [super drawWithFrame:frame inView:view];
}

Then, of course, you need to implement
-shouldDisplayCheckboxForObject, set an instance of this cell as the
cell for your table column, and bind the column to your model objects
instead of an attribute thereof.

--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


Re: NSButtonCell visibility binding in NSOutlineView

2009-04-29 Thread Chris Tracewell


On Apr 29, 2009, at 8:13 AM, Ashley Clark wrote:


On Apr 28, 2009, at 12:12 PM, Chris Tracewell wrote:

I am looking for the best method of turning off the visibility of  
an NSButtonCell object for individual rows in an OutlineView/ 
TableView. I have an OutlineView that is bound to a TreeController.  
There are two columns. In the last column I am using a checkbox  
cell that should only be visible to the user when a  
representedObject in the TreeController has a certain property  
value. There is no Visibility binding only Enabled which does not  
hide the control but just dims it.


I am using bindings to return a custom image for setImage and  
setAlternateImage to display a custom NSImage instead of the  
regular checkbox. It works nicely. I tried using conditional logic  
to return a transparent image when I want to hide the control but  
that affects the entire column. If I need to subclass I am  
suspecting I need to override NSTableColumn's dataCellForRow, but  
then how do I obtain the representedObject for that row?


Why not just implement - 
outlineView:willDisplayCell:forTableColumn:item: on your delegate  
and then set your images there depending on what item is about to be  
displayed?



Ashley


I tried that by setting the image but I need 3 states for the checkbox  
- OFF, ON, HIDDEN. Whenever I set a certain row to a HIDDEN image to  
hide that row it would affect the image for all other items too. So it  
looked like I would need to subclass, however I found the solution and  
just posted about it before your email came in...


-(NSCell *)outlineView:(NSOutlineView *)outlineView  
dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item



Thanks

Chris
___

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: NSButtonCell visibility binding in NSOutlineView

2009-04-29 Thread Chris Tracewell


On Apr 29, 2009, at 10:59 AM, Ashley Clark wrote:


On Apr 29, 2009, at 11:46 AM, Chris Tracewell wrote:


On Apr 29, 2009, at 8:13 AM, Ashley Clark wrote:


On Apr 28, 2009, at 12:12 PM, Chris Tracewell wrote:

I am looking for the best method of turning off the visibility of  
an NSButtonCell object for individual rows in an OutlineView/ 
TableView. I have an OutlineView that is bound to a  
TreeController. There are two columns. In the last column I am  
using a checkbox cell that should only be visible to the user  
when a representedObject in the TreeController has a certain  
property value. There is no Visibility binding only Enabled which  
does not hide the control but just dims it.


I am using bindings to return a custom image for setImage and  
setAlternateImage to display a custom NSImage instead of the  
regular checkbox. It works nicely. I tried using conditional  
logic to return a transparent image when I want to hide the  
control but that affects the entire column. If I need to subclass  
I am suspecting I need to override NSTableColumn's  
dataCellForRow, but then how do I obtain the representedObject  
for that row?


Why not just implement - 
outlineView:willDisplayCell:forTableColumn:item: on your delegate  
and then set your images there depending on what item is about to  
be displayed?


I tried that by setting the image but I need 3 states for the  
checkbox - OFF, ON, HIDDEN. Whenever I set a certain row to a  
HIDDEN image to hide that row it would affect the image for all  
other items too. So it looked like I would need to subclass,  
however I found the solution and just posted about it before your  
email came in...


-(NSCell *)outlineView:(NSOutlineView *)outlineView  
dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item


When using willDisplayCell you have to set the image for all rows to  
whatever the image should be for that row.


Something along the lines of:

if (rowShouldBeHidden) {
[cell setImage:nil];
[cell setAlternateImage:nil];
}
else {
[cell setImage:normalImage];
[cell setAlternateImage:alternateImage];
}


Ashley



Ashley,

Thank you - that worked. I thought I had tried something similar but I  
obviously had it wrong. Here is a screen shot for reference if anyone  
cares to see the window in final state and has any comments.


http://www.thinkcl.com/images/screengrab.png

Chris
___

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