[moderator] Re: leaking UIColor objects

2009-07-05 Thread Scott Anguish
ANY discussion of pre release software he is off-topic and grounds for  
moderation. and breaking of the nda is liable to legal action.


there are no frivolous bug reports



On 2009-07-04, at 1:15 PM, WT wrote:


On Jul 4, 2009, at 4:37 PM, Fritz Anderson wrote:


On 4 Jul 2009, at 8:27 AM, WT wrote:

And, yes, I realize that discussing beta releases is a no-no. I'm  
not asking for a discussion; I'm merely asking for a "I'm having  
that problem too and I've already filed a radar" or "Yes, this  
looks like a bug and you should report it" or a "No, it must be  
something in your code" kind of response.


Soliciting publicity for the behavior of pre-release software is a  
violation of Apple's NDA, no matter how you parse "discussing."


I am not "soliciting publicity."

Suppose someone sent a message to the list saying "AppleOS 17.3 beta  
SDK is available for download" (assuming such a thing existed). Does  
that qualify as "soliciting publicity"? As a violation of Apple's  
NDA? Both? Neither? There is a line, but where is it drawn? My point  
is that there is a certain latitude in how the word "discussing" can  
be parsed.


The part of my message that you quoted represents an acknowledgement  
on my part that I am in that grey area surrounding the line where  
it's not clear whether or not what I'm doing is a violation of  
Apple's NDA.


I may have made a mistake in sending my original message to cocoa- 
dev but, if so, it was an honest mistake based on the intention of  
minimizing the filing of frivolous bug reports. Pardon me for  
thinking too much.



you could get an answer at devforums.apple.com.


A constructive suggestion. Thank you.

Also, if you're seeing changes in the behavior of an API -- and is  
that surprising in beta software -- it's no disgrace to file a bug  
report, no matter whether you think others have seen the bug.



Whether or not others have seen this behavior is not my motivation.  
I'm simply trying to ascertain if I'm missing something, in order to  
avoid filing a bug report for something that might be a mistake or  
misunderstanding on my part. What would happen if people were to  
file bugs for every misunderstanding they have?


Moreover, considering that I'm still building and running under 3.0  
(a fact you seem to have missed), this is not a change in behavior  
of an API, unless you consider Leaks to be part of the API. I  
obviously didn't consider it to be, and that might have been another  
mistake.

___

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/scott%40cocoadoc.com

This email sent to sc...@cocoadoc.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


Display either date part or time part in LOCAL format

