Xcode 3.2.1 and OCUnit results in selector not recognized

2010-03-05 Thread Tom
Hi all,

I'm getting really frustrated with unit testing here - it just works so
erradicly - unit tests are fine, then I refactor my code and update tests
accordingly and suddenly I get selector not recognized message and some of
the tests fail. Then I mess with code a bit, and it starts to work again
(randomly as I can't find any pattern), then after some change again the
same problem... Now if run the same code in app, it works!

I googled for few days not really getting anywhere - the closest was Xcode
3.2 issue which could be resolved by changing time zone (doesn't work...).
The tests fail either by running the script, or by using debugger on otest.

I've read that the problem is with tests runner which quits tests in the
middle (I've only found this info for Xcode 3.2, so I'm not sure it still
applies to 3.2.1) which would make sense with the error message I'm getting.
Is there a workaround for this? Is there an alternative? I've briefly tried
BHUnit, but first impression was it running 3x slower, so gave it up at that
time. I also downloaded GTM, but couldn't get to the unit tests franework
(probably should've included source files directly, however it's only a
superset of OCUnit, so it probably suffers from the same problem, don't
know).

Any advice would be greatly appreciated...

Thanks, Tom
___

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: Get my custom object from NSDictionary variable

2010-03-05 Thread Alexander Spohr

Am 05.03.2010 um 00:48 schrieb Daniel Káčer:

 [myDictionary setObject:[[ComplexObject alloc] initWithFrom:_tempFrom 
 pairTo:string] forKey:[NSString stringWithFormat:@%d, [myDictionary 
 count]]];

Why don’t you use an NSArray?

atze

___

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: Interface Builder : moving a controller to File's Owner

2010-03-05 Thread David Geldreich

Hello Kyle and all cocoa-devers,

Le 5 mars 10 à 00:21, Kyle Sluder a écrit :

On Thu, Mar 4, 2010 at 1:45 PM, David Geldreich david.geldre...@free.fr 
 wrote:

I am refactoring one big NIB file into smaller pieces. I copy/paste a
WindowController object and a Window object in a new empty NIB.


Window controllers don't belong in nibs. You create them in code and
ask them to load a nib, at which point they fill in as File's Owner
(unless you use the variant in which you provide a different File's
Owner, but you almost never actually want to use that).


That's my problem, I want to create the WindowController in my code  
and then attach the NIB to it.


When I create my NIB file from scratch, that's what I do. But here, I  
am refactoring on big NIB file into smaller files to ease the  
maintenance.


The WindowController and Window (with tons of connections) already  
exist in a very big NIB. I want to extract the WindowController/Window  
from this NIB file, keep all the connections and put them in a new NIB  
file.


When I copy/paste WindowController/Window from my big NIB to the new  
NIB, I do not know how to move all the connections to/from  
WindowController to the File's Owner object ?


For example, if you use the refactoring (File | Decompose Interface)  
of InterfaceBuilder, you end up having your WindowsController/Window  
separated from File's Owner.


Regards.

David




___

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: Interface Builder : moving a controller to File's Owner

2010-03-05 Thread jonat...@mugginsoft.com

On 5 Mar 2010, at 08:29, David Geldreich wrote:

 Hello Kyle and all cocoa-devers,
 
 Le 5 mars 10 à 00:21, Kyle Sluder a écrit :
 
 On Thu, Mar 4, 2010 at 1:45 PM, David Geldreich david.geldre...@free.fr 
 wrote:
 I am refactoring one big NIB file into smaller pieces. I copy/paste a
 WindowController object and a Window object in a new empty NIB.
 
 Window controllers don't belong in nibs. You create them in code and
 ask them to load a nib, at which point they fill in as File's Owner
 (unless you use the variant in which you provide a different File's
 Owner, but you almost never actually want to use that).
 
 That's my problem, I want to create the WindowController in my code and then 
 attach the NIB to it.
 
 When I create my NIB file from scratch, that's what I do. But here, I am 
 refactoring on big NIB file into smaller files to ease the maintenance.
 
 The WindowController and Window (with tons of connections) already exist in a 
 very big NIB. I want to extract the WindowController/Window from this NIB 
 file, keep all the connections and put them in a new NIB file.
 
 When I copy/paste WindowController/Window from my big NIB to the new NIB, I 
 do not know how to move all the connections to/from WindowController to the 
 File's Owner object ?
 
 For example, if you use the refactoring (File | Decompose Interface) of 
 InterfaceBuilder, you end up having your WindowsController/Window separated 
 from File's Owner.
 
 Regards.
 
 David
Including the window controller in the nib is a non standard approach.
Your situation is comprehensible though if you have only done it this way.

So:

1. Decompose your monster nib as required.
2. In IB select Files's Owner and display the Identity Inspector.
3. Set the class to that of your custom window controller.
4. Now hook up your nib  targets and actions to the File's Owner.

I normally then define an -init method on my window subclass.
When the window controller is instantiated it loads the nib with self as file's 
owner.

- (id)init
{
self = [super initWithWindowNibName:@MyWindowNib];
return self;
}


Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.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/jonathan%40mugginsoft.com
 
 This email sent to jonat...@mugginsoft.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: Interface Builder : moving a controller to File's Owner

2010-03-05 Thread David Geldreich


Le 5 mars 10 à 11:48, jonat...@mugginsoft.com a écrit :

Including the window controller in the nib is a non standard approach.


I am maintaining this software, that's why I want to move to the  
standard approach.



1. Decompose your monster nib as required.
2. In IB select Files's Owner and display the Identity Inspector.
3. Set the class to that of your custom window controller.
4. Now hook up your nib  targets and actions to the File's Owner.


The problem is precisely 4), how do I move all the connections (like  
80 or more) that were done between WindowController and Window, so  
they are between File's Owner and Window ?!




I normally then define an -init method on my window subclass.
When the window controller is instantiated it loads the nib with  
self as file's owner.


- (id)init
{
self = [super initWithWindowNibName:@MyWindowNib];
return self;
}


That is what I also do... but when you maintain an application, you  
have to do with what's there.


Regards.

David.___

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


NSOutlineView style issue.

2010-03-05 Thread Billy Flatman
Hi All,

I need to remove the style effect on the parent nodes of the NSOutlineView, as 
show on the link below.

http://www.flickr.com/photos/47616...@n08/4408708386

I don't seem to be able to find any options in interface designer.

Any help greatly appreciated.

Billy Flatman
b.flat...@googlemail.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: Interface Builder : moving a controller to File's Owner

2010-03-05 Thread jonat...@mugginsoft.com


On 5 Mar 2010, at 12:23, David Geldreich wrote:

 1. Decompose your monster nib as required.
 2. In IB select Files's Owner and display the Identity Inspector.
 3. Set the class to that of your custom window controller.
 4. Now hook up your nib  targets and actions to the File's Owner.
 
 The problem is precisely 4), how do I move all the connections (like 80 or 
 more) that were done between WindowController and Window, so they are between 
 File's Owner and Window ?!
 
I don't know if IB can help with this beyond the decomposition - ask on the 
xcode list.

One approach might be to open the .xib file directly and attempt to refactor 
the connections textually.
How successful this might be I don't know.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.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: NSOutlineView style issue.

2010-03-05 Thread Martin Hewitson
Hi Billy,

If you are referring to the (grey) group style, then you can override the method

- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item

in your delegate and return NO.

Cheers,

Martin

On Mar 5, 2010, at 1:33 PM, Billy Flatman wrote:

 Hi All,
 
 I need to remove the style effect on the parent nodes of the NSOutlineView, 
 as show on the link below.
 
 http://www.flickr.com/photos/47616...@n08/4408708386
 
 I don't seem to be able to find any options in interface designer.
 
 Any help greatly appreciated.
 
 Billy Flatman
 b.flat...@googlemail.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/martin.hewitson%40aei.mpg.de
 
 This email sent to martin.hewit...@aei.mpg.de


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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 CGPathAddCurveToPoint returns to the origin?

2010-03-05 Thread Gustavo Pizano
Hello.
I have the following code:

..

CGMutablePathRef path = CGPathCreateMutable();

CGPathMoveToPoint(path,NULL,midX,minY); 
CGPathAddCurveToPoint(path,NULL, maxX , minY, maxX, midY , 2.0f, 2.0f);
CGPathAddCurveToPoint(path,NULL, maxX, maxY, midX, maxY, 2.0f, 2.0f);
CGPathAddCurveToPoint(path,NULL,minX , maxY, minX, midY, 2.0f, 2.0f);
CGPathAddCurveToPoint(path,NULL, minX, minX, midX,minY, 2.0f, 2.0f);
CGPathCloseSubpath(path);
CGContextAddPath(currentContext, path);
CGContextClip(currentContext);
 CGContextDrawLinearGradient(currentContext, glossGradient, topCenter, 
bottonCenter, 0);

CGPathRelease(path);

this code works on Cocoa, but on iPHone it doesn't, It goes to the starting 
point, and after the first curve, it returns to the origin, and for there adds 
the second curve and after that it returns to origin again and so on.

So at the end I have a very nice flower  which is what I don't what I just 
want a rounded corners rect,  what can I be doing wrong?

Thanks 

Gustavo





___

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 CGPathAddCurveToPoint returns to the origin?

2010-03-05 Thread Gustavo Pizano
OOP sorry I messed up with the points\

:P

On Mar 5, 2010, at 2:34 PM, Gustavo Pizano wrote:

 Hello.
 I have the following code:
 
 ..
 
   CGMutablePathRef path = CGPathCreateMutable();
   
   CGPathMoveToPoint(path,NULL,midX,minY); 
   CGPathAddCurveToPoint(path,NULL, maxX , minY, maxX, midY , 2.0f, 2.0f);
   CGPathAddCurveToPoint(path,NULL, maxX, maxY, midX, maxY, 2.0f, 2.0f);
   CGPathAddCurveToPoint(path,NULL,minX , maxY, minX, midY, 2.0f, 2.0f);
   CGPathAddCurveToPoint(path,NULL, minX, minX, midX,minY, 2.0f, 2.0f);
   CGPathCloseSubpath(path);
   CGContextAddPath(currentContext, path);
   CGContextClip(currentContext);
 CGContextDrawLinearGradient(currentContext, glossGradient, topCenter, 
 bottonCenter, 0);   
   
   CGPathRelease(path);
 
 this code works on Cocoa, but on iPHone it doesn't, It goes to the starting 
 point, and after the first curve, it returns to the origin, and for there 
 adds the second curve and after that it returns to origin again and so on.
 
 So at the end I have a very nice flower  which is what I don't what I just 
 want a rounded corners rect,  what can I be doing wrong?
 
 Thanks 
 
 Gustavo
 
 
 
 
 

___

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 CGPathAddCurveToPoint returns to the origin?

2010-03-05 Thread Gustavo Pizano
EHH nop sorry, I fixed and still I get the nice flower.. 
CGContextBeginPath(currentContext);

CGContextMoveToPoint(currentContext,midX,minY);
CGContextAddCurveToPoint(currentContext, maxX , minY, maxX, midY , 
2.0f, 2.0f);
CGContextAddCurveToPoint(currentContext, maxX, maxY, midX, maxY, 2.0f, 
2.0f);
CGContextAddCurveToPoint(currentContext,minX , maxY, minX, midY, 2.0f, 
2.0f);
CGContextAddCurveToPoint(currentContext, minX, minY, midX,minY, 2.0f, 
2.0f);

CGContextClosePath(currentContext);

CGContextClip(currentContext);
.
Any ideas?

G.

On Mar 5, 2010, at 2:39 PM, Gustavo Pizano wrote:

 OOP sorry I messed up with the points\
 
 :P
 
 On Mar 5, 2010, at 2:34 PM, Gustavo Pizano wrote:
 
 Hello.
 I have the following code:
 
 ..
 
  CGMutablePathRef path = CGPathCreateMutable();
  
  CGPathMoveToPoint(path,NULL,midX,minY); 
  CGPathAddCurveToPoint(path,NULL, maxX , minY, maxX, midY , 2.0f, 2.0f);
  CGPathAddCurveToPoint(path,NULL, maxX, maxY, midX, maxY, 2.0f, 2.0f);
  CGPathAddCurveToPoint(path,NULL,minX , maxY, minX, midY, 2.0f, 2.0f);
  CGPathAddCurveToPoint(path,NULL, minX, minX, midX,minY, 2.0f, 2.0f);
  CGPathCloseSubpath(path);
  CGContextAddPath(currentContext, path);
  CGContextClip(currentContext);
CGContextDrawLinearGradient(currentContext, glossGradient, topCenter, 
 bottonCenter, 0);   
  
  CGPathRelease(path);
 
 this code works on Cocoa, but on iPHone it doesn't, It goes to the starting 
 point, and after the first curve, it returns to the origin, and for there 
 adds the second curve and after that it returns to origin again and so on.
 
 So at the end I have a very nice flower  which is what I don't what I just 
 want a rounded corners rect,  what can I be doing wrong?
 
 Thanks 
 
 Gustavo
 
 
 
 
 
 