2009-07-05 Thread Jacob Rhoden
I am probably overlooking something obvious (I hope) but what is the 
proper way to convert. either the Date or Time part of an NSDate to a 
localised string? I know I can do the following but its not exactly 
localised :(


NSDate *now = [[NSDate alloc] init];

NSDateFormatter *localDate = [[NSDateFormatter alloc] init];
[localDate setDateFormat:@"-MM-dd"];
NSString *date = [localDate stringFromDate:now];

NSDateFormatter *localTime = [[NSDateFormatter alloc] init];
[localTime setDateFormat:@"HH:mm:ss"];
NSString *time = [localTime stringFromDate:now];

--

Jacob Rhoden  http://jacobrhoden.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: Display either date part or time part in LOCAL format

2009-07-05 Thread mmalc Crawford


On Jul 5, 2009, at 12:21 AM, Jacob Rhoden wrote:

I am probably overlooking something obvious (I hope) but what is the  
proper way to convert. either the Date or Time part of an NSDate to  
a localised string? I know I can do the following but its not  
exactly localised :(

NSDate *now = [[NSDate alloc] init];
NSDateFormatter *localDate = [[NSDateFormatter alloc] init];
[localDate setDateFormat:@"-MM-dd"];
NSString *date = [localDate stringFromDate:now];


What do you mean by "it's not exactly localised"?
If you specify a format string that has localisable components, you'll  
see them, e.g.


NSDate *now = [[NSDate alloc] init];

	NSLocale *locale = [[NSLocale alloc]  
initWithLocaleIdentifier:@"ar_OM"];


NSDateFormatter *localDate = [[NSDateFormatter alloc] init];
[localDate setLocale:locale];
[localDate setDateFormat:@"/MMM/dd"];
NSString *date = [localDate stringFromDate:now];

date: ٢٠٠٩/يوليو/٠٥

(Note that the date separator is "/".)

Typically you're encouraged to use styles rather than specifying the  
format directly, since this takes the user's preferences into account  
-- see .


mmalc


___

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: Yet another memory management question

2009-07-05 Thread Benjamin Dobson


On 5 Jul 2009, at 05:10:12, mmalc Crawford wrote:

If you manipulate an instance variable anywhere other than in an  
initialiser or a dealloc method, you should use a suitable accessor  
method.


Does this apply to instance variables that are not objects too?
___

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: Yet another memory management question

2009-07-05 Thread Ricky Sharp


On Jul 5, 2009, at 4:02 AM, Benjamin Dobson wrote:



On 5 Jul 2009, at 05:10:12, mmalc Crawford wrote:

If you manipulate an instance variable anywhere other than in an  
initialiser or a dealloc method, you should use a suitable accessor  
method.


Does this apply to instance variables that are not objects too?



Yes.

___
Ricky A. Sharp mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.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: Movable Document Modal Dialogs

2009-07-05 Thread Fritz Anderson

On 4 Jul 2009, at 5:41 PM, Matt Neuburg wrote:

It is a delightful, yet little-known, fact that sheets can emerge  
from *anywhere* on a window - not merely from its top. ... This is  
unusual but only because (IMHO) not enough developers take advantage  
of this feature!


More would take advantage if they knew. It's an NSWindow delegate  
method called window:willPositionSheet:usingRect:.


— F

___

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

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

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

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


Re: Yet another memory management question

2009-07-05 Thread DKJ

On 4-Jul-09, at 21:53 , mmalc Crawford wrote:

Use of accessor methods is described plainly here:



If I understand this example correctly, I could do the same thing like  
this:


Header:
   NSNumber *count;
   ...
   @property(retain,readwrite) NSNumber *count;

Implementation:
   @synthesize count;
   ...
   (void)dealloc {
  [count release];
   }

This would automatically create the two accessor methods described in  
this section of the docs. Then whenever I want to do something with  
the variable, I do things like this:


   NSInteger otherVar = [self.count integerValue];
   self.count = [NSNumber numberWithInteger:0];

Have I finally got it right?

dkj

___

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


Wrap to Page method

2009-07-05 Thread vince
Can someone point me to documentation that refers to methods that control
Wrap to Page and Wrap to Window functions for a standard text editor?
thanks.

v.
___

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: Yet another memory management question

2009-07-05 Thread Shawn Erickson
On Sun, Jul 5, 2009 at 7:01 AM, DKJ wrote:

> Have I finally got it right?

Your dealloc method must include [super dealloc]; at the end of it.

-Shawn
___

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

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

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

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


Re: Yet another memory management question

2009-07-05 Thread Michael Ash
On Sun, Jul 5, 2009 at 12:10 AM, mmalc Crawford wrote:
>> Both are fine, but I would suggest something like the following, just
>> because it avoids code duplication:
>> - (void)viewDidUnload
>> {
>>   [self dispose];
>> }
>>
>
> It is not clear here what is the benefit of "avoiding code duplication" --
> you're simply introducing another method that you have to keep track of.

It's the same benefit as anywhere else. You have two places,
viewDidUnload and dealloc, which perform the exact same action. Rather
than have identical code in both places, where it bloats up your code
and can fall out of sync, you put that code into a separate method,
then call it from the two places where it needs to happen. This is
pretty basic programming.

Mike
___

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: Wrap to Page method

2009-07-05 Thread Michael Ash
On Sun, Jul 5, 2009 at 10:02 AM, vince wrote:
> Can someone point me to documentation that refers to methods that control
> Wrap to Page and Wrap to Window functions for a standard text editor?

I assume you're referring to these options in TextEdit. TextEdit is
provided as sample code by Apple (/Developer/Examples/AppKit/TextEdit/
on my machine) so you can just look at that and see how they did it.

Mike
___

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: Yet another memory management question

2009-07-05 Thread mmalc Crawford


On Jul 5, 2009, at 8:23 AM, Michael Ash wrote:


It's the same benefit as anywhere else. You have two places,
viewDidUnload and dealloc, which perform the exact same action.


They do not perform the "exact same action".
In dealloc, you obviously relinquish ownership of all objects you own  
(and perhaps other resources).
In viewDidUnload, you relinquish ownership of only those items that  
you can recreate later, if the view is loaded again.  You typically do  
not, for example, relinquish ownership of any model objects.


I *personally* suspect I'd find it easier to do a straightforward pass  
of each method to ensure they're correct rather than having to  
remember to create/update/check some other non-standard method each  
time I change the properties.  YMMV.


mmalc

___

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


Convenience initialisers

2009-07-05 Thread DKJ
I'm trying to write one of those convenient class initialisers for one  
of my objects. On my still-incomplete understanding of these matters,  
this is what I need to have:


Header:

   + (MyObject *)myObject;

Implementation:

   + (MyObject *)myObject
   {
  return [[[self alloc] init] autorelease];
   }

(I'd have the usual init method in here as well, of course.)

Have I done this correctly? (My programme is crashing, but there are  
plenty of other mistakes I may have made.)


I've been looking in the docs for an explicit example of this kind of  
initialiser, but haven't found one yet.


dkj
___

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: Convenience initialisers

2009-07-05 Thread Dimitri Bouniol

You can't tell 'self' to be allocated. Try this instead:


+ (MyObject *)myObject
  {
 return [[[MyObject alloc] init] autorelease];
  }



On Jul 5, 2009, at 10:40 AM, DKJ wrote:

I'm trying to write one of those convenient class initialisers for  
one of my objects. On my still-incomplete understanding of these  
matters, this is what I need to have:


Header:

  + (MyObject *)myObject;

Implementation:

  + (MyObject *)myObject
  {
 return [[[self alloc] init] autorelease];
  }

(I'd have the usual init method in here as well, of course.)

Have I done this correctly? (My programme is crashing, but there are  
plenty of other mistakes I may have made.)


I've been looking in the docs for an explicit example of this kind  
of initialiser, but haven't found one yet.


dkj
___

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/dimitri008%40mac.com

This email sent to dimitri...@mac.com


--
定魅刀利
Dimitri Bouniol
dimitri...@mac.com
http://www.appkainime.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: Convenience initialisers

2009-07-05 Thread Chris Hanson
You absolutely can (and should!) send +alloc to self in a class method  
like this. In a class method, "self" represents the class, not an  
instance of the class.


This is one reason it's important not to refer to class methods as  
"static methods," as less dynamic languages do. In Objective-C, all  
method dispatch is dynamic, even to classes, and is subject to override.


  -- Chris

On Jul 5, 2009, at 10:47 AM, Dimitri Bouniol  wrote:


You can't tell 'self' to be allocated.

___

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: Convenience initialisers

2009-07-05 Thread Ken Thomases

On Jul 5, 2009, at 12:40 PM, DKJ wrote:

I'm trying to write one of those convenient class initialisers for  
one of my objects. On my still-incomplete understanding of these  
matters, this is what I need to have:


Header:

  + (MyObject *)myObject;

Implementation:

  + (MyObject *)myObject
  {
 return [[[self alloc] init] autorelease];
  }

(I'd have the usual init method in here as well, of course.)

Have I done this correctly?


Yup.


I've been looking in the docs for an explicit example of this kind  
of initialiser, but haven't found one yet.


I don't find one, either.  Just so you're aware, such methods are also  
called "convenience constructors" or "class factory methods".  You  
might file a bug on the documentation requesting an example  
implementation.



On Jul 5, 2009, at 12:47 PM, Dimitri Bouniol wrote:


You can't tell 'self' to be allocated. Try this instead:


You can when "self" is a class object.  In fact, you should message  
self rather than the hard-coded class name in such a convenience  
constructor.  That way, if the method is invoked on a subclass it  
still allocated the correct kind of object.  (Consider, for example,  
the +string... methods of NSString, as sent to NSMutableString.)


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


Re: Convenience initialisers

2009-07-05 Thread Dimitri Bouniol

My mistake haha. 
I guess you learn something new everyday.

On Jul 5, 2009, at 10:55 AM, Chris Hanson wrote:

You absolutely can (and should!) send +alloc to self in a class  
method like this. In a class method, "self" represents the class,  
not an instance of the class.


This is one reason it's important not to refer to class methods as  
"static methods," as less dynamic languages do. In Objective-C, all  
method dispatch is dynamic, even to classes, and is subject to  
override.


 -- Chris

On Jul 5, 2009, at 10:47 AM, Dimitri Bouniol   
wrote:



You can't tell 'self' to be allocated.

___

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: Convenience initialisers

2009-07-05 Thread Andy Lee


On Jul 5, 2009, at 1:40 PM, DKJ wrote:

I'm trying to write one of those convenient class initialisers for  
one of my objects. On my still-incomplete understanding of these  
matters, this is what I need to have:


Header:

  + (MyObject *)myObject;

Implementation:

  + (MyObject *)myObject
  {
 return [[[self alloc] init] autorelease];
  }

(I'd have the usual init method in here as well, of course.)


The code above is fine.

Have I done this correctly? (My programme is crashing, but there are  
plenty of other mistakes I may have made.)


If your code is crashing, avoid guessing as much as possible.  *What*  
is the exception?  *Where* is it crashing (run the program in the  
debugger to see the line of code and the stack trace)?  If you put a  
breakpoint a little before executing that line step through with the  
debugger, do all your variables have the values you expect?


Frequent causes of crashes are uninitialized *local* variables  
(*instance* variables are initialized to nil or 0), and over- 
releasing.  To test for over-releasing, use NSZombieEnabled (easy to  
Google).


But avoid guessing.

--Andy


___

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 sum numbers using NSTableView?

2009-07-05 Thread Sebastijan Bauman

Hi everyone.

I am using NSTableView and Core Data and would like to sum numbers  
from two columns and show the sum in third column for every row. Like  
this:


http://www.shrani.si/f/3r/5h/4MNSm4Th/1/picture-2.png

what is the easiest way to do this?
is there a way to do this in Table Column Bindings / Value  
Transformers (like we do for @sum, @count, etc.) or maybe in  
xcdatamodel?


thanks for help in advance!
___

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: Switching Contents of NSView

2009-07-05 Thread Pierce Freeman
I. Savant

Depending on the method in which you suggest, I may know how to use load the
nib - but I'll take a look at the link.  And for the NSView function that
you suggested, does this replace all the subviews in that view as I will
most likely have more then one?


On 7/5/09 3:21 PM, "I. Savant"  wrote:

> On Jul 5, 2009, at 6:18 PM, Pierce Freeman wrote:
> 
>> I am making an application that has a choice of what function the
>> user wants
>> to perform.  When the user clicks on their choice, I want a NSView
>> to take
>> on the contents of a specific nib file.  I assume there must be a way
>> (hopefully) easy that this is accomplished with, as most
>> applications must
>> do something like this with their user interface.
> 
> 
>Do you need help figuring out how to load the NIB[1], replace the
> view[2], or both?
> 
> 1 - http://cocoadevcentral.com/articles/64.php
> 2 - -[NSView replaceSubview:with:] -
> http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classe
> s/nsview_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/replaceSubvi
> ew:with:
> 
> 
> --
> I.S.
> 
> 
> 
> 


___

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: Switching Contents of NSView

2009-07-05 Thread I. Savant

On Jul 5, 2009, at 6:30 PM, Pierce Freeman wrote:


And for the NSView function that
you suggested, does this replace all the subviews in that view as I  
will

most likely have more then one?


  Read the documentation. It replaces the view you specify with the  
other view you specify. Put each group in their own container views,  
then only swap the containers ...


--
I.S.


___

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: Switching Contents of NSView

2009-07-05 Thread I. Savant

On Jul 5, 2009, at 6:31 PM, I. Savant wrote:

 Read the documentation. It replaces the view you specify with the  
other view you specify. Put each group in their own container views,  
then only swap the containers ...


  ... to be specific, you'll tell the *parent* view (in which you're  
swapping subviews) to -swapView:withView: between the two containers.


--
I.S.




___

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: Switching Contents of NSView

2009-07-05 Thread I. Savant

On Jul 5, 2009, at 6:18 PM, Pierce Freeman wrote:

I am making an application that has a choice of what function the  
user wants
to perform.  When the user clicks on their choice, I want a NSView  
to take

on the contents of a specific nib file.  I assume there must be a way
(hopefully) easy that this is accomplished with, as most  
applications must

do something like this with their user interface.



  Do you need help figuring out how to load the NIB[1], replace the  
view[2], or both?


1 - http://cocoadevcentral.com/articles/64.php
2 - -[NSView replaceSubview:with:] - 
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/nsview_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/replaceSubview:with:


--
I.S.




___

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


Switching Contents of NSView

2009-07-05 Thread Pierce Freeman
Hi Everyone:

I am making an application that has a choice of what function the user wants
to perform.  When the user clicks on their choice, I want a NSView to take
on the contents of a specific nib file.  I assume there must be a way
(hopefully) easy that this is accomplished with, as most applications must
do something like this with their user interface.


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: Switching Contents of NSView

2009-07-05 Thread Pierce Freeman
That makes sense - I'll definitely try that!  And just asking, but from the
first link you sent, what does this return?  [NSBundle
loadNibNamed:@"someNibFile" owner:d];  My assumption is that it's not a
view.


On 7/5/09 3:31 PM, "I. Savant"  wrote:

> On Jul 5, 2009, at 6:30 PM, Pierce Freeman wrote:
> 
>> And for the NSView function that
>> you suggested, does this replace all the subviews in that view as I
>> will
>> most likely have more then one?
> 
>Read the documentation. It replaces the view you specify with the
> other view you specify. Put each group in their own container views,
> then only swap the containers ...
> 
> --
> I.S.
> 
> 


___

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: Switching Contents of NSView

2009-07-05 Thread I. Savant

On Jul 5, 2009, at 6:42 PM, Pierce Freeman wrote:

That makes sense - I'll definitely try that!  And just asking, but  
from the

first link you sent, what does this return?  [NSBundle
loadNibNamed:@"someNibFile" owner:d];  My assumption is that it's  
not a

view.


  Come on, you're not even trying. Look the method up in the  
*documentation* to find out what it returns. That's what it's there for.


--
I.S.


___

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: Switching Contents of NSView

2009-07-05 Thread Pierce Freeman
You're right, I was looking in the wrong place.  A good Google search
(versus the built in documentation) did the trick.  For future reference,
it's under "NSBundle Additions" versus the plain "NSBundle".


On 7/5/09 3:45 PM, "I. Savant"  wrote:

> On Jul 5, 2009, at 6:42 PM, Pierce Freeman wrote:
> 
>> That makes sense - I'll definitely try that!  And just asking, but
>> from the
>> first link you sent, what does this return?  [NSBundle
>> loadNibNamed:@"someNibFile" owner:d];  My assumption is that it's
>> not a
>> view.
> 
>Come on, you're not even trying. Look the method up in the
> *documentation* to find out what it returns. That's what it's there for.
> 
> --
> I.S.
> 
> 


___

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 to sum numbers using NSTableView?

2009-07-05 Thread Quincey Morris

On Jul 5, 2009, at 07:43, Sebastijan Bauman wrote:

I am using NSTableView and Core Data and would like to sum numbers  
from two columns and show the sum in third column for every row.  
Like this:


http://www.shrani.si/f/3r/5h/4MNSm4Th/1/picture-2.png

what is the easiest way to do this?
is there a way to do this in Table Column Bindings / Value  
Transformers (like we do for @sum, @count, etc.) or maybe in  
xcdatamodel?


There are multiple ways of doing this, of course. Here's a fairly easy  
way, assuming your core data row objects are a custom subclass of  
NSManagedObject:


1. Add a new method to your subclass:

...
@property (readonly) int sumOf1And2; // or whatever numeric return  
type you want


...
- (int) sumOf1And2 {
	return self.value1 + self.value2; // assuming you have custom  
accessors for the first 2 column values, or use 'valueForKey:' if not

}

2. Also add to your subclass a dependency on the component values:

+ (NSSet*) keyPathsForValuesAffectingSumOf1And2 {
	return [NSSet setWithObjects: @"value1", @"value2", nil]; // but use  
the correct property names

}

This is necessary to make "sumOf1And2" properly KVO-compliant.

3. Bind your table's 3rd column to the property "sumOf1And2".

That's all it should take.

(All code written in Mail and untried.)


___

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: Switching Contents of NSView

2009-07-05 Thread Kiel Gillard
If you are suggesting Google was the right place to look,  
unfortunately you are mistaken.


Directly underneath the toolbar of the documentation window should be  
a scope bar that attempts to help you find the information you're  
looking for. Perhaps you're searching the documentation by Title  
instead of by API? If I search by API and type "loadNibNamed" I  
immediately get the NSBundle Additions API, however if I search by  
Title I get nothing.


Hope this helps,

Kiel

On 06/07/2009, at 8:55 AM, Pierce Freeman wrote:


You're right, I was looking in the wrong place.  A good Google search
(versus the built in documentation) did the trick.  For future  
reference,

it's under "NSBundle Additions" versus the plain "NSBundle".


On 7/5/09 3:45 PM, "I. Savant"  wrote:


On Jul 5, 2009, at 6:42 PM, Pierce Freeman wrote:


That makes sense - I'll definitely try that!  And just asking, but
from the
first link you sent, what does this return?  [NSBundle
loadNibNamed:@"someNibFile" owner:d];  My assumption is that it's
not a
view.


  Come on, you're not even trying. Look the method up in the
*documentation* to find out what it returns. That's what it's there  
for.


--
I.S.





___

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: Switching Contents of NSView

2009-07-05 Thread Pierce Freeman
I am finally reverting to using NSView's replaceSubview:with: command.  The
only problem is that when I run this command partnered with addSubview, it
removes the view from the window where I placed it originally.  This is
problematic when I try to go back and forth between views as the application
can no longer find the view and then crashes.  Any suggestions?


On 7/5/09 3:21 PM, "I. Savant"  wrote:

> On Jul 5, 2009, at 6:18 PM, Pierce Freeman wrote:
> 
>> I am making an application that has a choice of what function the
>> user wants
>> to perform.  When the user clicks on their choice, I want a NSView
>> to take
>> on the contents of a specific nib file.  I assume there must be a way
>> (hopefully) easy that this is accomplished with, as most
>> applications must
>> do something like this with their user interface.
> 
> 
>Do you need help figuring out how to load the NIB[1], replace the
> view[2], or both?
> 
> 1 - http://cocoadevcentral.com/articles/64.php
> 2 - -[NSView replaceSubview:with:] -
> http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classe
> s/nsview_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/replaceSubvi
> ew:with:
> 
> 
> --
> I.S.
> 
> 
> 
> 


___

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: Switching Contents of NSView

2009-07-05 Thread Pierce Freeman
Kiel:

Wasn't suggesting Google is always the right place to look, but in this case
it just happened to find it right away.  And just checked my preferences,
and it did in fact have title selected.  Will have to change that...


On 7/5/09 4:25 PM, "Kiel Gillard"  wrote:

> If you are suggesting Google was the right place to look,
> unfortunately you are mistaken.
> 
> Directly underneath the toolbar of the documentation window should be
> a scope bar that attempts to help you find the information you're
> looking for. Perhaps you're searching the documentation by Title
> instead of by API? If I search by API and type "loadNibNamed" I
> immediately get the NSBundle Additions API, however if I search by
> Title I get nothing.
> 
> Hope this helps,
> 
> Kiel
> 
> On 06/07/2009, at 8:55 AM, Pierce Freeman wrote:
> 
>> You're right, I was looking in the wrong place.  A good Google search
>> (versus the built in documentation) did the trick.  For future
>> reference,
>> it's under "NSBundle Additions" versus the plain "NSBundle".
>> 
>> 
>> On 7/5/09 3:45 PM, "I. Savant"  wrote:
>> 
>>> On Jul 5, 2009, at 6:42 PM, Pierce Freeman wrote:
>>> 
 That makes sense - I'll definitely try that!  And just asking, but
 from the
 first link you sent, what does this return?  [NSBundle
 loadNibNamed:@"someNibFile" owner:d];  My assumption is that it's
 not a
 view.
>>> 
>>>   Come on, you're not even trying. Look the method up in the
>>> *documentation* to find out what it returns. That's what it's there
>>> for.
>>> 
>>> --
>>> I.S.
>>> 
>>> 
>> 
>> 
>> ___
>> 
>> 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: Possible NSPredicateEditor bug (found workaround)

2009-07-05 Thread Tom


On 03/07/2009, at 12:26 PM, Tom wrote:


Hi everyone,

I'm either doing something wrong, or I've found a bug in  
NSPredicateEditor.


Whenever I use setObjectValue: on the NSPredicateEditor, it displays  
the new predicate, but if I change a couple of the operators (is,  
contains, begins with, etc) the text fields on the rows disappear.


Screenshot: http://www.tomdalling.com/wp-content/Picture-1.png
Demo project: http://www.tomdalling.com/wp-content/PredicateEditorBug.zip

Here is the relevant code:

-(IBAction) setPredicateEditorObjectValue:(id)sender
{

	NSPredicate* single = [NSPredicate predicateWithFormat:@"name ==  
'test'"];


NSMutableArray* subpredicates = [NSMutableArray array];
[subpredicates addObject:[[single copy] autorelease]];
[subpredicates addObject:[[single copy] autorelease]];
[subpredicates addObject:[[single copy] autorelease]];
[subpredicates addObject:[[single copy] autorelease]];  

	NSPredicate* compound = [NSCompoundPredicate  
orPredicateWithSubpredicates:subpredicates];


[m_predicateEditor setObjectValue:compound];

}

Am I doing something wrong?

--Tom



For anyone having the same problem, here is the workaround I've  
discovered. It's not the most elegant solution, but it works.


1. Set the NSPredicateEditor's target/action to an IBAction on your  
controller

2. Put this code in the controller's IBAction method:

NSPredicate* objectValue = [[[m_predEditor objectValue] retain]  
autorelease];

[m_predEditor setObjectValue:nil];
[m_predEditor setObjectValue:objectValue];

--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: Switching Contents of NSView

2009-07-05 Thread Andy Lee

Make sure you heed this part of the documentation:

This method causes oldView to be released; if you plan to reuse it,  
be sure to retain it before sending this message and to release it  
as appropriate when adding it as a subview of another NSView.




--Andy

On Jul 5, 2009, at 7:26 PM, Pierce Freeman wrote:

I am finally reverting to using NSView's replaceSubview:with:  
command.  The
only problem is that when I run this command partnered with  
addSubview, it
removes the view from the window where I placed it originally.  This  
is
problematic when I try to go back and forth between views as the  
application

can no longer find the view and then crashes.  Any suggestions?


On 7/5/09 3:21 PM, "I. Savant"  wrote:


On Jul 5, 2009, at 6:18 PM, Pierce Freeman wrote:


I am making an application that has a choice of what function the
user wants
to perform.  When the user clicks on their choice, I want a NSView
to take
on the contents of a specific nib file.  I assume there must be a  
way

(hopefully) easy that this is accomplished with, as most
applications must
do something like this with their user interface.



  Do you need help figuring out how to load the NIB[1], replace the
view[2], or both?

1 - http://cocoadevcentral.com/articles/64.php
2 - -[NSView replaceSubview:with:] -
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classe
s/nsview_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/ 
replaceSubvi

ew:with:


--
I.S.







___

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/aglee%40mac.com

This email sent to ag...@mac.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: Switching Contents of NSView

2009-07-05 Thread Pierce Freeman
Once again, I fail when the documentation succeeds.  I¹ll have to work on my
documentation reading skills over the next week or so.


On 7/5/09 4:33 PM, "Andy Lee"  wrote:

> Make sure you heed this part of the documentation:
> 
>> This method causes oldView to be released; if you plan to reuse it, be sure
>> to retain it before sending this message and to release it as appropriate
>> when adding it as a subview of another NSView.
> 
> 
> --Andy
> 
> On Jul 5, 2009, at 7:26 PM, Pierce Freeman wrote:
> 
>> I am finally reverting to using NSView's replaceSubview:with: command.  The
>> only problem is that when I run this command partnered with addSubview, it
>> removes the view from the window where I placed it originally.  This is
>> problematic when I try to go back and forth between views as the application
>> can no longer find the view and then crashes.  Any suggestions?
>> 
>> 
>> On 7/5/09 3:21 PM, "I. Savant"  wrote:
>> 
>>> On Jul 5, 2009, at 6:18 PM, Pierce Freeman wrote:
>>> 
 I am making an application that has a choice of what function the
 user wants
 to perform.  When the user clicks on their choice, I want a NSView
 to take
 on the contents of a specific nib file.  I assume there must be a way
 (hopefully) easy that this is accomplished with, as most
 applications must
 do something like this with their user interface.
>>> 
>>> 
>>>Do you need help figuring out how to load the NIB[1], replace the
>>> view[2], or both?
>>> 
>>> 1 - http://cocoadevcentral.com/articles/64.php
>>> 2 - -[NSView replaceSubview:with:] -
>>> http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Clas
>>> se
>>> s/nsview_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/replaceSub
>>> vi
>>> ew:with:
>>> 
>>> 
>>> --
>>> I.S.
>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> ___
>> 
>> 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/aglee%40mac.com
>> 
>> This email sent to ag...@mac.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: Switching Contents of NSView

2009-07-05 Thread Joel Norvell

Pierce,

As an adjunct to "document reading skills," I've found that there's no 
substitute for a class browser.

Andy Lee has written Appkido, an excellent class browser for Cocoa!

http://homepage.mac.com/aglee/downloads/appkido.html

There are other ways to browse the Cocoa class hierarchy, but Appkido is my 
favorite :-)  Thanks Andy!!

Yours in Cocoa,
Joel




  
___

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: Switching Contents of NSView

2009-07-05 Thread Pierce Freeman
Joel:

Thanks for the link - I'll definitely check it out.


On 7/5/09 6:50 PM, "Joel Norvell"  wrote:

> 
> Pierce,
> 
> As an adjunct to "document reading skills," I've found that there's no
> substitute for a class browser.
> 
> Andy Lee has written Appkido, an excellent class browser for Cocoa!
> 
> http://homepage.mac.com/aglee/downloads/appkido.html
> 
> There are other ways to browse the Cocoa class hierarchy, but Appkido is my
> favorite :-)  Thanks Andy!!
> 
> Yours in Cocoa,
> Joel
> 
> 
> 
> 
>   


___

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: Movable Document Modal Dialogs

2009-07-05 Thread Matt Neuburg
On Sun, 5 Jul 2009 08:52:12 -0500, Fritz Anderson 
said:
>On 4 Jul 2009, at 5:41 PM, Matt Neuburg wrote:
>
>> It is a delightful, yet little-known, fact that sheets can emerge
>> from *anywhere* on a window - not merely from its top. ... This is
>> unusual but only because (IMHO) not enough developers take advantage
>> of this feature!
>
>More would take advantage if they knew. It's an NSWindow delegate
>method called window:willPositionSheet:usingRect:.

Sure - I *said* it was little-known. But the *information* isn't hard to
find; there's a chapter of the Sheet Programming Guide devoted to this
point:

http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/Sheets.html

It's the chapter called "Positioning Sheets". It's hard to get more up front
than that. m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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: Sorting an editable tableView of managed object

2009-07-05 Thread Matt Neuburg
On Sat, 04 Jul 2009 21:12:13 -0500, Steve Cronin 
said:
>I didn't add the binding because I only want to add bindings when I
>understand the value of doing so.

I was commenting on your comment ("no binding", you said, so I said "why
not?"). Bindings are just a fancy way of assigning a value to something; you
don't need the binding. You can assign the sortDescriptor directly. In fact,
you probably don't even need the sortDescriptor, if the default was working
correctly for you. The key part of what I said is "rearrangeObjects". m.
 
-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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 Applespell.service fail to launch?

2009-07-05 Thread shuang qin
Hi, Dave,
Thanks for your response. This sample code normally works well in most
cases.
Is Applespell.service launched by [[NSSpellChecker sharedSpellChecker] ? or
launched automatically by a NSTextView?
I guess the problem in our application might be caused by library conflict
but I do not know how to check it. Our application is a normal cocoa app.

2009/7/3 Dave Keck 

> This code works just fine for me:
>
>NSLog(@"%@", NSStringFromRange([[NSSpellChecker
> sharedSpellChecker] checkSpellingOfString: @"hello, hwo are you
> today?" startingAt: 0]));
>
> Which prints '{7, 3}', as expected. I'll go out on a limb and guess
> that you're trying to access the spell checker from an atypical
> context. Is this code failing in a bread-and-butter Cocoa app launched
> from the Finder? Or are you doing something fancy like, say, writing a
> launchd daemon or agent or something other than a 'normal' Cocoa app?
>
> 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


Not receiving notifications on NSArrayController selection changes

2009-07-05 Thread Ken Tozier

Hi

I have an NSArrayController bound to an NSArray and am not getting  
notifications either through my "setXXX method or through explicit  
"addObserver" links.


The property in my class is defined like so:

@interface PMXMainPaletteToolbar : NSView
{
IBOutletNSPopUpButton   *site;

NSDictionary*siteRecords;

NSString*currentSite;

NSArrayController   *siteController;
}


The array controller is initialized like so

- (void) initTools
{
	siteRecords			= [[PMInterfaceController invocation]  
invokeWithSelector: @"get_sites_simple" arguments: @""];
	siteController		= [[NSArrayController alloc] initWithContent:  
siteRecords];


	// bind popup content to array controller array (This works. Popup is  
populated correctly)
	[site bind: @"content" toObject: siteController withKeyPath:  
@"arrangedObjects.name" options: nil];


	// even though class has a currentSite property, a currentSite method  
and a setCurrentSite method
	// the setCurrentSite method is never called when bound to the array  
controller
	[self bind: @"currentSite" toObject: siteController withKeyPath:  
@"selection.name" options: nil];


	// When above binding failed, I  tried to explicitly define a  
listener to the "selection" and "selectionIndexes" property of  
siteController

// but neither observer gets called in response to menu selections.
[siteController addObserver: self
forKeyPath: @"selectionIndexes"
options: NSKeyValueObservingOptionOld | 
NSKeyValueObservingOptionNew
context: NULL];

	// When both of those failed, I tried to listen for the selectedValue  
of the popup

[site addObserver: self
forKeyPath: @"selectedValue"
options: NSKeyValueObservingOptionOld | 
NSKeyValueObservingOptionNew
context: NULL];

// that failed as well. My "observeValueForKeyPath" is never called.
}

So the question is, how the heck does one get real time notifications  
to user selections in a popup menu?


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


Solved: Not receiving notifications on NSArrayController selection changes

2009-07-05 Thread Ken Tozier

Never mind. I figured it out.


On Jul 5, 2009, at 11:58 PM, Ken Tozier wrote:


Hi

I have an NSArrayController bound to an NSArray and am not getting  
notifications either through my "setXXX method or through explicit  
"addObserver" links.


The property in my class is defined like so:

@interface PMXMainPaletteToolbar : NSView
{
IBOutletNSPopUpButton   *site;

NSDictionary*siteRecords;

NSString*currentSite;

NSArrayController   *siteController;
}


The array controller is initialized like so

- (void) initTools
{
	siteRecords			= [[PMInterfaceController invocation]  
invokeWithSelector: @"get_sites_simple" arguments: @""];
	siteController		= [[NSArrayController alloc] initWithContent:  
siteRecords];


	// bind popup content to array controller array (This works. Popup  
is populated correctly)
	[site bind: @"content" toObject: siteController withKeyPath:  
@"arrangedObjects.name" options: nil];


	// even though class has a currentSite property, a currentSite  
method and a setCurrentSite method
	// the setCurrentSite method is never called when bound to the  
array controller
	[self bind: @"currentSite" toObject: siteController withKeyPath:  
@"selection.name" options: nil];


	// When above binding failed, I  tried to explicitly define a  
listener to the "selection" and "selectionIndexes" property of  
siteController

// but neither observer gets called in response to menu selections.
[siteController addObserver: self
forKeyPath: @"selectionIndexes"
			options: NSKeyValueObservingOptionOld |  
NSKeyValueObservingOptionNew

context: NULL];

	// When both of those failed, I tried to listen for the  
selectedValue of the popup

[site addObserver: self
forKeyPath: @"selectedValue"
			options: NSKeyValueObservingOptionOld |  
NSKeyValueObservingOptionNew

context: NULL];

// that failed as well. My "observeValueForKeyPath" is never called.
}

So the question is, how the heck does one get real time  
notifications to user selections in a popup menu?


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/kentozier%40comcast.net

This email sent to kentoz...@comcast.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


NSTableview - tableView:heightOfRow: not behaving

2009-07-05 Thread Alex Holland

Hi,

I'm running X-Code 3.1.3 on OS X 10.5.7, Intel Macbook. As a means of  
getting the hang of Cocoa, and having some fun at the same time, I've  
been building a simple Desktop Twitter Client.


I've previously worked through Hillegass' excellent Cocoa book.  
Building on his example of using Amazon XML Data, I've managed to  
download the status update XML from Twitter and have it displaying in  
an NSTableView, using my AppController class to parse the XML as a  
data source. This works a treat, but as different Tweets are of  
different lengths, I wanted to implement variable row heights.


I've made my AppController class a delegate of the NSTableView (it is  
also acting as the Data Source), and implemented the  
tableView:heightOfRow: delegate method as follows:


- (CGFloat)tableView:(NSTableView *)tv heightOfRow:(NSInteger)row
{
// Get second column (index 1 - status text)
// (first column, index 0,  is Twitter profile pic)
NSTableColumn *column = [[tv tableColumns] objectAtIndex:1];
// Get text cell from second column for row
NSCell *cell = [column dataCellForRow:row];
	// Calculate height using cellSizeForBounds, limiting it to width of  
column.

// Adding 10 pixels for padding.
float height = [cell cellSizeForBounds:
NSMakeRect(0.0, 0.0, [column 
width], 1000.0)].height+10.0;
	// Profile pics are 48x48, so ensure size is at least 58px to allow  
some padding

height = MAX(height,58.0);
return height;
}

Note that I've already set Wrap etc in Interface Builder. This works,  
but suffers from a fair amount of graphical corruption. Each row  
appears to draw itself with the correct height, but if one row is  
particularly tall the next row down is prone to overlap slightly, as  
if it's origin is not being updated by the increased height of the  
previous row. This results in text collision.


Best illustrated with a picture: http://twitpic.com/9fzeq

The issue here is not that the row height is too low - if I set  
tableView:heightOfRow: to return a constant, deliberately too low  
value (48.0 in this example), then the cell contents are simply  
truncated and no text collision occurs.


Picture of this: http://twitpic.com/9fzqy

Further experimentation with tableView:heightOfRow: shows that  
provided the value returned is constant, it has no problem tiling the  
rows, but if the value varies (I wrote a toy program randomly  
generating row heights in the range 48..80), then this kind of  
collision occurs. Given as the whole point in this method is to  
support differing row heights, I find this a bit odd.


So, am I doing something obviously wrong, or is this a problem with  
Cocoa itself?


Cheers in advance,

Alex
___

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: Switching Contents of NSView

2009-07-05 Thread Eagle Offshore
If I'm doing a lot of swapping of a limited number of views, I stick  
them in a tabbed view with hidden tabs.


On Jul 5, 2009, at 3:18 PM, Pierce Freeman wrote:


Hi Everyone:

I am making an application that has a choice of what function the  
user wants
to perform.  When the user clicks on their choice, I want a NSView  
to take

on the contents of a specific nib file.  I assume there must be a way
(hopefully) easy that this is accomplished with, as most  
applications must

do something like this with their user interface.


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/eagleoffshore%40mac.com

This email sent to eagleoffsh...@mac.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: NSTableview - tableView:heightOfRow: not behaving

2009-07-05 Thread Quincey Morris

On Jul 5, 2009, at 17:06, Alex Holland wrote:


- (CGFloat)tableView:(NSTableView *)tv heightOfRow:(NSInteger)row
{
// Get second column (index 1 - status text)
// (first column, index 0,  is Twitter profile pic)
NSTableColumn *column = [[tv tableColumns] objectAtIndex:1];
// Get text cell from second column for row
NSCell *cell = [column dataCellForRow:row];
	// Calculate height using cellSizeForBounds, limiting it to width  
of column.

// Adding 10 pixels for padding.
float height = [cell cellSizeForBounds:
NSMakeRect(0.0, 0.0, [column 
width], 1000.0)].height+10.0;
	// Profile pics are 48x48, so ensure size is at least 58px to allow  
some padding

height = MAX(height,58.0);
return height;
}


You're assuming that the cell has the current text, but it doesn't.  
(It would be far too inefficient to set the cell to the row's data  
before every call to tableView:heightOfRow:. It only gets set to the  
correct data for the row just before being drawn.)


Instead, you should find the text directly from your data model (using  
'row'), measure it in some way that doesn't mess with the table view's  
internals (i.e. modifying its data cell is probably not a good idea,  
although I don't really know), and return the height from the that  
measurement. Note that this is likely to be kind of slow, in general,  
relative to the frequency with which this delegate method is called,  
so in a real app you'd probably consider caching the computed heights  
somehow.


The other thing wrong here (speaking from memory -- I haven't checked  
the documentation on this recently) is that it's generally a no-no to  
hard code column indexes. However, if you're getting the text from  
your data model anyway, you won't need the column at all.



___

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