___

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 a window was closed?

2010-03-05 Thread Eric Gorr

On Mar 4, 2010, at 6:14 PM, Graham Cox wrote:

 
 On 05/03/2010, at 12:39 AM, Eric Gorr wrote:
 
 Now, there are other means that will cause the NSPanel to be closed with 
 different answers to whether or not it should be visible at the next launch.
 
 
 It's not clear to me why. You only need to record whether the panel is 
 currently open or closed in the user defaults. If the app quits in the 'open' 
 state it opens the panels at next launch. For recording the closed state, the 
 NSWindowWillCloseNotification looks useful. For open state, there isn't an 
 equivalent notification but its controller should know when this is.

In most cases this is the way the code was written. However, for a small number 
of panels, the design was different and this doesn't work. It was made 
dependent upon knowing how the window was being closed. At some point, I will 
be able to go back and change this ancient code, but for now, I needed a way to 
determine how the window was being closed.

___

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 a window was closed?

2010-03-05 Thread Eric Gorr

On Mar 5, 2010, at 11:53 AM, Greg Guerin wrote:

 Eric Gorr wrote:
 
 In most cases this is the way the code was written. However, for a small 
 number of panels, the design was different and this doesn't work. It was 
 made dependent upon knowing how the window was being closed. At some point, 
 I will be able to go back and change this ancient code, but for now, I 
 needed a way to determine how the window was being closed.
 
 
 Outline:
 
 In applicationWillTerminate:, set a global flag to true.  Tell all the wacky 
 panels to close.  They see the global flag true, and differentiate this close 
 from user-initiated close.

The use of a global was considered and rejected. But, would likely be 
reconsidered if -windowShouldClose: does not work as expected.

___

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


Custom View in Toolbar

2010-03-05 Thread David Blanton
Using IB I have placed a custom view in a window toolbar.  The custom  
view contains buttons.  The buttons are connected to actions.  The  
custom view as a tool bar item auto validates. In IB the custom view  
and its contained buttons appears in the tool bar and customization  
palette.


The problem.

When I build an run the program the custom view does not appear in the  
tool bar or the customization palette. Its label does appear in both  
the tool bar and the customization palette.


What am I not enabling to keep this from being visible?


- db
___

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 a window was closed?

2010-03-05 Thread Greg Guerin

Eric Gorr wrote:

The use of a global was considered and rejected. But, would likely  
be reconsidered if -windowShouldClose: does not work as expected.



Then add a category method that means close but preserve open state  
for next launch, and call that from the termination delegate.


Or a category method that tells the receiver to copy its current open  
state, which will then be written to disk when the next close message  
is received.


I don't see a big difference in how the two things (user-close vs.  
close-but-preserve-opened-state) are distinguished by the panels.   
Use whatever makes sense for the code base.  The key point is that  
the latter only occurs at app termination.  Tying it into app  
termination is what makes it different.


  -- GG


___

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 CGPathAddCurveToPoint returns to the origin?

2010-03-05 Thread David Duncan
On Mar 5, 2010, at 5:45 AM, Gustavo Pizano wrote:

 EHH nop sorry, I fixed and still I get the nice flower.. 
   CGContextBeginPath(currentContext);
   
   CGContextMoveToPoint(currentContext,midX,minY);
   CGContextAddCurveToPoint(currentContext, maxX , minY, maxX, midY , 
 2.0f, 2.0f);
   CGContextAddCurveToPoint(currentContext, maxX, maxY, midX, maxY, 2.0f, 
 2.0f);
   CGContextAddCurveToPoint(currentContext,minX , maxY, minX, midY, 2.0f, 
 2.0f);
   CGContextAddCurveToPoint(currentContext, minX, minY, midX,minY, 2.0f, 
 2.0f);
   
   CGContextClosePath(currentContext);
 
   CGContextClip(currentContext);
 .
 Any ideas?


First off, what are you trying to draw?

The reason why you are getting a nice flower-ish pattern is because you are 
asking all of your curves to trace through 2 points and end at the same 
location (2,2). CGContextAddCurveToPoint generate a bezier curve that starts at 
the current location, approaches the 2 control points (which are your various 
combinations of min/mid/max x/y) and ends at the end point (which is always 
2,2).
--
David Duncan
Apple DTS Animation and Printing

___

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


Displaying two different sub-entities in one table view

2010-03-05 Thread Jean-Henri Duteau
I have a CoreData project and I'm trying to figure out how to display multiple 
entity types in one table view.

I have a Team that has Skaters and Goalies.  Skaters and Goalies have Player as 
a parent.  Team has a to-many relationship to Player.  I have a TableView that 
displays all of the players of a selected team.  Everything works just fine as 
long as I restrict myself to attributes that are only on the Player object.  
But I want to display Skater attributes and Goalie attributes.  There is an 
additional wrinkle that the attributes are located off a Ratings object 
attached to each Player.  A Skater has a SkaterRatings object while a Goalie 
has a GoalieRatings object.

I've tried a number of different ways to make this happen.  I *think* that I 
may need to produce a custom TableViewDataSource and I tried to do this with 
the content backed by an NSArrayController, but I couldn't make that work.

Has anyone else tried to do this?

Jean

___

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 CGPathAddCurveToPoint returns to the origin?

2010-03-05 Thread Gustavo Pizano
Hello Duncan.

I want to draw the inside of a UIButton with a gradient,  so I just place in IB 
a Cusotm Buttom, and in the drawRect I taking its bounds, and from there Im 
getting the midX,minX etc.
So let me see if I get this straight, and rechecking the docs,. 

OH OMG!! 
I m such an idiot, I was using the wrong method, I needed the 
CGContextAddArcToPoint,...  

my mistake... sorry

Thx

Gustavo


On Mar 5, 2010, at 6:46 PM, David Duncan wrote:

 On Mar 5, 2010, at 5:45 AM, Gustavo Pizano wrote:
 
 EHH nop sorry, I fixed and still I get the nice flower.. 
  CGContextBeginPath(currentContext);
  
  CGContextMoveToPoint(currentContext,midX,minY);
  CGContextAddCurveToPoint(currentContext, maxX , minY, maxX, midY , 
 2.0f, 2.0f);
  CGContextAddCurveToPoint(currentContext, maxX, maxY, midX, maxY, 2.0f, 
 2.0f);
  CGContextAddCurveToPoint(currentContext,minX , maxY, minX, midY, 2.0f, 
 2.0f);
  CGContextAddCurveToPoint(currentContext, minX, minY, midX,minY, 2.0f, 
 2.0f);
  
  CGContextClosePath(currentContext);
 
  CGContextClip(currentContext);
 .
 Any ideas?
 
 
 First off, what are you trying to draw?
 
 The reason why you are getting a nice flower-ish pattern is because you are 
 asking all of your curves to trace through 2 points and end at the same 
 location (2,2). CGContextAddCurveToPoint generate a bezier curve that starts 
 at the current location, approaches the 2 control points (which are your 
 various combinations of min/mid/max x/y) and ends at the end point (which is 
 always 2,2).
 --
 David Duncan
 Apple DTS Animation and Printing
 

___

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 a window was closed?

2010-03-05 Thread Eric Gorr
My point is not that I don't know how to fix it or cannot (as an absolute) fix 
it, but that it is not practical to fix it at this time, so I need a way to 
determine how the window was closed.

If you have never faced one of these situations before, just wait awhile...you 
will.


On Mar 5, 2010, at 12:33 PM, Greg Guerin wrote:

 Eric Gorr wrote:
 
 The use of a global was considered and rejected. But, would likely be 
 reconsidered if -windowShouldClose: does not work as expected.
 
 
 Then add a category method that means close but preserve open state for next 
 launch, and call that from the termination delegate.
 
 Or a category method that tells the receiver to copy its current open state, 
 which will then be written to disk when the next close message is received.
 
 I don't see a big difference in how the two things (user-close vs. 
 close-but-preserve-opened-state) are distinguished by the panels.  Use 
 whatever makes sense for the code base.  The key point is that the latter 
 only occurs at app termination.  Tying it into app termination is what makes 
 it different.
 
  -- GG
 
 
 ___
 
 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/mailist%40ericgorr.net
 
 This email sent to mail...@ericgorr.net

___

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: Custom View in Toolbar

2010-03-05 Thread David Blanton
Well, I have read and re-read the docs on custom views in a toolbar.   
In particular the section View item validation.


I sub-classed NSToolbarItem and set the custom view toolbar item to  
this class.


In this subclass I have outlets for all the controls in the view.

I overrode -validate.

I have called every possible method on the view and the controls for  
them to display.  Never see anything and in fact the second time  
through -validate EXC_BAD_ACCESS is thrown.


So two hours later I still cannot display a custom view containing  
buttons in an NSToolbar. Something that in MFC is trivial is near  
impossible with Cocoa. The Windows guys here are laughing their ...  
off at my inability to accomplish a trivial MFC task in a Cocoa  
equivalent.


Frustrated.

-db




On Mar 5, 2010, at 10:23 AM, David Blanton wrote:

Using IB I have placed a custom view in a window toolbar.  The  
custom view contains buttons.  The buttons are connected to  
actions.  The custom view as a tool bar item auto validates. In IB  
the custom view and its contained buttons appears in the tool bar  
and customization palette.


The problem.

When I build an run the program the custom view does not appear in  
the tool bar or the customization palette. Its label does appear in  
both the tool bar and the customization palette.


What am I not enabling to keep this from being visible?


- db
___

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/airedale%40tularosa.net

This email sent to aired...@tularosa.net




___

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 a window was closed?

2010-03-05 Thread Sherm Pendley
On Fri, Mar 5, 2010 at 1:44 PM, Eric Gorr mail...@ericgorr.net wrote:
 My point is not that I don't know how to fix it or cannot (as an absolute) 
 fix it, but that it is not practical to fix it at this time, so I need a way 
 to determine how the window was closed.

Given that there's no reliable way to determine that, you might want
to reconsider the practicality of the alternative.

 If you have never faced one of these situations before, just wait 
 awhile...you will.

I have. The thing is, it's a mistake to take it as a matter of dogma
that the workaround will *always* be the easier solution. Doing so
runs the risk of failing to recognize when one has arrived at a point
when that is no longer true.

sherm--

-- 
Cocoa programming in Perl:
http://www.camelbones.org
___

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 a window was closed?

2010-03-05 Thread Eric Gorr

On Mar 5, 2010, at 1:59 PM, Sherm Pendley wrote:

 On Fri, Mar 5, 2010 at 1:44 PM, Eric Gorr mail...@ericgorr.net wrote:
 My point is not that I don't know how to fix it or cannot (as an absolute) 
 fix it, but that it is not practical to fix it at this time, so I need a way 
 to determine how the window was closed.
 
 Given that there's no reliable way to determine that, you might want
 to reconsider the practicality of the alternative.

Why is -windowShouldClose: not reliable?

___

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: Displaying two different sub-entities in one table view

2010-03-05 Thread Quincey Morris
On Mar 5, 2010, at 10:04, Jean-Henri Duteau wrote:

 I have a Team that has Skaters and Goalies.  Skaters and Goalies have Player 
 as a parent.  Team has a to-many relationship to Player.  I have a TableView 
 that displays all of the players of a selected team.  Everything works just 
 fine as long as I restrict myself to attributes that are only on the Player 
 object.  But I want to display Skater attributes and Goalie attributes.  
 There is an additional wrinkle that the attributes are located off a Ratings 
 object attached to each Player.  A Skater has a SkaterRatings object while a 
 Goalie has a GoalieRatings object.

The difficulty is that (of course) all the rows in a table view are the same. 
Therefore the table view must see a consistent data model that isn't your 
actual data model.

One way of doing this would be to define all of the properties that the table 
view needs in the Player parent entity, and to override the appropriate ones in 
the Skaters and Goalies entities to return the correct value.

Another way of doing this is to define a set of (non-Core Data) intermediary 
objects that have the desired display properties, and keep these in sync with 
the actual data model via KVO.

It's hard to be more specific without knowing how you intend to represent 
different properties that are row-wise different in a table where all the rows 
have the same structure. What do you show for a Skater-only property in a 
Goalie row?

 I've tried a number of different ways to make this happen.  I *think* that I 
 may need to produce a custom TableViewDataSource and I tried to do this with 
 the content backed by an NSArrayController, but I couldn't make that work.

A data source is easier in some ways -- it doesn't require that your data model 
objects have a consistent set of properties, just that you're able to generate 
a consistent set of object values from the data model -- but it doesn't 
fundamentally change the problem.

IMO, using an array controller like this is a terrible idea. Array controllers 
are mostly view-supporting objects, and integrating them into your data model 
code is a bit messy. Just go straight to your data model properties. If you 
need sorting and filtering, use Core Data's capabilities directly. I can't 
immediately think of any other reason why it might seem to be a good idea to 
use an array controller here.

Couldn't make that work in what sense? What went wrong?


___

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: Custom View in Toolbar

2010-03-05 Thread Quincey Morris
On Mar 5, 2010, at 10:45, David Blanton wrote:

 Well, I have read and re-read the docs on custom views in a toolbar.  In 
 particular the section View item validation.
 
 I sub-classed NSToolbarItem and set the custom view toolbar item to this 
 class.
 
 In this subclass I have outlets for all the controls in the view.
 
 I overrode -validate.
 
 I have called every possible method on the view and the controls for them to 
 display.  Never see anything and in fact the second time through -validate 
 EXC_BAD_ACCESS is thrown.

If validate is crashing, there's a bug you need to fix. It might be, you know, 
related to the problem you ran into. Have you looked for a memory management 
problem relating to the custom view? Did you check the run log for error 
messages?

 So two hours later I still cannot display a custom view containing buttons in 
 an NSToolbar. Something that in MFC is trivial is near impossible with Cocoa. 
 The Windows guys here are laughing their ... off at my inability to 
 accomplish a trivial MFC task in a Cocoa equivalent.

Let them have their innocent fun. The last time any of them had a good reason 
to laugh was somewhere around 1979.

 Frustrated.
 
 -db
 
 
 
 
 On Mar 5, 2010, at 10:23 AM, David Blanton wrote:
 
 Using IB I have placed a custom view in a window toolbar.  The custom view 
 contains buttons.  The buttons are connected to actions.  The custom view as 
 a tool bar item auto validates. In IB the custom view and its contained 
 buttons appears in the tool bar and customization palette.
 
 The problem.
 
 When I build an run the program the custom view does not appear in the tool 
 bar or the customization palette. Its label does appear in both the tool bar 
 and the customization palette.
 
 What am I not enabling to keep this from being visible?

You haven't established that the custom view isn't visible, just that its 
contents aren't visible. Sometimes odd things happen when an unflipped view is 
inserted in a flipped superview. Maybe the subview frames or bounds aren't 
where you think they are. Maybe the subviews have been clipped away.


___

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: Displaying two different sub-entities in one table view

2010-03-05 Thread Jean-Henri Duteau

On 2010-03-05, at 11:21 AM, Quincey Morris wrote:

 The difficulty is that (of course) all the rows in a table view are the same. 
 Therefore the table view must see a consistent data model that isn't your 
 actual data model.
 

I know and I'm trying to think of UI alternatives that wouldn't smell as badly 
as this one does.

 One way of doing this would be to define all of the properties that the table 
 view needs in the Player parent entity, and to override the appropriate ones 
 in the Skaters and Goalies entities to return the correct value.
 

Yeah, that's the easiest but I grimace when I think of that.

 Another way of doing this is to define a set of (non-Core Data) intermediary 
 objects that have the desired display properties, and keep these in sync 
 with the actual data model via KVO.
 
I thought of that too. :)


 It's hard to be more specific without knowing how you intend to represent 
 different properties that are row-wise different in a table where all the 
 rows have the same structure. What do you show for a Skater-only property in 
 a Goalie row?
 
Just empty fields, i.e 

 IMO, using an array controller like this is a terrible idea. Array 
 controllers are mostly view-supporting objects, and integrating them into 
 your data model code is a bit messy. Just go straight to your data model 
 properties. If you need sorting and filtering, use Core Data's capabilities 
 directly. I can't immediately think of any other reason why it might seem to 
 be a good idea to use an array controller here.
 
I didn't mean to imply that I'm integrating an array controller into the data 
model.  I'm not doing that at all.  The reason for creating a TableSource 
backed by the Array controller is to get the off-the-shelf capabilities that 
NSArrayController gives you in IB.

 Couldn't make that work in what sense? What went wrong?
I didn't try very hard - just an hour or two this morning, but I couldn't get 
my tableView:objectValueForTableColumn:row: method to be called.  The 
numberOfRowsInTableView: got called so I think I had hooked it up right.  But 
as I said, I didn't try very hard.

In any case, thanks for the thoughts.  I'll ruminate on them for a bit.  My 
thoughts right now lead me to fix the UI so that I don't have to jury-rig a 
table view.

Thanks,

Jean

___

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: Custom View in Toolbar

2010-03-05 Thread Richard Somers

On Mar 5, 2010, at 11:45 AM, David Blanton wrote:

So two hours later I still cannot display a custom view containing  
buttons in an NSToolbar. Something that in MFC is trivial is near  
impossible with Cocoa. The Windows guys here are laughing their ...  
off at my inability to accomplish a trivial MFC task in a Cocoa  
equivalent.


Take a look at Apple's PDFKitLinker2 sample code. I think does what  
you want.


--Richard

___

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


[SOLVED] Re: PopupButtonCell in a TableView column

2010-03-05 Thread Lynn Barton
Ok, after re-studying the documentation on bindings, etc, and material from the 
list archives, I was able to get my tableview working with a popup menu in one 
column. Neuburg's suggestions, though appreciated, let to a blind alley because 
the documentation clearly states that the array that defines the menu should be 
an array of strings.

The turning point for me came when I saw that the popup's content binding 
should have a blank in the key field. After that, everything fell into place 
logically. However, the persistence of the error message remains a mystery that 
I will not pursue.

If anyone wants to know more, just send me a private email.

Lynn Barton
___

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: Custom View in Toolbar

2010-03-05 Thread Kyle Sluder
On Fri, Mar 5, 2010 at 10:45 AM, David Blanton aired...@tularosa.net wrote:
 I have called every possible method on the view and the controls for them to
 display.  Never see anything and in fact the second time through -validate
 EXC_BAD_ACCESS is thrown.

You never need to call anything to result in display. Your involvement
with drawing extends merely to marking a dirty region; AppKit takes
care of calling all of your drawing methods. If you are trying to
force drawing, you are doing something very, very wrong.

You have a memory management bug somewhere, most likely in your
validation method. Turn on zombies, run in Instruments, and find out
where.

 So two hours later I still cannot display a custom view containing buttons
 in an NSToolbar. Something that in MFC is trivial is near impossible with
 Cocoa. The Windows guys here are laughing their ... off at my inability to
 accomplish a trivial MFC task in a Cocoa equivalent.

A poor workman blames his tools.

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


predicate for a Core Data fetch request rejected by SQL

2010-03-05 Thread Mark Sanvitale
RANT AGAINST DOCUMENTATION:

I have searched (a lot) and found various other pleas for help of the form, I 
am trying to do a Core Date fetch on an SQL-backed store and it is failing 
because something is wrong with my predicate.  I thought some investigate 
could promote my plea beyond this basic level, but I seem to be hitting the 
same wall-of-no-information as everyone else.  This wall seems to built around 
Apple believing it's official Core Data docs adequately describes the issues 
with fetch predicates on SQL by stating, You cannot necessarily translate 
“arbitrary” SQL queries into predicates.  Translation: The issue with 
predicates and SQL is that there are issues.  Thanks for all the help, docs.

BEGIN PROBLEM AND QUESTION:

So, here is my plea for help.  I have a predicate of the form: character 
string BEGINSWITH path.  In other words, I am searching entities that possess 
a (string) property path to look for one whose path is a prefix of some 
string (which is inserted into the predicate via the fetch-request-template 
variable substitution).  This fetch executes just fine on an XML store.  The 
same fetch on an SQL store yields:  unimplemented SQL generation for predicate 
(/Volumes/MacHD/Applications/Utilities BEGINSWITH path).

My guess (given the lack of explicit documentation) is that SQL itself (or, 
perhaps, just Core Data's use of SQL) does not allow the left-hand-side to be a 
literal string, rather, it wants the left-hand-side to be a property key or 
key-path.  Anyone know if this is actually the case?

So far, in the world of path has to be on the left-hand-side I have not 
formulated a predicate that can determine if path is a prefix of the supplied 
string.  Yes, I can fetch all entities from the DB and then do an in-memory 
search amongst the paths.  Just hoping I could have the fetch do all the work.

Mark Sanvitale
Real Networks

___

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: predicate for a Core Data fetch request rejected by SQL

2010-03-05 Thread Joanna Carter
Hi Mark

 So, here is my plea for help.  I have a predicate of the form: character 
 string BEGINSWITH path.  In other words, I am searching entities that 
 possess a (string) property path to look for one whose path is a prefix of 
 some string (which is inserted into the predicate via the 
 fetch-request-template variable substitution).  This fetch executes just fine 
 on an XML store.  The same fetch on an SQL store yields:  unimplemented SQL 
 generation for predicate (/Volumes/MacHD/Applications/Utilities BEGINSWITH 
 path).

You need to think about how a predicate would work against a SQL store. The 
left-hand side of the expression cannot be anything other than the name of a 
column or a path to the name of a column.

Have you thought of using either path LIKE ... with wildcards, or path 
MATCHES ... with a regex expression?

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html#//apple_ref/doc/uid/TP40001795
 is the page that discusses these ideas, look for the String Comparisons 
section.

Joanna

--
Joanna Carter
Carter Consulting

___

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] can't make selected text stay black

2010-03-05 Thread Kent Hauser
Hi,

I'm trying to make a NSTableView selected row not look selected. I
subclassed NSTableView  added the following class  delegate methods:

// remove selection indication
- (void)highlightSelectionInClipRect:(NSRect)clipRect
{
NSLog (@%s, __FUNCTION__);
}

// change selected cell text color (delegate method)
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
{
NSLog (@%s, __FUNCTION__);
if ([cell respondsToSelector:@selector(setTextColor:)])
[(id)cell setTextColor:[NSColor blackColor]];
}

While the hightlightSelection method does it's job, my delegate method
doesn't paint the text black. (However, if I use redColor, I get red text).

What am I missing?

Thanks. Kent
___

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: Custom View in Toolbar

2010-03-05 Thread Chris Hanson
On Mar 5, 2010, at 1:53 PM, Kyle Sluder wrote:

 You have a memory management bug somewhere, most likely in your
 validation method. Turn on zombies, run in Instruments, and find out
 where.

If you’re using Xcode 3.2 or later, even before setting NSZombieEnabled and 
running in Instruments, you can use “Build  Analyze” to run the clang static 
analyzer against your code.

Among other checks, the static analyzer understands and can validate Cocoa 
memory management and catch both over-releases and leaks.

  — 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: predicate for a Core Data fetch request rejected by SQL

2010-03-05 Thread Sean McBride
On 3/5/10 10:18 PM, Joanna Carter said:

 So, here is my plea for help.  I have a predicate of the form:
character string BEGINSWITH path.  In other words, I am searching
entities that possess a (string) property path to look for one whose
path is a prefix of some string (which is inserted into the predicate
via the fetch-request-template variable substitution).  This fetch
executes just fine on an XML store.  The same fetch on an SQL store
yields:  unimplemented SQL generation for predicate (/Volumes/MacHD/
Applications/Utilities BEGINSWITH path).

You need to think about how a predicate would work against a SQL store.

But you shouldn't have to... Core Data is not a database and its use
of SQL is an implementation detail.  One shouldn't have to know anything
about SQL to use Core Data.  Of course, in practice, such knowledge is
helpful, as you say.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: predicate for a Core Data fetch request rejected by SQL

2010-03-05 Thread Joanna Carter
Hi Sean

 But you shouldn't have to... Core Data is not a database and its use
 of SQL is an implementation detail.  One shouldn't have to know anything
 about SQL to use Core Data.  Of course, in practice, such knowledge is
 helpful, as you say.

You have a point but, in theory, predicates against lists of objects usually 
take either the form:

value of a property operator constant value

... or possibly:

value of a property operator value of another property

Some predicates might be usable between two constant values but I have never 
seen one used, even with lists of objects, as:

constant value operator value of a property

Such a construct might work in the context of an XML file because the lefthand 
term could be interpreted as the name of a key but, not normally in a where 
clause in a database.

Joanna

--
Joanna Carter
Carter Consulting

___

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] can't make selected text stay black

2010-03-05 Thread Noah Desch

Cells highlight using white text based on the background style as far as I can 
tell. Try:

[cell setBackgroundStyle:NSBackgroundStyleLight];

Instead of setting the text color.

-Noah



On Mar 5, 2010, at 5:25 PM, Kent Hauser wrote:

 Hi,
 
 I'm trying to make a NSTableView selected row not look selected. I
 subclassed NSTableView  added the following class  delegate methods:
 
 // remove selection indication
 - (void)highlightSelectionInClipRect:(NSRect)clipRect
 {
NSLog (@%s, __FUNCTION__);
 }
 
 // change selected cell text color (delegate method)
 - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell
 forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
 {
NSLog (@%s, __FUNCTION__);
if ([cell respondsToSelector:@selector(setTextColor:)])
[(id)cell setTextColor:[NSColor blackColor]];
 }
 
 While the hightlightSelection method does it's job, my delegate method
 doesn't paint the text black. (However, if I use redColor, I get red text).
 
 What am I missing?
 
 Thanks. Kent

___

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


NSTextField controlTextDidEndEditing

2010-03-05 Thread Ulai Beekam

I have a delegate of NSTextField that uses the controlTextDidEndEditing: method 
to do some stuff when the editing has finished.

However, there are (as far as I can imagine) two types of possible scenarios 
under which the editing finishes: 1) the user hits return. in this case, the 
focus stays on the text field. 2) the user presses tab or clicks someplace 
else, in which case the text field loses focus.

My question is: What is the proper way to know *within the 
controlTextDidEndEditing: delegate method* which of the two scenarios occurred 
(or will occur? i suppose it has already occurred since it's a Did method)?

This is how I'm currently doing it, and it is not working properly:

- (void)controlTextDidEndEditing:(NSNotification *)aNotification
{
  NSTextField *textField = [aNotification object];
  NSTextView *fieldEditor = [[aNotification userInfo] 
objectForKey:@NSFieldEditor];
if ([[textField window] firstResponder] == fieldEditor)
NSLog(@focus lost);
  else
NSLog(@focus retained);
}

This works only in that if the user *clicks* outside the text field, focus 
lost is printed, and if the user hits return, focus retained is printed. 
However, this *fails* when I tab out of the text field, in which case focus 
retained is printed, which obviously indicated that my way of doing this sucks.

So I'm all out of luck. Any ideas?

Thanks, U.



  
_
Hotmail: Trusted email with powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969___

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: NSTextField controlTextDidEndEditing

2010-03-05 Thread Mike Abdullah

On 6 Mar 2010, at 01:00, Ulai Beekam wrote:

 
 I have a delegate of NSTextField that uses the controlTextDidEndEditing: 
 method to do some stuff when the editing has finished.
 
 However, there are (as far as I can imagine) two types of possible scenarios 
 under which the editing finishes: 1) the user hits return. in this case, the 
 focus stays on the text field. 2) the user presses tab or clicks someplace 
 else, in which case the text field loses focus.
 
 My question is: What is the proper way to know *within the 
 controlTextDidEndEditing: delegate method* which of the two scenarios 
 occurred (or will occur? i suppose it has already occurred since it's a Did 
 method)?
 
 This is how I'm currently doing it, and it is not working properly:
 
 - (void)controlTextDidEndEditing:(NSNotification *)aNotification
 {
  NSTextField *textField = [aNotification object];
  NSTextView *fieldEditor = [[aNotification userInfo] 
 objectForKey:@NSFieldEditor];
if ([[textField window] firstResponder] == fieldEditor)
NSLog(@focus lost);
  else
NSLog(@focus retained);
 }
 
 This works only in that if the user *clicks* outside the text field, focus 
 lost is printed, and if the user hits return, focus retained is printed. 
 However, this *fails* when I tab out of the text field, in which case focus 
 retained is printed, which obviously indicated that my way of doing this 
 sucks.
 
 So I'm all out of luck. Any ideas?

NSText handles this properly; when it posts an NSTextDidEndEditingNotification, 
that includes NSTextMovement as a key. I'm not sure if 
NSControlTextDidEndEditingNotification is kind enough to pass that on too, or 
if you'll have to listen out for the original notification from the field 
editor.___

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 a window was closed?

2010-03-05 Thread Klaus Backert


On 5 Mar 2010, at 20:01, Eric Gorr wrote:


Why is -windowShouldClose: not reliable?


May be, because the situation is as the method's documentation says:

This method may not always be called during window closing.  
Specifically, this method is not called when a user quits an  
application.


Klaus

___

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: predicate for a Core Data fetch request rejected by SQL

2010-03-05 Thread Mark Sanvitale
Thanks all for the sharing of thoughts.  Glad someone could confirm that what I 
was attempting did not make sense from the SQL perspective (which I am a newbie 
to).  But, like Sean wrote, Core Data seems to be presented as an abstraction 
ABOVE the layer which implements the actual storage/retrieval, thus, having to 
know about SQL details to get a Core Data operation to execute properly is 
unfortunate.

Some additional thinking about things made me realize that my rant about how 
the docs had failed me was a bit misdirected.  I pointed at the line, You 
cannot necessarily translate “arbitrary” SQL queries into predicates as being 
unacceptably vague.  I now think that this statement is acceptable.  Since Core 
Data is a concept separate from (though related to) SQL, you cannot expect to 
be able to bring every SQL-ism into the Core Data world and have it function 
properly (i.e. SQL ≠ Core Data).

However, my experience seems to demonstrates that the statement We (the 
system) cannot necessarily translate “arbitrary” predicates into SQL queries 
is also true, and I believe this concept should be expanded to spell out 
exactly what generally legal predicates end up being illegal when applying them 
to a Core Data context that is backed by SQL.  The only expanded discussion I 
can find on this subject in the official docs is, predicates that rely on 
Cocoa cannot work, which, for me, does not shed enough light on the subject.

Mark


On Mar 5, 2010, at 3:45 PM, Joanna Carter wrote:

 Hi Sean
 
 But you shouldn't have to... Core Data is not a database and its use
 of SQL is an implementation detail.  One shouldn't have to know anything
 about SQL to use Core Data.  Of course, in practice, such knowledge is
 helpful, as you say.
 
 You have a point but, in theory, predicates against lists of objects usually 
 take either the form:
 
 value of a property operator constant value
 
 ... or possibly:
 
 value of a property operator value of another property
 
 Some predicates might be usable between two constant values but I have never 
 seen one used, even with lists of objects, as:
 
 constant value operator value of a property
 
 Such a construct might work in the context of an XML file because the 
 lefthand term could be interpreted as the name of a key but, not normally in 
 a where clause in a database.
 
 Joanna
 
 --
 Joanna Carter
 Carter Consulting
 

___

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: NSTextField controlTextDidEndEditing

2010-03-05 Thread Ulai Beekam

Sweet, thanks! I didn't even know of NSTextMovement, but doing a search for in 
Spotlight, I saw that it was indeed buried somewhere in the Event Handling 
Guide :)

So anyway, this is how I'm doing it now, and so far it seems to be working well:

- (void)controlTextDidEndEditing:(NSNotification *)aNotification
{ 
  NSTextField *textField = [aNotification object];
  NSView *nextKeyView = [textField nextKeyView];
  NSUInteger whyEnd = [[[aNotification userInfo] 
objectForKey:@NSTextMovement] unsignedIntValue];
BOOL returnKeyPressed = (whyEnd == NSReturnTextMovement);
  BOOL tabOrBacktabToSelf = ((whyEnd == NSTabTextMovement || whyEnd == 
NSBacktabTextMovement)  (nextKeyView == nil || nextKeyView == textField));
if (returnKeyPressed || tabOrBacktabToSelf)
NSLog(@focus stays);
  else
NSLog(@focus leaves);
}


 NSText handles this properly; when it posts an 
 NSTextDidEndEditingNotification, that includes NSTextMovement as a key. I'm 
 not sure if NSControlTextDidEndEditingNotification is kind enough to pass 
 that on too, or if you'll have to listen out for the original notification 
 from the field editor.
  
_
Hotmail: Free, trusted and rich email service.
https://signup.live.com/signup.aspx?id=60969___

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] can't make selected text stay black

2010-03-05 Thread Kent Hauser
Thanks for the suggestion. I tried your suggestion (and the NSCell
setHighlighted method) to no avail. Any other thoughts on how black turns
white?

Kent


On Fri, Mar 5, 2010 at 12:52 PM, Noah Desch n...@wireframesoftware.comwrote:


 Cells highlight using white text based on the background style as far as I
 can tell. Try:

 [cell setBackgroundStyle:NSBackgroundStyleLight];

 Instead of setting the text color.

 -Noah



 On Mar 5, 2010, at 5:25 PM, Kent Hauser wrote:

  Hi,
 
  I'm trying to make a NSTableView selected row not look selected. I
  subclassed NSTableView  added the following class  delegate methods:
 
  // remove selection indication
  - (void)highlightSelectionInClipRect:(NSRect)clipRect
  {
 NSLog (@%s, __FUNCTION__);
  }
 
  // change selected cell text color (delegate method)
  - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell
  forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
  {
 NSLog (@%s, __FUNCTION__);
 if ([cell respondsToSelector:@selector(setTextColor:)])
 [(id)cell setTextColor:[NSColor blackColor]];
  }
 
  While the hightlightSelection method does it's job, my delegate method
  doesn't paint the text black. (However, if I use redColor, I get red
 text).
 
  What am I missing?
 
  Thanks. Kent

 ___

 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/kent%40khauser.net

 This email sent to k...@khauser.net

___

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


NSURLConnection Asynchronous vs. Synchronous Asymmetry

2010-03-05 Thread Stuart Malin
I haven't been able to find any documentation or relevant Web results regarding 
a situation I'm experiencing:

I get different results for the same identical NSURLRequest when I execute the 
request using NSURLConnection's +sendSynchronousRequest versus when I execute 
using asynchronously by allocating an NSURLConnection's instance and calling 
-start on it.

The particular request results in an HTTP 401 response (Not Authorized).

When I execute asynchronously:
1a) -connection:didReceiveResponse: is invoked and supplies an 
NSHTTPURLResponse object
1b) the NSHTTPURLResponse object reports the HTTP result of 401 vis 
-statusCode.
2) -connection:didReceiveData: does receive data
3) -connection:didFailWithError is NOT invoked.

When I execute synchronously with 
-sendSynchronousRequest:returningResponse:error:
1) the method does return the same data as the async
2) but: no response is returned
3) and: an NSError is returned, with the code of -1012 (which is 
NSURLErrorUserCancelledAuthentication as defined in NSURL.h)

I expected the sendSynchronousRequest approach to return an NSHTTPURLResponse 
object without an error because, according to the docs, the synchronous method 
is built on top of the asynchronous methods. The asymmetry of the response is a 
unsettling as I'm trying to have my code work either with synchronous or 
asynchronous, but having to interpret results differently is making this a 
nuisance (especially mapping NSURL error codes back to HTTP status codes). 

Do I have unreasonable expectations? incorrect understanding? or should I be 
getting similar/identical results, and so look for a bug?

Thanks for any advise...

___

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: NSURLConnection Asynchronous vs. Synchronous Asymmetry

2010-03-05 Thread Jerry Krinock

On 2010 Mar 05, at 19:54, Stuart Malin wrote:

 I haven't been able to find any documentation or relevant Web results 
 regarding a situation I'm experiencing:

Indeed, see below.

 I get different [error] results for the same identical NSURLRequest when I 
 execute the request using NSURLConnection's +sendSynchronousRequest versus 
 when I execute using asynchronously by allocating an NSURLConnection's 
 instance and calling -start on it [and an error occurs] ...

 I expected the sendSynchronousRequest approach to return an NSHTTPURLResponse 
 object without an error because, according to the docs, the synchronous 
 method is built on top of the asynchronous methods.

But one can discard useful information in the process of building on top of 
something :)

 The asymmetry of the response is a unsettling as I'm trying to have my code 
 work either with synchronous or asynchronous, but having to interpret results 
 differently is making this a nuisance (especially mapping NSURL error codes 
 back to HTTP status codes). 
 
 Do I have unreasonable expectations?

Well, maybe not unreasonable in the sense of what a reasonable person would 
expect, but unreasonable in light of the documentation for the error parameter 
of +sendSynchronousRequest...
  
   Out parameter used if an error occurs while processing the request.

In other words, You're guaranteed to get an NSError of some kind.  Apple 
could change the implementation in Mac OS 10.7 to always return error code 
9 with localized description Sorry, Charlie.

My conclusion is that +sendSychronousRequest is OK for quick hacks or in-house 
apps, but if you're writing a real app and need a meaningful NSError to act 
upon, you need to implement your own version of it based on the asynchronous 
methods, and return the NSError you get from them.  Mark Pauley suggests how to 
do that in this thread:

http://lists.apple.com/archives/Macnetworkprog/2009/Oct/msg00028.html


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Why CGPathAddCurveToPoint returns to the origin?

2010-03-05 Thread Henry McGilton

On Mar 5, 2010, at 10:07 AM, Gustavo Pizano wrote:

 Hello Duncan.
 
 I want to draw the inside of a UIButton with a gradient,  so I just place in 
 IB a Cusotm Buttom, and in the drawRect I taking its bounds, and from there 
 Im getting the midX,minX etc.
 So let me see if I get this straight, and rechecking the docs,. 
 
 OH OMG!! 
 I m such an idiot, I was using the wrong method, I needed the 
 CGContextAddArcToPoint,...  
 
 my mistake... sorry


Just for laughs, I have placed a ZIP file on my web site at:

http://www.trilithon.com/download/CoreGraphicsExtras.zip

which contains functions for drawing Round-Corner-Rectangles in either a CGPath 
or a CGContext.

   

Cheers,
. . . . . . . .Henry

www.nonatomic-retain.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