Re: [Moderator] List Guidelines - Must Read

2008-06-27 Thread Jens Alfke


On 26 Jun '08, at 11:36 AM, Hamish Allan wrote:


What we really need is for the cocoa-dev list admin page to require
new subscribers to type in the phrase I will not make posts about the
iPhone or Snow Leopard :)


No, you've bought into the whole reality distortion field. What we  
_really_ need is for Apple to allow developer discussion of NDA'ed  
products. If there were an *Ph*n* mailing list on this server, and if  
that list were mentioned in the SDK or on the *Ph*n* developer home  
page, people would see it and go there to post. The list could be set  
up to require ADC membership to subscribe, so as to preserve the  
airtight confidentiality of all details of the *Ph*n* SDK.


Of course, this would have to be in some hypothetical parallel  
universe where the anonymous responsible personages at Apple actually  
understood the usefulness of the Internet and of allowing developers  
to talk with each other. In our universe, they remain mired in their  
bunker mentality, leaving it up to the longsuffering list admins like  
Scott to clean up after their shortsightedness.


—Jens [consider my wrist already 
slapped]___

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 [EMAIL PROTECTED]


Re: [Moderator] List Guidelines - Must Read

2008-06-27 Thread Omar Qazi


On Jun 26, 2008, at 11:01 PM, Jens Alfke wrote:
No, you've bought into the whole reality distortion field. What we  
_really_ need is for Apple to allow developer discussion of NDA'ed  
products. If there were an *Ph*n* mailing list on this server, and  
if that list were mentioned in the SDK or on the *Ph*n* developer  
home page, people would see it and go there to post. The list could  
be set up to require ADC membership to subscribe, so as to preserve  
the airtight confidentiality of all details of the *Ph*n* SDK.



Well I imagine this is going to happen soon anyway... July 11th isn't  
that far off anymore.


Until then perhaps you could emphasize this some more, like putting  
the little NDA boiler plate at the beginning of the welcome email. Or  
maybe even making it the subject.


Omar Qazi
Hello, Galaxy!
1.310.294.1593



smime.p7s
Description: S/MIME cryptographic signature
___

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 [EMAIL PROTECTED]

What does 'thread safe' mean?

2008-06-27 Thread Kevin Ferguson

Greetings,

I am not entirely sure as to what exactly a thread is, but seeing as  
anything I've ever programmed is light weight, I've never needed to  
worry before. And to be honest, such is still the case. This question  
is merely to satisfy my personal curiosity on the topic, and I can't  
seem to find a satisfactory answer through google.


Up until now, I just figured that something that wasn't thread safe  
would just crash if one attempted to access it from more than 1  
thread. (Or it'd just give you some unexpected results) Recently,  
however, I read something that seemed to indicate that trying to  
thread a non thread safe class/method could lead to slightly worse  
problems than a crash. (The article in question mentioned 'damage your  
computer')


So, when something is 'not thread safe', what exactly does it mean? In  
addition, if one tries to thread a non thread safe class, what can the  
expected results be?


Thanks!
-Kevin
___

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 [EMAIL PROTECTED]


Re: Newbie question: error in creating a NSData object using handle (Resource Management)

2008-06-27 Thread Kai


On 27.6.2008, at 05:00, Tran Kim Bach wrote:


Wow, thanks Ken a lot.
About the endian issues, I have a compatible swap function to  
convert data to Big-endian (and vice verse).

Then, I will correct big-endian issues.
I may know where the problem is.
When I read to your suggestion,

On Fri, Jun 27, 2008 at 6:11 AM, Ken Thomases [EMAIL PROTECTED]  
wrote:



data = [NSData dataWithBytes:*dataHandle length:sizeLong ];

  resID = [NSNumber numberWithShort:resIDShort];

if((type2 =='PREC')([resID intValue]== 302))

{

  struct PGControlRes pgControlRes;

memcpy(pgControlRes,[data bytes], [data length]);

Have you tested that the resource size is the same as the structure  
size?


I found out something.
Actually, I'm just trying to make a prototype in one fixed size of  
the same resource type.
I used to test on the same resource files with this fixed resource  
structure.
but in reality, in my application, the resource size for this  
type(PREC) is various for each resource file(.rsrc).
So, I think the struct caused my problem ( I never thought of it  
before).
By the way, I have a lot of structs of the same resource type(PREC  
for example) written in C,

Is there any way to still take advantage of them in Objective-C?


Absolutely. Objective-C is a superset of C, so you can use all C you’d  
ever like to use.


Code of you like
NSNumber* resID =   [NSNumber numberWithShort:resIDShort];
and later
[resID intValue]
is pretty unnecessary - unless you are going to use resID with some  
Cocoa message which expects an NSNumber.


Another tip: Handle locking (HLockHi, HUnlock) is a no op under Mac OS  
X and can be skipped.


Best
Kai

(I mean if I can use these C structs in Objective-C?, don't have to  
rewrite them using Objective-C language).

Thank you for your supports.

---(Bachtk


___

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 [EMAIL PROTECTED]


Re: What does 'thread safe' mean?

2008-06-27 Thread Andrew Farmer

On 26 Jun 08, at 23:50, Kevin Ferguson wrote:
I am not entirely sure as to what exactly a thread is, but seeing as  
anything I've ever programmed is light weight, I've never needed to  
worry before. And to be honest, such is still the case. This  
question is merely to satisfy my personal curiosity on the topic,  
and I can't seem to find a satisfactory answer through google.


Up until now, I just figured that something that wasn't thread safe  
would just crash if one attempted to access it from more than 1  
thread. (Or it'd just give you some unexpected results) Recently,  
however, I read something that seemed to indicate that trying to  
thread a non thread safe class/method could lead to slightly worse  
problems than a crash. (The article in question mentioned 'damage  
your computer')


The author of the article in question is either using hyperbole badly,  
or is smoking something. Improper threading hygiene will usually cause  
a crash if you're lucky, and silent data corruption if you're unlucky.  
This corruption should be limited to your application's data, though,  
and it certainly won't damage your computer in any way!



So, when something is 'not thread safe', what exactly does it mean?


In most environments, it simply means that it cannot be shared between  
threads. AppKit is a bit different, though - it has a concept of a  
main thread, which appears to be at least partially enforced at an  
operating-system level. As such, anything you see which isn't marked  
as thread-safe in Cocoa shouldn't be accessed from outside the main  
thread.


In addition, if one tries to thread a non thread safe class, what  
can the expected results be?


Unexpected results? :)

Could be anything, really, within certain bounds. See above.
___

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 [EMAIL PROTECTED]


Re: What does 'thread safe' mean?

2008-06-27 Thread Omar Qazi


On Jun 26, 2008, at 11:50 PM, Kevin Ferguson wrote:
I am not entirely sure as to what exactly a thread is, but seeing as  
anything I've ever programmed is light weight, I've never needed to  
worry before


And you don't need to worry now. If you don't know what a thread is,  
and therefore are presumably only using a single thread,  you really  
don't need to worry about making sure your code is thread safe.


Omar Qazi
Hello, Galaxy!
1.310.294.1593



smime.p7s
Description: S/MIME cryptographic signature
___

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 [EMAIL PROTECTED]

Re: What does 'thread safe' mean?

2008-06-27 Thread Uli Kusterer

Am 27.06.2008 um 09:27 schrieb Omar Qazi:

On Jun 26, 2008, at 11:50 PM, Kevin Ferguson wrote:
I am not entirely sure as to what exactly a thread is, but seeing  
as anything I've ever programmed is light weight, I've never needed  
to worry before


And you don't need to worry now. If you don't know what a thread is,  
and therefore are presumably only using a single thread,  you really  
don't need to worry about making sure your code is thread safe.



 The general theory and basics of threading are probably not quite on- 
topic for this mailing list. I'd suggest you just buy a book on the  
topic of threading and read it. It's an interesting topic, and a very  
useful tool.


 On the other hand, it can royally screw up things in your  
application if you don't plan ahead before you use threads. Moreover,  
threading bugs are hard to find, so you often think your code is OK,  
but then it crashes reliably on every other Mac, just not on your  
development Mac.


-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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 [EMAIL PROTECTED]


Re: What does 'thread safe' mean?

2008-06-27 Thread Jean-Daniel Dupas


Le 27 juin 08 à 10:02, Uli Kusterer a écrit :


Am 27.06.2008 um 09:27 schrieb Omar Qazi:

On Jun 26, 2008, at 11:50 PM, Kevin Ferguson wrote:
I am not entirely sure as to what exactly a thread is, but seeing  
as anything I've ever programmed is light weight, I've never  
needed to worry before


And you don't need to worry now. If you don't know what a thread  
is, and therefore are presumably only using a single thread,  you  
really don't need to worry about making sure your code is thread  
safe.



The general theory and basics of threading are probably not quite on- 
topic for this mailing list. I'd suggest you just buy a book on the  
topic of threading and read it. It's an interesting topic, and a  
very useful tool.


On the other hand, it can royally screw up things in your  
application if you don't plan ahead before you use threads.  
Moreover, threading bugs are hard to find, so you often think your  
code is OK, but then it crashes reliably on every other Mac, just  
not on your development Mac.



Yes, and it's also an import part in the creation of schroedinbugs (http://en.wikipedia.org/wiki/Heisenbug#Schroedinbugs 
) and other strange bugs.





smime.p7s
Description: S/MIME cryptographic signature
___

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 [EMAIL PROTECTED]

NSImageView and getting change events

2008-06-27 Thread Totte Alm

Hello Cocoa experts,

I've got a window, with a bunch of showable views, one contain an  
NSImageView. I need to inform my Controller when the user drops or  
pastes something into this NSImageView to reflect document changes and  
update my internal changes manager. This seems to be a less than  
trivial task as you cannot seem to set a delegate to the NSImageVIEW,  
nor is it documented anywhere what kind of Notifictions it will send  
when the image is changed, but I guess someone out there has figured  
out some way to do this without having to subclass or write an own  
class.


I have written other droppods for other file or data, but I would like  
to use the NSImageView as it does what it is supposed to do i all  
other respects.


Cheers,

// Totte
-
I never expected the Spanish Inquisition!

___

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 [EMAIL PROTECTED]


Suggestions on how to price an iPhone app for the app store which relies on a central server

2008-06-27 Thread Brian Tunning
Let me know if there is a more appropriate forum for this question -- this
Cocoa list was the best I could find, especially considering that I am not
one of the lucky few in the official iphone developer program, and do not
see any other avenues of getting my questions answered.


I'm developing an application for Cocoa  Cocoa Touch, which will
synchronize notes between a PC and Phone.  The system requires the use of a
centralized server, which store and manage the synchronization.
I want to sell the application through the AppStore, but am not sure of the
best way to deal with pricing, especially since if a user manages to defeat
the DRM in the AppStore, they would not only pirate the application, but
would cause me additional monthly charges in data storage, traffic, etc.


I have some options I'm considering, such as:

1. Price the application as free in the AppStore, and charge separately for
the synchronization service.  This means the iPhone app could be used to
write/edit notes (and save them locally on their phone), but would not be
able to synchronize them with another device until they get a
synchronization account.

I could offer the subscription elsewhere (eg, on google checkout), and once
the payment is verified, I would provision an account for the user.

This in my mind would be the safest way -- and also makes sense for other
scenarios in the future, such as if the end user doesn't have an iPhone, and
wants to synchronize notes between 2 or more Macs (thus there is no AppStore
for them).

Would Apple consider this a way of cheating their distribution model?


2. Price the application at $15 (for example), which would include 1 year of
service.

This would be the most convenient for the end-user, but I'm concerned about:

 - What happens when the 12 months expire, does the user need to purchase
the app again from the AppStore?  This would likely violate the AppStore
policies.

 - What happens if users are able to copy the app to another device/pirate
it.  I would have no way of knowing the difference between a paid user,
and one who pirated it. Unless Apple would provide developers with the
serial numbers of the devices who paid for the app, I really wouldn't know
who to kick off of the service.



I'm really not sure which way to go here -- it isn't very clear to me how
applications+service type apps should be sold  distributed under their
umbrella.

Any advice would be greatly appreciated.

thanks

-- 
-bri
___

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 [EMAIL PROTECTED]


Re: NSImageView and getting change events

2008-06-27 Thread Uli Kusterer

Am 27.06.2008 um 10:20 schrieb Totte Alm:
I've got a window, with a bunch of showable views, one contain an  
NSImageView. I need to inform my Controller when the user drops or  
pastes something into this NSImageView to reflect document changes  
and update my internal changes manager. This seems to be a less than  
trivial task as you cannot seem to set a delegate to the  
NSImageVIEW, nor is it documented anywhere what kind of Notifictions  
it will send when the image is changed, but I guess someone out  
there has figured out some way to do this without having to subclass  
or write an own class.



 I think the NSImageView sends its action to its target when its  
image gets changed that way. Have you tried that?


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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 [EMAIL PROTECTED]


Re: description and proxy objects

2008-06-27 Thread Mike Abdullah


On 27 Jun 2008, at 00:36, Torsten Curdt wrote:

I am getting the selected object from a controller (that is using  
bindings)


NSDictionary *accountSettings = [accountsController selection];

The returned object is a proxy object. But why isn't the  
[accountSettings description] passed on?
Instead of the print out of the contents of the dictionary I am now  
getting the description of the proxy object.


The selection proxy only acts in a proxy-like manner for KVC/KVO  
messages; not any general message you might care to send. Alternatives  
would be:


[[[accountsController selectedObjects] objectAtIndex:0] description];

[[accountsController selection] valueForKey:@description];
___

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 [EMAIL PROTECTED]


Re: Suggestions on how to price an iPhone app for the app store which relies on a central server

2008-06-27 Thread I. Savant

On Jun 27, 2008, at 5:18 AM, Brian Tunning wrote:

Let me know if there is a more appropriate forum for this question  
-- this
Cocoa list was the best I could find, especially considering that I  
am not
one of the lucky few in the official iphone developer program, and  
do not

see any other avenues of getting my questions answered.

  As long as you are not disclosing information under NDA, you might  
try the Mac Small Business group (macsb):


http://tech.groups.yahoo.com/group/macsb/

  ... since this has nothing to do with the technical aspects of  
Cocoa (and everything to do with the business of selling an app),  
that's the more appropriate list.


--
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 [EMAIL PROTECTED]


initWithCoder in Nib object loading

2008-06-27 Thread John Murphy
I notice that there are a couple different init methods used for nib loading. 
For instance, objects from the IB Library get an initWithCoder message, while 
custom view objects get an initWithFrame, and everything else gets an init. Why 
is this? Specifically, why a special initWithCoder technique? After all, isn't 
everything encoded?


  
___

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 [EMAIL PROTECTED]


Re: initWithCoder in Nib object loading

2008-06-27 Thread Michael Watson
http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/chapter_3_section_3.html 



All view objects are sent -initWithCoder:, but the custom view  
object does something extra. After the custom view object is  
unarchived, it creates your view subclass, sends the object an - 
initWithFrame: message, and then swaps itself for the subclass.



--
m-s

On 27 Jun, 2008, at 07:28, John Murphy wrote:

I notice that there are a couple different init methods used for nib  
loading. For instance, objects from the IB Library get an  
initWithCoder message, while custom view objects get an  
initWithFrame, and everything else gets an init. Why is this?  
Specifically, why a special initWithCoder technique? After all,  
isn't everything encoded?




___

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/mikey-san 
%40bungie.org


This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Core data question in multiwindow doc app

2008-06-27 Thread Steven Hamilton

Easy one this I reckon (but not that easy or I wouldn't ask),

I've converted my core data app to NSPersistentDocument and using a  
multi-nib model for my 3 windows. I have an account window using the  
IB wizard Master-Detail interface with bindings to add and manage  
Account entities. I also have a transaction window which has an  
outlineview of my Accounts. This uses the standard datasource and  
delegate methods and I build a manual tree of accounts during  
awakeFromNib for that window.


When I add a new account entity my outlineview doesn't know. Should I  
be using a notification to find out when a new account entity is  
added. If so, which one?

___

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 [EMAIL PROTECTED]


Layer Backed Views and CoreAnimation neither animate nor stay in place

2008-06-27 Thread Chilton Webb
Hi,

I am absolutely confused regarding something simple in layer backed view 
animation, and it's been haunting me for many months now. So I have constructed 
a sample project that illustrates the 3 problems I run into most frequently. 
I'm hoping someone will point to some place in the docs I've missed, and 
explain why I'm having what I see as simple problems, so often.

Here's the completed, zipped sample project. It's 63k.
http://homepage.mac.com/chilton/.Public/SubViewDepthTest.zip


The symptoms:
 (1) If I specify that I want anything other than the main view to have a 
layer, that view will instantly 'pop' to the foreground in the window. However, 
its actual view remains in the same place in the view hierarchy. 

 (2) If I set [self setWantsLayer:YES] anywhere except where it is currently 
uncommented, the animations don't work at all. The window performs the update 
instantly, and without animating it! This seems very wrong. I would expect that 
I could set it at the end of my initialization at least, after I've built up my 
other layers, so that the tree would populate correctly. 

If I do that, no animation, but at least the view is replaced in the right 
stacking order. 

 (3) Even when everything else is working right, the first time I perform my 
animation method, the animation does not work. Instead, it quickly swaps out 
the old view with the new one, and displays it in the foreground, on top of all 
other views, even if all other views are layer backed. This is obviously *not* 
'replacing' the view in the order I want. After that, it animates properly, but 
on top of the other views instead of behind them.

All I want is to animate the swapping out of the middle layer. What on Earth am 
I doing wrong?

The very simple sample project is above, and the two main classes used are 
below. The first does all the work, the second is just there to look pretty.

ANY SUGGESTIONS/CRITICISMS/COMMENTS GREATLY APPRECIATED!!!

Thank you,
-Chilton Webb


//  SubViewDepthTest.m
//  SubViewDepthTest
//
//  Created by Chilton Webb on 6/26/08.
//
// (1) If I specify that I want anything other than the main view to have a 
layer, 
//  that view will instantly 'pop' to the foreground in the window. 
However, 
//  its actual view remains in the same place in the view 
hierarchy. 
//
// (2) If I set [self setWantsLayer:YES] anywhere except where it is currently 
uncommented,
//  the animations don't work at all. The window performs the 
update instantely,
//  without animating it.
//
// (3) The first time we perform this method, this animation does not work, 
//  it quickly swaps out the old view with the new one, and 
displays it in the foreground.
//

#import SubViewDepthTest.h


@implementation SubViewDepthTest

- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
  
CATransition *transition = [CATransition animation];
[transition setType:kCATransitionPush];
[transition setSubtype:kCATransitionFromLeft];
NSDictionary *ani = [NSDictionary 
dictionaryWithObject:transition forKey:@subviews];
[self setAnimations:ani];

// (2) If I set this here, the animations don't work.
// [self setWantsLayer:YES];

// Set up our views
ColoredSubView *sv1 = [[ColoredSubView alloc] 
initWithFrame:NSMakeRect(0,0,frame.size.width,frame.size.height)];
[sv1 setColor:[NSColor redColor]];
[self addSubview:sv1];

ColoredSubView *sv2 = [[ColoredSubView alloc] 
initWithFrame:NSMakeRect(50,50,frame.size.width,frame.size.height)];
[sv2 setColor:[NSColor greenColor]];
[self addSubview:sv2];

ColoredSubView *sv3 = [[ColoredSubView alloc] 
initWithFrame:NSMakeRect(100,100,frame.size.width,frame.size.height)];
[sv3 setColor:[NSColor blueColor]];
[self addSubview:sv3];

// (2) If I set this here, the animations don't work, but the 
stacking order is right.
// [self setWantsLayer:YES];

// Clean up
[sv1 release];
[sv2 release];
[sv3 release];

}
return self;
}



- (IBAction) testSwap:(id) sender
{
// (2) If I set this anywhere else, the animations don't work.
[self setWantsLayer:YES];

// (3) See notes above

ColoredSubView *svx = [[ColoredSubView alloc] 
initWithFrame:NSMakeRect(50,50,200,200)];
[svx setColor:[self anothercolor]];
[[self animator] replaceSubview:[[self subviews] objectAtIndex:1] with: 
svx];
[svx release];


}



- (NSColor *) anothercolor
{
static unsigned i;
NSColor *color;
i++;
if (i == 1) {

Re: NSString uppercaseString

2008-06-27 Thread Tito Ciuro

Hi Sam,

It's autoreleased. Make sure you read this document, as it'll answer  
many of your questions:


http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html 



-- Tito

On 27 Jun 2008, at 5:56 AM, Sam Mo wrote:


Newbie here:

I am looking at the documentation in Xcode for the method  
uppercaseString in
NSString class but it does not mention how the return NSString is  
being

released.

Will the return NSString be released when the originator be  
released? Or I
have to release the return NSString separately?  Or the return  
NSString will

just go away without any leak?

Thanks in advance for your 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/tciuro%40mac.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: NSString uppercaseString

2008-06-27 Thread Uli Kusterer

Am 27.06.2008 um 15:15 schrieb Tito Ciuro:

It's autoreleased.



 No, there's no guarantee that it's autoreleased. All that's  
guaranteed is that you do not own it. This still means there'll be no  
leak and you shouldn't call release on it, but assuming it'  
autoreleased would be assuming a longer lifetime than is guaranteed.


 If you read the documentation closely, you'll see that it would be  
perfectly valid to implement this method so the string goes away when  
the original (non-uppercase) string is released.


 In the case of uppercaseString, it may actually *be* autoreleased  
under the hood, but that's an implementation detail. For example, - 
objectAtIndex: in NSArray* is documented the same way as  
uppercaseString, but if you release the array itsef, any object you  
obtained from the array goes away (unless you or someone else  
explicitly retain it).


 So, it is NOT guaranteed to be autoreleased, it is just not owned  
by you. Please be careful about spreading inaccuracies not supported  
by the documentation.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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 [EMAIL PROTECTED]


Re: NSString uppercaseString

2008-06-27 Thread matt . gough


On 27 Jun 2008, at 3:30pm, Uli Kusterer wrote:

If you read the documentation closely, you'll see that it would be  
perfectly valid to implement this method so the string goes away  
when the original (non-uppercase) string is released.


Hmmm, not sure I'd read it that way (depending on what you are reading).

According to: 
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html
*
Validity of Shared Objects
Cocoa’s ownership policy specifies that received objects should remain  
valid throughout the scope of the calling method. It should also be  
possible to return a received object from the current scope without  
fear of it being released. It should not matter to your application  
that the getter method of an object returns a cached instance variable  
or a computed value. What matters is that the object remains valid for  
the time you need it.


There are exceptions to this rule. For example, collection classes do  
not attempt to extend the lifetime of objects placed inside them.  
Removing an object from a mutable array could invalidate any copies of  
the object previously acquired, as in the following example:


value = [array objectAtIndex:n];
[array removeObjectAtIndex:n];
// value could now be invalid.

*

Since there is no explicit mention that uppercaseString is an  
exception to this, I think the string will always be valid in such  
cases as:


NSString* someString = [NSString alloc] initWithWhatever:whatever];

NSString* someOtherString = [someString uppercaseString];

[someString release];



Matt Gough___

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 [EMAIL PROTECTED]


Re: NSString uppercaseString

2008-06-27 Thread Tito Ciuro

Uli,

As Matt also points out, the documentation is not always crystal- 
clear, so I was simply trying to answer Sam's specific question. Since  
not all APIs behave the same way I added the link to the Memory  
Management Programming Guide for Cocoa page, hoping to help Sam. In  
any case, it was never my intention to spread inaccuracies :-)


Cheers,

-- Tito

On 27 Jun 2008, at 6:30 AM, Uli Kusterer wrote:


Am 27.06.2008 um 15:15 schrieb Tito Ciuro:

It's autoreleased.



No, there's no guarantee that it's autoreleased. All that's  
guaranteed is that you do not own it. This still means there'll be  
no leak and you shouldn't call release on it, but assuming it'  
autoreleased would be assuming a longer lifetime than is guaranteed.


If you read the documentation closely, you'll see that it would be  
perfectly valid to implement this method so the string goes away  
when the original (non-uppercase) string is released.


In the case of uppercaseString, it may actually *be* autoreleased  
under the hood, but that's an implementation detail. For example, - 
objectAtIndex: in NSArray* is documented the same way as  
uppercaseString, but if you release the array itsef, any object you  
obtained from the array goes away (unless you or someone else  
explicitly retain it).


So, it is NOT guaranteed to be autoreleased, it is just not owned  
by you. Please be careful about spreading inaccuracies not  
supported by the documentation.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de







___

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 [EMAIL PROTECTED]


Re: Prevent Asynchronous operation of beginSheetModalForWindow

2008-06-27 Thread John Love
Graham,

Yup, Nathan the double indirection of id *

1st, just the key snippet from FileController.m:

@implementation FileController

id mFileSheetDelegate;

=

Here's the complete interface and implementation files for just one
SheetController, which has 2 buttons in its sheet window:

// SaveSheetController.h

#import Cocoa/Cocoa.h

@interface SaveSheetController:NSWindowController {
IBOutlet NSTextField *iboSaveDescription;
}
- (void) showSheetOnParentWindow:(NSWindow*)parentWindow
 withDescription:(NSString*)theDescription
 delegate:(id)theTarget
 contextInfo:(void*)contextInfo;
- (void) sheetDidEnd:(NSWindow*)sheet
 returnCode:(int)returnCode
 contextInfo:(void*)contextInfo;
- (IBAction) saveIt:(id)sender;
- (IBAction) dontSaveIt:(id)sender;
- (void) closeSheet:(id)sender withCode:(int)theCode;
@end

===

// SaveSheetController.m

#import SaveSheetController.h

enum {
kJustSave,   /* 0, 1 */
kJustNotSave
};

@implementation SaveSheetController

extern id mFileSheetDelegate;

- (void) showSheetOnParentWindow:(NSWindow*)parentWindow
 withDescription:(NSString*)theDescription
 delegate:(id)theTarget
 contextInfo:(void*)contextInfo {
mFileSheetDelegate = theTarget;

if (theDescription) {
// do magic
}

[NSApp beginSheet:[self window]
  modalForWindow:parentWindow
  modalDelegate:theTarget
  didEndSelector:@selector
(sheetDidEnd:returnCode:contextInfo:)
  contextInfo:contextInfo];
}

// 2 buttons of saveSheet
- (IBAction) saveIt:(id)sender {
[self closeSheet:sender withCode:kJustSave];
}

- (IBAction) dontSaveIt:(id)sender {
[self closeSheet:sender withCode:kJustNotSave];
}

- (void) closeSheet:(id)sender withCode:(int)theCode {
NSWindow* theSheet;
theSheet = [sender window];

[NSApp endSheet:theSheet returnCode:theCode];   // calls didEndSelector
}

- (void) sheetDidEnd:(NSWindow*)sheet
 returnCode:(int)returnCode
 contextInfo:(void*)contextInfo {
[mFileSheetDelegate doSheetSelection:returnCode
contextInfo:contextInfo];

[sheet orderOut:self];
}

@end



Finally, a snippet or two from [doSheetSelection:contextInfo]:

- (void) doSheetSelection:(int)returnCode
  contextInfo:(void*)contextInfo {

/*
If we had different sheets returning the same code,
then we would select between the different sheet IDs.
But, for our case, all returned IDs are unique.

if ([(NSString*)contextInfo isEqualToString:sCalculateSheetID]) {
}
if ([(NSString*)contextInfo isEqualToString:sSaveSheetID]) {
}
if ([(NSString*)contextInfo isEqualToString:sErrorSheetID]) {
}
*/

switch (returnCode) {
case kJustSave:
[self saveSpreadsheet];

gShouldCloseDoc = TRUE;
break;

case kJustNotSave:
[self setStatus:sFileNotSavedMsg];

gShouldCloseDoc = TRUE;
break;
}



Okay ... all the snippets are done ... now, the questions:

(1) warning: no doSheetSelection:contextInfo method found which, I think, is
due to the fact that the external class of mFileSheetDelegate =
FileController, yet when referenced in SaveSheetController, it's = id, a
general pointer.  But, I thought all anonymous pointers were resolved at
runtime ... am I just going to force myself to ignore this Build Warning,
knowing that it will all go away at runtime???

(2)I still get unrecognized selector .. but,
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
is within the sheet.m .. good grief!

John
___

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 [EMAIL PROTECTED]


Catching the delegate message in a subclass

2008-06-27 Thread Sveinbjorn Thordarson
Hello everyone,
I'm implementing a subclass of NSTextField and I need to intercept a
delegate message in the class before it is sent to the delegate.  Is this
possible, and if so, how?

Many thanks,
Sveinbjorn
___

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 [EMAIL PROTECTED]


Re: [Moderator] List Guidelines - Must Read

2008-06-27 Thread Tom Harrington
On Fri, Jun 27, 2008 at 12:01 AM, Jens Alfke [EMAIL PROTECTED] wrote:
 On 26 Jun '08, at 11:36 AM, Hamish Allan wrote:

 What we really need is for the cocoa-dev list admin page to require
 new subscribers to type in the phrase I will not make posts about the
 iPhone or Snow Leopard :)

 No, you've bought into the whole reality distortion field. What we _really_
 need is for Apple to allow developer discussion of NDA'ed products. If there
 were an *Ph*n* mailing list on this server, and if that list were mentioned
 in the SDK or on the *Ph*n* developer home page, people would see it and go
 there to post. The list could be set up to require ADC membership to
 subscribe, so as to preserve the airtight confidentiality of all details of
 the *Ph*n* SDK.

Oh, they do allow it, despite what the moderators here say.  You just
have to use the appropriate Apple forum.  Apple's support forums have
a developer section with no shortage of iPhone discussion.  Apple
hosts it and nobody seems to mind.

See http://discussions.apple.com/category.jspa?categoryID=164 for the forum.

It seems kind of silly that iPhone discussion is forbidden here when
Apple's apparently not concerned with hosting the discussions
elsewhere, but hey, what do I know about it.

-- 
Tom Harrington
[EMAIL PROTECTED]
AIM: atomicbird1
___

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 [EMAIL PROTECTED]


Re: Catching the delegate message in a subclass

2008-06-27 Thread Andy Lee

On Jun 27, 2008, at 11:03 AM, Sveinbjorn Thordarson wrote:

Hello everyone,
I'm implementing a subclass of NSTextField and I need to intercept a
delegate message in the class before it is sent to the delegate.  Is  
this

possible, and if so, how?


See the docs for the methods -textDidBeginEditing:, -textDidChange:,  
etc. in NSTextField.   I'd suggest overriding whichever of those  
corresponds to the delegate method(s) you care about.  This way you  
can intercept not only messages to the delegate but the corresponding  
notifications.  For example, the NSTextField might not have a delegate  
but there might be some object out there listening for notifications.


--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 [EMAIL PROTECTED]


Re: [Moderator] List Guidelines - Must Read

2008-06-27 Thread Devon Ferns
I agree.  It's not like what's in the SDK is super secret.  Anyone can 
download it. 


Devon

Tom Harrington wrote:


Oh, they do allow it, despite what the moderators here say.  You just
have to use the appropriate Apple forum.  Apple's support forums have
a developer section with no shortage of iPhone discussion.  Apple
hosts it and nobody seems to mind.

See http://discussions.apple.com/category.jspa?categoryID=164 for the forum.

It seems kind of silly that iPhone discussion is forbidden here when
Apple's apparently not concerned with hosting the discussions
elsewhere, but hey, what do I know about it.

  


___

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

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

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

This email sent to [EMAIL PROTECTED]


[Moderator] Re: Suggestions on how to price an iPhone app for the app store which relies on a central server

2008-06-27 Thread Scott Anguish


On Jun 27, 2008, at 5:18 AM, Brian Tunning wrote:

Let me know if there is a more appropriate forum for this question  
-- this
Cocoa list was the best I could find, especially considering that I  
am not
one of the lucky few in the official iphone developer program, and  
do not

see any other avenues of getting my questions answered.


Once again.

The iPhone SDK is covered by a non-disclosure agreement. You can't  
discuss it here or anywhere else publicly.


This information is contained in the license agreement that you must  
accept in order to download the SDK initially.


This information is also included in the list guidelines that are  
posted here regularly and are sent to every member when they sign up  
for this list.



___

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 [EMAIL PROTECTED]


Re: [Moderator] List Guidelines - Must Read

2008-06-27 Thread Scott Anguish


On Jun 27, 2008, at 11:17 AM, Tom Harrington wrote:


Oh, they do allow it, despite what the moderators here say.


I'm not just making these rules up as I go because it's what I want.

These are the rules provided by WWDR and others.


You just
have to use the appropriate Apple forum.  Apple's support forums have
a developer section with no shortage of iPhone discussion.  Apple
hosts it and nobody seems to mind.


And you're still breaking your NDA with all the same legal  
ramifications.



___

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 [EMAIL PROTECTED]


[Moderator] Re: [Moderator] List Guidelines - Must Read

2008-06-27 Thread Scott Anguish


On Jun 27, 2008, at 11:25 AM, Devon Ferns wrote:

I agree.  It's not like what's in the SDK is super secret.  Anyone  
can download it.

Devon



You can only download it after accepting to the confidentiality  
agreement.


Believe it or not, there are people who can't, or won't, download it  
based on the agreement.


Regardless, this thread is done.  It isn't something to be debated  
here. 
___


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 [EMAIL PROTECTED]


Re: Help getting custom cell layout in NSOutlineView column

2008-06-27 Thread j o a r


On Jun 27, 2008, at 8:55 AM, Sebastian Nowicki wrote:

I've been trying to find some documentation as to how to do this,  
and as far as I can tell I'm supposed to subclass NSCell and somehow  
draw both labels. I'm completely new to creating views and such, and  
I'm unable to find any good sample code as how to do it. The layout  
I want looks something like this:


+---+
| |  Foobar
|   (Image)|
| |  Some description that can be quite  
long, but should never

| |  exceed the height of the image...
+--+

I hope that doesn't come out too mangled, but you get the picture.  
I'm mostly worried about the two text fields, since the image could  
probably go in a separate column.


How do I go about this?



This is a good piece of sample code to show how to create a complex  
custom cell subclass:


http://developer.apple.com/samplecode/PhotoSearch/

j o a r


___

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 [EMAIL PROTECTED]


Re: [Moderator] List Guidelines - Must Read

2008-06-27 Thread Steve Christensen

On Jun 27, 2008, at 8:25 AM, Devon Ferns wrote:

I agree.  It's not like what's in the SDK is super secret.  Anyone  
can download it.


Yeah, anyone can download it, but in order to download it, you have  
to go through the process of accepting a license agreement that  
includes a NDA restriction. And if people honor the NDA then the  
contents of the SDK are, in fact, super secret because only the  
people bound by the NDA know what's in the SDK.


This is how it works in business. If you want to use somebody else's  
stuff, you often have to agree that what they tell you stops with you  
(or your company). If you violate the agreement, at the very least  
they won't be doing business with you again because you'll have a  
reputation of not being trustworthy.


Ultimately it comes down to how good your word is...

steve

___

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 [EMAIL PROTECTED]


Re: Leak in NSSavePanel

2008-06-27 Thread Corbin Dunn


On Jun 26, 2008, at 3:23 PM, Jelle Vandebeeck wrote:


Hi Corbin,

You should check out this link: 
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSavePanel_Class/Reference/Reference.html

The word singleton is used :-)


Thank you -- I logged a bug against our doc team.




But I thought [NSSavePanel savePanel] returned an autoreleased  
object, so I presumed no leaks could occur...


Yes; it is an autoreleased object. I'm still not sure what you find as  
leaking. I believe  10.5.3 did have some leaks in NetworkServices,  
which should be fixed.


-corbin


___

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 [EMAIL PROTECTED]


Re: NSTableView / NSArrayController Drawing

2008-06-27 Thread Murray Bookchin
Thanks for your reply Ken,

The way I'm modifying the content array is:
[myArrayController addObject:someDictionary];

Each of the NSTableColumns in my TableView have their value bound to
myArrayController.arrangedObjects.someKey where someKey corresponds to a key
in a dictionary in the content array.

Any other pointers as I look back through the KVC docs? :)

Thanks,
Murray

On Thu, Jun 26, 2008 at 8:54 PM, Ken Thomases [EMAIL PROTECTED] wrote:

 On Jun 26, 2008, at 6:43 PM, Murray Bookchin wrote:

  I'm using an NSArrayController to populate my NSTableView from an array of
 dictionaries. The problem is my app spends the majority of its cpu time
 re-drawing the NSTableview (~60-70%) as I add rows, even though the view
 is
 idle (displaying the top 20 or so rows which aren't changing).

 I did find one thread in the archives on this topic... (
 http://www.cocoabuilder.com/archive/message/cocoa/2007/4/24/182355) it
 sounds like there's a trick to getting the ArrayController to recognize
 that
 the content array is mutable.. Doing that stops the ArrayController from
 redrawing the TableView every time something is added to the content
 array?
 The fix is not clear to me from that thread however...

 Has anyone else experienced this and/or know how to work around it?


 How are you modifying the array?  I suspect you're using
 -mutableArrayValueForKey:, and then mutating the returned array proxy.  Read
 the documentation for that.

 In particular, note that if the mutable array primitive methods aren't
 found, the proxy resorts to setKey:.  Each time setKey: is used, you're
 telling the receiver that the entire array is being replaced, rather than
 making some more limited change to just one or a few elements of the array.
  In particular, this is equivalent to calling will/didChangeValueForKey:,
 which results in KVO notifications whose NSKeyValueChangeKindKey has a value
 of NSKeyValueChangeSetting.

 By contrast, if the mutable array primitive methods were available, the
 proxy would use them.  In turn, KVO could use the equivalent of
 will/didChange:valuesAtIndexes:forKey:, which results in notifications whose
 NSKeyValueChangeKindKey will be one of NSKeyValueChangeInsertion,
 NSKeyValueChangeRemoval, or NSKeyValueChangeReplacement.

 Only the latter kinds of notifications give the NSTableView the information
 it needs to perform efficient updates to itself.

 If you're not using -mutableArrayValueForKey:, then you're either calling
 setKey: yourself, which has the same effect, or you're calling
 will/didChangeValueForKey: yourself.  If you doing that, you shouldn't.  If
 you insist on generating the notifications manually, use
 will/didChange:valuesAtIndexes:forKey:.  Even better would be to implement
 the mutable array primitive methods and use those.  (Once those are
 implemented, you _could_ use -mutableArrayValueForKey:, and it would be able
 to be somewhat more efficient, but in that case it's still an unnecessary
 intermediary and you'd be better off to just call the mutable array
 primitive methods directly.)

 So, to solve the issue you're seeing, I recommend that you implement the
 mutable array primitive methods and use those when you need to modify your
 array.  
 http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html#//apple_ref/doc/uid/20002174-178830-BAJEDEFB
 

 Cheers,
 Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Layer Backed Views and CoreAnimation neither animate nor stay in place

2008-06-27 Thread Brian Christensen

On Jun 27, 2008, at 08:56, Chilton Webb wrote:

(3) Even when everything else is working right, the first time I  
perform my animation method, the animation does not work. Instead,  
it quickly swaps out the old view with the new one, and displays it  
in the foreground, on top of all other views, even if all other  
views are layer backed. This is obviously *not* 'replacing' the view  
in the order I want. After that, it animates properly, but on top of  
the other views instead of behind them.


I'm surprised it doesn't work as intended. Maybe it's a bug in the  
replaceSubview:with: method. If you change your testSwap: method to  
the following it should maintain the view ordering:


- (IBAction) testSwap:(id) sender
{
// (2) If I set this anywhere else, the animations don't work.
//  [self setWantsLayer:YES];

// (3) See notes above

	ColoredSubView *svx = [[ColoredSubView alloc]  
initWithFrame:NSMakeRect(50,50,200,200)];

[svx setColor:[self anothercolor]];
//	[[self animator] replaceSubview:[[self subviews] objectAtIndex:1]  
with: svx];


NSView *viewToReplace = [[self subviews] objectAtIndex:1];
	[[self animator] addSubview:svx positioned:NSWindowAbove  
relativeTo:viewToReplace];

[[viewToReplace animator] removeFromSuperview];

[svx release];
}

It looks like you'll have to add this as well:

- (void)awakeFromNib
{
[self setWantsLayer:YES];
}

Your transition probably won't work as intended with this solution  
though (it works fine with the default fade animation, however), so to  
get the effect you want you may need to position the new view outside  
the visible boundaries of the superview and then use something like  
this to perform the transition:


[NSAnimationContext beginGrouping];
[NSAnimationContext setDuration:0.5];

[[svx animator] setFrameOrigin:destinationFrameOrigin];
[[viewToReplace animator]  
setFrameOrigin:somewhereOutsideVisibleBoundaries];


[NSAnimationContext endGrouping];

[viewToReplace performSelector:@selector(removeFromSuperview)  
withObject:nil afterDelay:0.5];


(I'm not sure that the transition you specified would work with  
replaceSubview:with: either. It seems to perform the animation on the  
entire superview, not just the subview being changed.)


/brian



smime.p7s
Description: S/MIME cryptographic signature
___

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 [EMAIL PROTECTED]

Re: initWithCoder in Nib object loading

2008-06-27 Thread Jonathan Hess

Hey John -

If you're thinking about overriding initWithCoder: just to do post NIB  
loading instantiation, I would recommend overriding awakeFromNib  
instead. The objects in the NIB are sent the initWithCoder: message  
because they're actually being decoded from an archive. Conceptually  
initWithCoder: should be used to implement the NSCoding protocol, and  
it should be paired with encodeWithCoder:. If you're custom view/ 
object isn't actually going to implement the NSCoding protocol, I  
think you should override awakeFromNib instead. The reason some  
obejcts get init, and some get initWithFrame: and others get  
initWithCoder: is that objects like the 'blue cube' in IB, or the  
'custom view' are typically placeholders for classes from your project  
that aren't available in IB, and might not implement NSCoding. So,  
after 'blue cube' or 'custom view' objects are unarchived, with  
initWithCoder:, they replace themselves with objects of the classes  
you specified in IB. The create those instances with an alloc message  
followed by either an init or initWithFrame:.


Good Luck -
Jon Hess

On Jun 27, 2008, at 4:28 AM, John Murphy wrote:

I notice that there are a couple different init methods used for nib  
loading. For instance, objects from the IB Library get an  
initWithCoder message, while custom view objects get an  
initWithFrame, and everything else gets an init. Why is this?  
Specifically, why a special initWithCoder technique? After all,  
isn't everything encoded?




___

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

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Losing some event

2008-06-27 Thread Laurent Cerveau

Hi

I am experiencing with Core Animation applications in kiosk mode and  
starts from the MenuView sample code I found somewhere on Apple web  
site (it displays a Quartz Composer composition in the background with  
a few CALayer that acts as button). In order to go full screen I have  
been going around the list archive, avoided enterFullScreen, and went  
with what seemed to have most sense that is :

- create a window that covers the screen
- move the content view of the window I use in IB to this one
- use the SetSystemUIMode API to hide menu bar and dock
- make sure the new window is properly the one getting events with  
makeKeyAndOrderFront

- I also make sure I make the view ist the firstResponder of the window.

However I do not get any more any keyDown,  moveUp mouseDown .and  
ended with a beep. I have put a breakpoint in NSBeep but the backtrace  
is too short to reallly help

#0  0x96c50b20 in NSBeep ()
#1  0x96a878db in -[NSApplication sendEvent:] ()
#2  0x969e4e27 in -[NSApplication run] ()
#3  0x969b2030 in NSApplicationMain ()

What is the best way to track such thing?

Thanks

laurent
___

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 [EMAIL PROTECTED]


Re: Losing some event

2008-06-27 Thread Omar Qazi


On Jun 27, 2008, at 10:37 AM, Laurent Cerveau wrote:


Hi

I am experiencing with Core Animation applications in kiosk mode and  
starts from the MenuView sample code I found somewhere on Apple web  
site (it displays a Quartz Composer composition in the background  
with a few CALayer that acts as button). In order to go full screen  
I have been going around the list archive, avoided enterFullScreen,  
and went with what seemed to have most sense that is :

- create a window that covers the screen
- move the content view of the window I use in IB to this one
- use the SetSystemUIMode API to hide menu bar and dock
- make sure the new window is properly the one getting events with  
makeKeyAndOrderFront
- I also make sure I make the view ist the firstResponder of the  
window.


However I do not get any more any keyDown,  moveUp mouseDown


The window itself is probably not going to respond to key and mouse  
events. It the custom view that is supposed to accept these events,  
implement them, and then make sure that view can become the  
firstResponder. You might want to set it as the window's  
initialFirstResponder so that it will accept events on startup. If you  
don't know what that means, you should probably read this:


http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/Introduction/chapter_1_section_1.html

Omar Qazi
Hello, Galaxy!
1.310.294.1593



smime.p7s
Description: S/MIME cryptographic signature
___

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 [EMAIL PROTECTED]

Re: Losing some event

2008-06-27 Thread Omar Qazi


On Jun 27, 2008, at 10:37 AM, Laurent Cerveau wrote:


- I also make sure I make the view ist the firstResponder of the  
window.


Sorry, I missed the last line of your email.

Omar Qazi
Hello, Galaxy!
1.310.294.1593



smime.p7s
Description: S/MIME cryptographic signature
___

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 [EMAIL PROTECTED]

Re: Losing some event

2008-06-27 Thread Michael Ash
On Fri, Jun 27, 2008 at 1:37 PM, Laurent Cerveau [EMAIL PROTECTED] wrote:
 Hi

 I am experiencing with Core Animation applications in kiosk mode and starts
 from the MenuView sample code I found somewhere on Apple web site (it
 displays a Quartz Composer composition in the background with a few CALayer
 that acts as button). In order to go full screen I have been going around
 the list archive, avoided enterFullScreen, and went with what seemed to have
 most sense that is :
 - create a window that covers the screen
 - move the content view of the window I use in IB to this one
 - use the SetSystemUIMode API to hide menu bar and dock
 - make sure the new window is properly the one getting events with
 makeKeyAndOrderFront
 - I also make sure I make the view ist the firstResponder of the window.

 However I do not get any more any keyDown,  moveUp mouseDown .and ended with
 a beep. I have put a breakpoint in NSBeep but the backtrace is too short to
 reallly help
 #0  0x96c50b20 in NSBeep ()
 #1  0x96a878db in -[NSApplication sendEvent:] ()
 #2  0x969e4e27 in -[NSApplication run] ()
 #3  0x969b2030 in NSApplicationMain ()

 What is the best way to track such thing?

Create an NSWindow subclass for your fullscreen window and override
-canBecomeKeyWindow to return YES. By default, borderles windows
cannot become key, and thus don't receive key events.

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 [EMAIL PROTECTED]


Re: Help getting custom cell layout in NSOutlineView column

2008-06-27 Thread Sebastian Nowicki


On 28/06/2008, at 12:05 AM, j o a r wrote:


This is a good piece of sample code to show how to create a complex
custom cell subclass:

http://developer.apple.com/samplecode/PhotoSearch/

j o a r



Thanks, that helped a lot. I've got a problem changing the height of  
the cell. Whatever I try to do it doesn't seem to want to get larger.  
Do I have to set something in the table or somewhere else to make it  
change?

smime.p7s
Description: S/MIME cryptographic signature
___

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 [EMAIL PROTECTED]

Extent of NDA concerning iPhone

2008-06-27 Thread John Murphy
I was planning to put some video tutorials up on my site that included some 
stuff on the iPhone. Should I hold off?


  
___

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 [EMAIL PROTECTED]


Why aren't my bindings firing?

2008-06-27 Thread Charles Srstka
Okay, in a project I'm working on, I made the mistake of trying to do  
something simple with the weird deep magic known as Cocoa Bindings.  
I've got two classes - let's call them Foo and Bar. Foo's  
implementation has this in it:


- (void)setDisplayName:(NSString *)name {
[self willChangeValueForKey:@displayName];

NSLog(@setting display name to %@, name);

if(name != ivar_displayName) {
[ivar_displayName release];
ivar_displayName = [name copy];
}

[self didChangeValueForKey:@displayName];
}

whereas Bar's implementation has this:

- (void)setTitle:(NSString *)title {
[self willChangeValueForKey:@title];

NSLog(@setting title to %@, title);

if(title != ivar_title) {
[ivar_title release];
ivar_title = [title copy];
}

[self didChangeValueForKey:@title];
}

Foo and Bar are both instantiated in Interface Builder, and Foo has an  
outlet to Bar. There's also an NSObjectController that's got its  
content outlet pointed at Foo. Foo has an outlet called  
ivar_controller that points to that NSObjectController. Foo's also  
got a method that returns its Bar outlet:


- (Bar *)bar {
return ivar_bar;
}

and in Foo's windowControllerDidLoadNib: method (it's an NSDocument  
subclass) I've got this:


[[self bar] bind:@title toObject:ivar_controller  
withKeyPath:@selection.displayName options:nil];


Now here's the thing: if I call setDisplayName: on Foo, it calls Bar's  
setTitle: method, exactly as it should. However, if I call setTitle:  
on Bar, it does *not* end up calling Foo's setDisplayName: method,  
although it seems like it should. I can change the  
bind:toObject:withKeyPath:options: invocation above so that it binds  
Bar directly to Foo without going through the object controller, or I  
can try going the other way and binding the Foo to the Bar - always I  
get the same result.


I'm sure I'm doing something stupid and/or missing something really  
simple, but what?


Thanks,
Charles
___

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 [EMAIL PROTECTED]


Help with notifications and NSFileHandle threads

2008-06-27 Thread Wan, Nathan (CIV)
Hi all, 

I am new to Objective-C and Cocoa, but I am learning it for what I thought was 
a pretty small project.  I need some help with the notification system and the 
run loop in Cocoa.  The end result is supposed to be a program that constantly 
reads and writes data from a serial port to a local file, but baby step here.  
It was suggested that I use NSFileHandle class to make my program more thread 
safe.  This is a quick test I tried to write out.  I would change the data in 
the text file, and hopefully something will show up on the console:

PS what's a proper way to work between NSData and NSString?

//CODE

#import Cocoa/Cocoa.h
#import Foundation/NSFileHandle.h
#import Foundation/NSString.h
#import Foundation/NSNotificationCenter.h
#import stdio.h

@interface test : NSObject

-(void) writeDataReadInBackground:(NSNotification *)notification;
-(void) testWriteData:(NSData *)data;

@end


int main(int argc, char *argv[])
{

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSData *aData = [@Test dataUsingEncoding: NSASCIIStringEncoding];
NSFileHandle *in = [NSFileHandle 
fileHandleForReadingAtPath:@/Users/_me_/test.txt];
   
 if(in == nil)
printf(somethig wrong\n);
   
test *t = [[test alloc] init];
   
[[NSNotificationCenter defaultCenter] addObserver: t 
selector:@selector(writeDataReadInBackground:) name: 
NSFileHandleDataAvailableNotification object: nil];
 
[t testWriteData: aData];
   
[stdIn waitForDataInBackgroundAndNotify];
   
while(1)
sleep(5);
   
[t release];
[pool release];
   
return 0;
}


@implementation test
- (void) writeDataReadInBackground:(NSNotification *)notification {
   
printf(Notification recieved\n);
}
   
- (void) testWriteData:(NSData *)data {

NSFileHandle *stdOut = [NSFileHandle fileHandleWithStandardOutput];
   
[stdOut writeData:data];
   
}
@end

//END_CODE

Thanks!!

EOM
___

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 [EMAIL PROTECTED]


Re: Extent of NDA concerning iPhone

2008-06-27 Thread Omar Qazi


On Jun 27, 2008, at 11:27 AM, John Murphy wrote:

I was planning to put some video tutorials up on my site that  
included some stuff on the iPhone. Should I hold off?





This is not really the right place for a question like that. That  
said, yes.


Omar Qazi
Hello, Galaxy!
1.310.294.1593



smime.p7s
Description: S/MIME cryptographic signature
___

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 [EMAIL PROTECTED]

simple question about passing around pointers to objects

2008-06-27 Thread Paul Archibald

Comrades:

I have experimented a bit with this, and I think I have something  
that works, but I would like to understand it better. I am reading  
the Hillegass book, but I don't really see an example of what I am  
tryng to do, although it seems like a very basic question.


The Question:
If I want to create an object and pass it to another method, where I  
plan to use it briefly (as a local variable), what is the proper way  
to allocate and deallocate the object in the various methods?



Here is a simple example:

-(NSArray*) makeObject {
	NSArray *a = [NSArray arrayFromObjects];someObject, anotherObject,  
nil];

// should I [a retain];
// or [a release];
// or [a autorelease];
// or do nothing
// before I
return a;
}

-(void) useObject {
NSArray *local = [self makeObject];
// should I [local retain];
// or [local release];
// or [local autorelease];
// or do nothing
// before I exit this method?
	// I need to pass local as an argument to the creation of another  
object before exiting

MyObj *o = [[MyObj alloc] initWithArray:local];
}


There are a lot of possible combinations here, and I have tried a  
bunch of them. Some of them work, others crash the program with a  
EXC_BAD_ADDRESS. But, as I have been trying to make an exhaustive  
test of what works and what crashes, I realize that just  
experimenting with this is not enough, and I need a better  
theoretical understanding of this stuff. If you recognize this  
pattern and can tell me where to read more on it, that would be  
great, 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 [EMAIL PROTECTED]


Re: NSSpeechSynthesizer and a speech dictionary

2008-06-27 Thread David Brennan
Hi,

I've been told that I can use sample dictionary in the documentation
for the UseSpeechDictionary function in the Speech Synthesis Manager
Reference, but I don't seem to be able to get it to work. Any ideas on
what I might be doing wrong would be a great help.

Below is the code that I am using to read the dictionary from a XML file

   speechSynth = [[NSSpeechSynthesizer alloc]
initWithVoice:@com.apple.speech.synthesis.voice.Alex];
   [speechSynth autorelease];

   NSDictionary *myDictionary = [NSDictionary
dictionaryWithContentsOfFile:@/Users/david/Desktop/Test%20speech/SpeechDictionary/myDictionary];
   [speechSynth addSpeechDictionary:myDictionary];

   [speechSynth startSpeakingString:@Welcome to Ballina.];

The contains of the file:

?xml version=1.0 encoding=UTF-8?
!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd;
plist version=1.0
   dict
   keyModificationDate/key
   string2006-12-21 11:59:25 -0800/string
   keyPronunciations/key
   array
   dict
   keyPhonemes/key
   stringAE_hEY_yUW/string
   keySpelling/key
   stringBallina/string
   /dict
   dict
   keyPhonemes/key
   stringAE_hEY_yUW/string
   keySpelling/key
   stringHello/string
   /dict
   /array
   keyAbbreviations/key
   array
   dict
   keyPhonemes/key
   string_OW_sAEkz/string
   keySpelling/key
   stringOSAX/string
   /dict
   /array
   /dict
/plist

Regards,
Dave.
___

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 [EMAIL PROTECTED]


Working with Notifications and NSFileHandle

2008-06-27 Thread Wan, Nathan (CIV)
Hi all

I'm new to Objective-C and Cocoa and I am having trouble with the notifications 
system.  This I thought was just a small project to write a native mac program 
to continuously read and write data from a serial port to a file.  It was 
suggested I use NSFileHandle to maintain safe threads, as it can read the 
serial port asynchronously; I had hoped this program would read the text file, 
and as I changed it, there would be an output to the console.  Something simple 
to see the notification system in action:

//CODE

#import Cocoa/Cocoa.h
#import Foundation/NSFileHandle.h
#import Foundation/NSString.h
#import Foundation/NSNotificationCenter.h
#import stdio.h

@interface test : NSObject

-(void) writeDataReadInBackground:(NSNotification *)notification;
-(void) testWriteData:(NSData *)data;

@end

int main(int argc, char *argv[])
{

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSData *aData = [@Test dataUsingEncoding: NSASCIIStringEncoding];
NSFileHandle *in = [NSFileHandle 
fileHandleForReadingAtPath:@/Users/_me_/test.txt];
   
if(in == nil)
printf(somethig wrong\n);
   
test *t = [[test alloc] init];
   
[[NSNotificationCenter defaultCenter] addObserver: t 
selector:@selector(writeDataReadInBackground:) name: 
NSFileHandleDataAvailableNotification object: nil];
 
[t testWriteData: aData];
[in waitForDataInBackgroundAndNotify];
   
while(1)
sleep(5);
   
[t release];
[pool release];
   
return 0;
}

@implementation test
- (void) writeDataReadInBackground:(NSNotification *)notification {
   
printf(Notification recieved\n);
}
   
- (void) testWriteData:(NSData *)data {

NSFileHandle *stdOut = [NSFileHandle fileHandleWithStandardOutput];
   
[stdOut writeData:data];
   
}
@end

//END_CODE

Thanks for your help

Nathan

PS  What's the proper way to work between NSString and NSData?
___

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 [EMAIL PROTECTED]


Re: Extent of NDA concerning iPhone

2008-06-27 Thread Kyle Sluder
On Fri, Jun 27, 2008 at 2:27 PM, John Murphy [EMAIL PROTECTED] wrote:
 I was planning to put some video tutorials up on my site that included some 
 stuff on the iPhone. Should I hold off?

Omar's right, this isn't the best place for that.  You can e-mail WWDR
for clarification, and then maybe get a lawyer if it really means that
much to you, but I'd wait until July 11 to see if any restrictions are
lifted.

--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 [EMAIL PROTECTED]


Re: simple question about passing around pointers to objects

2008-06-27 Thread Andy Lee

On Jun 27, 2008, at 4:22 PM, Paul Archibald wrote:
I am reading the Hillegass book, but I don't really see an example  
of what I am tryng to do, although it seems like a very basic  
question.

[...]
But, as I have been trying to make an exhaustive test of what  
works and what crashes, I realize that just experimenting with  
this is not enough, and I need a better theoretical understanding of  
this stuff.


Programming by guesswork is a recipe for programs that don't work and  
are unmaintainable.  And memory management is an especially bad topic  
to guess about.


The Hillegass book is actually *full* of examples of what you're  
trying to do, which is create and use an object.  Find the section  
that explains retain and release and study it again.  In the latest  
edition it's around page 46.


If you recognize this pattern and can tell me where to read more on  
it, that would be great, too.


Start here:

http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/index.html 



--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 [EMAIL PROTECTED]


Re: simple question about passing around pointers to objects

2008-06-27 Thread Rob Ross
The details of memory management take a long time to understand  
fully, but there are some basic simple principles that will really  
help you out.


1. When you get an object from a method that starts with alloc or  
new, or contains the word copy in it, YOU own that object. The  
retain count will be 1, (conceptually anyway), that is, no one else  
knows about it unless you want to share that object with other code.


2. Any other method that creates a new object that does not use the  
words described above (alloc, new, copy), returns to you an object  
that basically no one owns, it's been added to the auto-release pool.  
So if you do not claim ownership by issuing a retain, that object  
will be deallocated during the next autorelease pool cleanup. If  
you're just creating and using the object in a method and your object  
has local scope and you don't care about holding on the the object  
after the method ends, then you don't have to do anything, the object  
will be automatically freed. However, if the object needs to survive  
the local method, if other methods are going to be called later that  
need to have access to that object, you need to claim ownership by  
issuing a retain.


In your example you create an NSArray by calling arrayFromObjects.  
There is no alloc, new, or copy in that method name, so this  
new object now referenced by a is autoreleased. If that's what you  
want, do nothing. If the abject referenced by a needs to live when  
the method ends,  you need to call retain. However, this *specific*  
example of yours complicates things, because the method itself is an  
object creation method. Your method name is makeObject, which does  
not contain the magic words, so any Cocoa user calling your method is  
going to expect the object they get back is autoreleased. In this  
*specific* example of yours, calling retain on it actually would  
break the convention.


As to what you should do in useObject, by convention you expect that  
local references an autoreleased object. What happens next   
regarding local totally depends on the contract of your  MyObj  
class' initWithArray method. Does it state it retains the array? If  
so, you don't need to do anything if you don't care about local  
after this method ends. If you do care, you must retain it. If for  
some weird reason MyObj's documentation states that it does not  
retain the argument array, I would say that is bad design, but if  
that's what the documentation stated, then if you didn't retain it,  
the MyObj instance in o might end up holding a reference to a  
deallocated object after the next autorelease purge.


And since you've created your MyObj instance o with one the of the  
magic words (alloc), YOU own it. You must manage its life-cycle, or  
it will never be deallocated.  Since this method as written is  
returning void, no one else cares about this object. The method ends  
without releasing or autoreleasing o, so as written you have a  
memory leak, since o will never be deallocated.




Rob Ross, Lead Software Engineer
E! Networks

---
Beware of he who would deny you access to information, for in his  
heart he dreams himself your master. -- Commissioner Pravin Lal




On Jun 27, 2008, at 1:22 PM, Paul Archibald wrote:


Comrades:

I have experimented a bit with this, and I think I have something  
that works, but I would like to understand it better. I am reading  
the Hillegass book, but I don't really see an example of what I am  
tryng to do, although it seems like a very basic question.


The Question:
If I want to create an object and pass it to another method, where  
I plan to use it briefly (as a local variable), what is the proper  
way to allocate and deallocate the object in the various methods?



Here is a simple example:

-(NSArray*) makeObject {
	NSArray *a = [NSArray arrayFromObjects];someObject, anotherObject,  
nil];

// should I [a retain];
// or [a release];
// or [a autorelease];
// or do nothing
// before I
return a;
}

-(void) useObject {
NSArray *local = [self makeObject];
// should I [local retain];
// or [local release];
// or [local autorelease];
// or do nothing
// before I exit this method?
	// I need to pass local as an argument to the creation of another  
object before exiting

MyObj *o = [[MyObj alloc] initWithArray:local];
}


There are a lot of possible combinations here, and I have tried a  
bunch of them. Some of them work, others crash the program with a  
EXC_BAD_ADDRESS. But, as I have been trying to make an exhaustive  
test of what works and what crashes, I realize that just  
experimenting with this is not enough, and I need a better  
theoretical understanding of this stuff. If you recognize this  
pattern and can tell me where to read more on it, that would be  
great, too.


Re: Losing some event

2008-06-27 Thread Laurent Cerveau

That was it!

Thanks

laurent

On Jun 27, 2008, at 8:33 PM, Michael Ash wrote:

On Fri, Jun 27, 2008 at 1:37 PM, Laurent Cerveau [EMAIL PROTECTED]  
wrote:

Hi

I am experiencing with Core Animation applications in kiosk mode  
and starts

from the MenuView sample code I found somewhere on Apple web site (it
displays a Quartz Composer composition in the background with a few  
CALayer
that acts as button). In order to go full screen I have been going  
around
the list archive, avoided enterFullScreen, and went with what  
seemed to have

most sense that is :
- create a window that covers the screen
- move the content view of the window I use in IB to this one
- use the SetSystemUIMode API to hide menu bar and dock
- make sure the new window is properly the one getting events with
makeKeyAndOrderFront
- I also make sure I make the view ist the firstResponder of the  
window.


However I do not get any more any keyDown,  moveUp mouseDown .and  
ended with
a beep. I have put a breakpoint in NSBeep but the backtrace is too  
short to

reallly help
#0  0x96c50b20 in NSBeep ()
#1  0x96a878db in -[NSApplication sendEvent:] ()
#2  0x969e4e27 in -[NSApplication run] ()
#3  0x969b2030 in NSApplicationMain ()

What is the best way to track such thing?


Create an NSWindow subclass for your fullscreen window and override
-canBecomeKeyWindow to return YES. By default, borderles windows
cannot become key, and thus don't receive key events.

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

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Why aren't my bindings firing?

2008-06-27 Thread Keary Suska
6/27/08 1:37 PM, also sprach [EMAIL PROTECTED]:

 I've got two classes - let's call them Foo and Bar. Foo's
 implementation has this in it:
 
 - (void)setDisplayName:(NSString *)name {
  [self willChangeValueForKey:@displayName];
 
  NSLog(@setting display name to %@, name);
 
  if(name != ivar_displayName) {
  [ivar_displayName release];
  ivar_displayName = [name copy];
  }
 
  [self didChangeValueForKey:@displayName];
 }
 
 whereas Bar's implementation has this:
 
 - (void)setTitle:(NSString *)title {
  [self willChangeValueForKey:@title];
 
  NSLog(@setting title to %@, title);
 
  if(title != ivar_title) {
  [ivar_title release];
  ivar_title = [title copy];
  }
 
  [self didChangeValueForKey:@title];
 }

If you aren't overriding +automaticallyNotifiesObserversForKey: to return
NO, you should not be calling  willChangeValueForKey/didChangeValueForKey in
your setters. They are KVC-compliant as shown. Fix that, then see if the
problem goes away.

Best,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business


___

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 [EMAIL PROTECTED]


Re: How to deal with a MenuItem with both a binded state property and an action method

2008-06-27 Thread Keary Suska
6/27/08 4:06 PM, also sprach [EMAIL PROTECTED]:

 I am struck in what should be a simple task so I would appreciate any
 help.
 
 I have a menu item which I want to show a default on or off state, so
 I set up a binding in IB to a BOOL monitor property in my
 controller. This works ok and both the check mark in the menu item and
 the property are kept in sync whatever I change.
 
 However, the menu item I am talking about is intended to trigger an
 action that can fail, so I want to keep its ultimate state unchanged
 in some cases. For this purpose I added an action method that checks
 the original state of the menuState property and resets it accordingly
 depending on the success status of the performed accion.
 
 The code looks as follows
 
 
 - (BOOL)menuState { return menuState ; }
 
 - (void)setMenuState:(BOOL)value
  {
   NSLog(@setMenuState (%d) called,value);
   menuState = value ;
  }
 
 
 - (IBAction) myAction:(id)sender
 {
 
  do something...
 
  if ( fail ) [self setMenuState:NO] ;
 }
 
 I observed that when the user clicks on the menu item the action
 method is called before any change is made to menuState, but then
 setMenuState may be called twice: one from myAction (if it fails) and
 one from the frameworks. The problem here is that after the second
 call both menuState and the menuItem no longer shows the intended state.

When using bindings always stick to MVC--i.e., don't touch the menu. If you
have to change the state, change the monitor value to reflect the correct
state. IN any case, you don't say how the menuState property enters into the
picture, vs the monitor property.

HTH,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business


___

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 [EMAIL PROTECTED]


NSMutableArray help

2008-06-27 Thread Eric Lee
For practice (and I¹m a beginner...reading Aaron Hillegass¹ book), and I¹m
trying to complete one of his challenges in his Third Edition.

In that challenge, you are supposed to make a to-do list.

My question is, how do you add an object to a NSMutableArray, and then have
to array display it?

The book has a hint about a method, -replaceObjectAtIndex:withObject:. How
do you implement that?

Thanks.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSMutableArray help

2008-06-27 Thread Nick Zitzmann


On Jun 27, 2008, at 4:41 PM, Eric Lee wrote:


My question is, how do you add an object to a NSMutableArray,


-addObject:. This is in the NSMutableArray documentation...


and then have
to array display it?


Arrays usually serve as back-ends for NSTableView views (hint).

The book has a hint about a method, - 
replaceObjectAtIndex:withObject:. How

do you implement that?



What do you mean? The method is already implemented as part of  
NSMutableArray.


Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Re: Why aren't my bindings firing?

2008-06-27 Thread Charles Srstka

On Jun 27, 2008, at 5:17 PM, Keary Suska wrote:

If you aren't overriding +automaticallyNotifiesObserversForKey: to  
return
NO, you should not be calling  willChangeValueForKey/ 
didChangeValueForKey in
your setters. They are KVC-compliant as shown. Fix that, then see if  
the

problem goes away.


Actually, that's what I tried first - I added the willChange/didChange  
methods to see if that would fix the problem. It didn't - it behaves  
the same way with or without those methods. I've also tried overriding  
+automaticallyNotifiesObserversForKey: to return NO, but it turns out  
that that method never even ends up getting called (I put a log in it  
to check).


Thanks,
Charles
___

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 [EMAIL PROTECTED]


Opening a Panel

2008-06-27 Thread Alex Wait
Been working my way through the Hillegass book.

I'm on the chapter where you usea a Panel window and I am having some
trouble. I did all the instructions to the letter (as best as I can tell ^_^
)
and when my program runs, the Preferences menu item is grayed out. I checked
to make sure it was Enabled and it is.

Is there some property I need to set?

-- 
If you can't be kind, at least have the decency to be vague.
___

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 [EMAIL PROTECTED]


Re: Working with Notifications and NSFileHandle

2008-06-27 Thread Ken Thomases

On Jun 27, 2008, at 3:32 PM, Wan, Nathan (CIV) wrote:

I'm new to Objective-C and Cocoa and I am having trouble with the  
notifications system.  This I thought was just a small project to  
write a native mac program to continuously read and write data from  
a serial port to a file.  It was suggested I use NSFileHandle to  
maintain safe threads, as it can read the serial port  
asynchronously; I had hoped this program would read the text file,  
and as I changed it, there would be an output to the console.   
Something simple to see the notification system in action:


//CODE

#import Cocoa/Cocoa.h
#import Foundation/NSFileHandle.h
#import Foundation/NSString.h
#import Foundation/NSNotificationCenter.h


Once you've imported Cocoa.h, I don't think you need to explicitly  
import these Foundation headers.



#import stdio.h


If you were to use NSLog rather than printf, you wouldn't need this  
either.




@interface test : NSObject

-(void) writeDataReadInBackground:(NSNotification *)notification;
-(void) testWriteData:(NSData *)data;

@end

int main(int argc, char *argv[])
{

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSData *aData = [@Test dataUsingEncoding:  
NSASCIIStringEncoding];
NSFileHandle *in = [NSFileHandle fileHandleForReadingAtPath:@/ 
Users/_me_/test.txt];


if(in == nil)
printf(somethig wrong\n);

test *t = [[test alloc] init];

[[NSNotificationCenter defaultCenter] addObserver: t  
selector:@selector(writeDataReadInBackground:) name:  
NSFileHandleDataAvailableNotification object: nil];


In this simple test case, passing nil for the object to observe is  
fine.  In general, though, you'd get the  
NSFileHandleDataAvailableNotification notification from all file  
handles in the app, which is sure to confuse your code.




[t testWriteData: aData];
[in waitForDataInBackgroundAndNotify];

while(1)
sleep(5);


This is the crux of your problem.  Nothing can happen in this main  
thread during this loop.  In particular, notifications can't be  
delivered.


You want to use NSRunLoop:

[[NSRunLoop currentRunLoop] run];

Read the Run Loops guide for more information: http:// 
developer.apple.com/documentation/CoreFoundation/Conceptual/ 
CFRunLoops/.





[t release];
[pool release];

return 0;
}

@implementation test
- (void) writeDataReadInBackground:(NSNotification *)notification {

printf(Notification recieved\n);


You would actually need to read the data here: [[notification object]  
availableData]


If you want to keep reading data, you need to reissue - 
waitForDataInBackgroundAndNotify.  If you do that but don't read the  
data, you'll get a constant stream of notifications.


That said, if you are really trying to read data, don't use - 
waitForDataInBackgroundAndNotify.  Use -readInBackgroundAndNotify and  
NSFileHandleReadCompletionNotification instead, both here in the  
notification handler and above where the reading is initiated.  In  
that case, you don't need to call -availableData -- the data is  
provided to you in the notification.



}

- (void) testWriteData:(NSData *)data {

NSFileHandle *stdOut = [NSFileHandle  
fileHandleWithStandardOutput];


[stdOut writeData:data];


I have no idea what this is about or for.  I'm guessing it's just you  
experimenting.




}
@end

//END_CODE

Thanks for your help

Nathan

PS  What's the proper way to work between NSString and NSData?


What you did above with -[NSString dataUsingEncoding:] is fine.  In  
the other direction, you can use [[NSString alloc]  
initWithData:someData encoding:someEncoding].


Cheers,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: simple question about passing around pointers to objects

2008-06-27 Thread Daniel Richman



Here is a simple example:

-(NSArray*) makeObject {
NSArray *a = [NSArray arrayFromObjects];someObject, anotherObject, 
nil];
This should be NSArray *a = [NSArray arrayFromObjects:someObject, 
anotherObject];

// should I [a retain];

I would use [a retain];

// or [a release];
// or [a autorelease];
// or do nothing
// before I
return a;
}

___

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 [EMAIL PROTECTED]


Re: Losing some event

2008-06-27 Thread Scott Anguish


On Jun 27, 2008, at 1:37 PM, Laurent Cerveau wrote:


Hi

I am experiencing with Core Animation applications in kiosk mode and  
starts from the MenuView sample code I found somewhere on Apple web  
site (it displays a Quartz Composer composition in the background  
with a few CALayer that acts as button). In order to go full screen  
I have been going around the list archive, avoided enterFullScreen,  
and went with what seemed to have most sense that is :


can you reproduce this with that example?



___

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 [EMAIL PROTECTED]


Re: NSTableView / NSArrayController Drawing

2008-06-27 Thread Ken Thomases

On Jun 27, 2008, at 12:16 PM, Murray Bookchin wrote:


Thanks for your reply Ken,


You're welcome.


The way I'm modifying the content array is:
[myArrayController addObject:someDictionary];


And that is certainly using KVC, probably through - 
mutableArrayValueForKey:, to pass the modification on to your model.   
Therefore, everything I said in my previous message holds.  And the  
solution to your performance problem is the same.


However, I suspect you're calling the above ([myArrayController  
addObject:someDictionary]) in a way that is ill-advised.  If you're  
writing the implementation for a coordinating controller (search the  
docs for what that term means), then that controller should direct  
the model to change itself.  The resultant model change notifications  
will then cause updates to any observers, including your mediating  
controller (myArrayController) and the views bound to it. Your  
coordinating controller should not effect model changes by calling  
one of the mediating controllers.


Cheers,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Working with Notifications and NSFileHandle

2008-06-27 Thread Jason Coco


On Jun 27, 2008, at 20:11 , Ken Thomases wrote:


On Jun 27, 2008, at 3:32 PM, Wan, Nathan (CIV) wrote:

I'm new to Objective-C and Cocoa and I am having trouble with the  
notifications system.  This I thought was just a small project to  
write a native mac program to continuously read and write data from  
a serial port to a file.  It was suggested I use NSFileHandle to  
maintain safe threads, as it can read the serial port  
asynchronously; I had hoped this program would read the text file,  
and as I changed it, there would be an output to the console.   
Something simple to see the notification system in action:


//CODE

#import Cocoa/Cocoa.h
#import Foundation/NSFileHandle.h
#import Foundation/NSString.h
#import Foundation/NSNotificationCenter.h


Once you've imported Cocoa.h, I don't think you need to explicitly  
import these Foundation headers.


You don't... if you're using AppKit, you should just include Cocoa/ 
Cocoa.h, if you're using Foundation,

you should just include Foundation/Foundation.h




#import stdio.h


If you were to use NSLog rather than printf, you wouldn't need this  
either.


This is included for you when you include the main Cocoa or Foundation  
header (actually, it's
included in CoreFoundation.h which gets included by Foundation.h which  
gets included by

Cocoa.h.

Unless you define CF_EXCLUDE_CSTD_HEADERS, you get the following  
headers every

time you use Cocoa, Foundation, or CoreFoundation:

sys/types.h
stdarg.h
assert.h
ctype.h
errno.h
float.h
limits.h
locale.h
math.h
setjmp.h
signal.h
stddef.h
stdio.h
stdlib.h
string.h
time.h
inttypes.h
stdbool.h
stdint.h

The Foundation/Foundation.h file includes all the Foundation headers  
as well as CoreFoundation/CoreFoundation.h, the AvailabilityMacros.h  
and the objc header files. So you never have to explicitly #include  
these if you use any of the high-level frameworks.

smime.p7s
Description: S/MIME cryptographic signature
___

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 [EMAIL PROTECTED]

Re: NSMutableArray help

2008-06-27 Thread Ken Thomases

On Jun 27, 2008, at 5:46 PM, Nick Zitzmann wrote:


On Jun 27, 2008, at 4:41 PM, Eric Lee wrote:


My question is, how do you add an object to a NSMutableArray,


-addObject:. This is in the NSMutableArray documentation...


If the NSMutableArray is the backing storage for a property, then  
modifying it directly using -addObject: will not inform objects  
observing that property using KVO of the change.  So, be careful when  
slinging that advice around.





and then have
to array display it?


Arrays usually serve as back-ends for NSTableView views (hint).

The book has a hint about a method, - 
replaceObjectAtIndex:withObject:. How

do you implement that?



What do you mean? The method is already implemented as part of  
NSMutableArray.


I'm not familiar with the Hillegass book, so I don't know what this  
particular exercise is about.  I can think of a few possibilities:


*) He may be hinting that you modify your to-many property using the  
key-value coding (KVC) indexed accessor - 
replaceObjectInKeyAtIndex:withObject:, which you can implement in  
terms of -[NSMutableArray replaceObjectAtIndex:withObject:].


*) He may be hinting that you modify your to-many property by  
obtaining a proxy for it using -mutableArrayValueForKey:, and then  
modify that using -replaceObjectAtIndex:withObject:.


*) If you're not up to KVO and bindings, he may be suggesting that  
you use -replaceObjectAtIndex:withObject: to modify the array, and  
then invoke -reloadData on the NSTableView to tell it that the data  
has changed.


Cheers,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSMutableArray help

2008-06-27 Thread Alex Wait
To complete the exercise you need to make your app controller a data source
of the NSTableView.

The function he gives you as a hint is the one that is called when a user
edits the field.

On Fri, Jun 27, 2008 at 5:37 PM, Ken Thomases [EMAIL PROTECTED] wrote:

 On Jun 27, 2008, at 5:46 PM, Nick Zitzmann wrote:

  On Jun 27, 2008, at 4:41 PM, Eric Lee wrote:

  My question is, how do you add an object to a NSMutableArray,


 -addObject:. This is in the NSMutableArray documentation...


 If the NSMutableArray is the backing storage for a property, then modifying
 it directly using -addObject: will not inform objects observing that
 property using KVO of the change.  So, be careful when slinging that advice
 around.


  and then have
 to array display it?


 Arrays usually serve as back-ends for NSTableView views (hint).

  The book has a hint about a method, -replaceObjectAtIndex:withObject:.
 How
 do you implement that?



 What do you mean? The method is already implemented as part of
 NSMutableArray.


 I'm not familiar with the Hillegass book, so I don't know what this
 particular exercise is about.  I can think of a few possibilities:

 *) He may be hinting that you modify your to-many property using the
 key-value coding (KVC) indexed accessor
 -replaceObjectInKeyAtIndex:withObject:, which you can implement in terms
 of -[NSMutableArray replaceObjectAtIndex:withObject:].

 *) He may be hinting that you modify your to-many property by obtaining a
 proxy for it using -mutableArrayValueForKey:, and then modify that using
 -replaceObjectAtIndex:withObject:.

 *) If you're not up to KVO and bindings, he may be suggesting that you use
 -replaceObjectAtIndex:withObject: to modify the array, and then invoke
 -reloadData on the NSTableView to tell it that the data has changed.

 Cheers,
 Ken

 ___

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

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

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

 This email sent to [EMAIL PROTECTED]




-- 
If you can't be kind, at least have the decency to be vague.
___

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 [EMAIL PROTECTED]


Re: simple question about passing around pointers to objects

2008-06-27 Thread Clark Cox
On Fri, Jun 27, 2008 at 5:19 PM, Daniel Richman
[EMAIL PROTECTED] wrote:

 Here is a simple example:

 -(NSArray*) makeObject {
NSArray *a = [NSArray arrayFromObjects];someObject, anotherObject,
 nil];

 This should be NSArray *a = [NSArray arrayFromObjects:someObject,
 anotherObject];

Almost. It should be:
NSArray *a = [NSArray arrayFromObjects:someObject, anotherObject, nil];

(that nil is important)


// should I [a retain];

 I would use [a retain];

If you retain a, then you're setting yourself up for a memory leak.

Please read the memory management documentation:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/index.html

-- 
Clark S. Cox III
[EMAIL PROTECTED]
___

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 [EMAIL PROTECTED]


Re: Why aren't my bindings firing?

2008-06-27 Thread Ken Thomases

On Jun 27, 2008, at 2:37 PM, Charles Srstka wrote:

and in Foo's windowControllerDidLoadNib: method (it's an NSDocument  
subclass) I've got this:


[[self bar] bind:@title toObject:ivar_controller  
withKeyPath:@selection.displayName options:nil];


Now here's the thing: if I call setDisplayName: on Foo, it calls  
Bar's setTitle: method, exactly as it should. However, if I call  
setTitle: on Bar, it does *not* end up calling Foo's  
setDisplayName: method, although it seems like it should. I can  
change the bind:toObject:withKeyPath:options: invocation above so  
that it binds Bar directly to Foo without going through the object  
controller, or I can try going the other way and binding the Foo to  
the Bar - always I get the same result.


I'm sure I'm doing something stupid and/or missing something really  
simple, but what?


A binding is not just an automated two-way connection between KVC/KVO- 
conforming properties.


In particular, the binding name you pass to  
bind:toObject:withKeyPath:options: is not in the same namespace as  
properties.  Binding names are something else.  Furthermore,  
implementing bindings is more than just creating KVC/KVO-conforming  
properties.  A binding is a specific feature of a class which  
requires a specific implementation.  See How Do Bindings Work? in  
the Cocoa Bindings Programming Topics to see code listings which  
illustrate the work that must be done to make a class support a binding.


http://developer.apple.com/documentation/Cocoa/Conceptual/ 
CocoaBindings/Concepts/HowDoBindingsWork.html



You might be tempted to create a two-way connection between  
properties by using KVO.  It might work, but I suspect you'll get  
infinite loops.


As a matter of design, you shouldn't hook two properties up in this  
way to try to keep them always equal.  If they're always equal, why  
store the data in two places?  The state of the application (or  
document or whatever) should be stored (once) in the model.  The  
controller is responsible for reading the state of the model and  
configuring the view to reflect that.  (Both parts of that may be  
automated using KVO, but note that both the controller and the view  
will have to implement specific response to the KVO notifications.   
The view's specific response is part of implementing a binding.)  In  
response to user manipulation, a view may inform the controller of  
some action or new value.  (Again, this part of the view's behavior  
may be implemented for a binding, in which case it might inform the  
controller using KVC.)  The controller in turn translates that action  
or value change into instructions to the model to modify itself.   
(This is often custom, direct invocation of the model's methods, but  
may also be done via KVC.)



I responded to a similar question the other day, and that thread may  
also be helpful: http://lists.apple.com/archives/cocoa-dev/2008/Jun/ 
msg01484.html.


Cheers,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Opening a Panel

2008-06-27 Thread Sherm Pendley
On Fri, Jun 27, 2008 at 7:31 PM, Alex Wait [EMAIL PROTECTED] wrote:
 Been working my way through the Hillegass book.

I don't have the book (sorry Aaron, I'm poor...) so I'll to talk in
generalities.

 I'm on the chapter where you usea a Panel window and I am having some
 trouble. I did all the instructions to the letter (as best as I can tell ^_^
 )
 and when my program runs, the Preferences menu item is grayed out. I checked
 to make sure it was Enabled and it is.

 Is there some property I need to set?

First, check to make sure the menu item is connected correctly in IB.
Make note of the action name. Then check to be sure that the correct
action is implemented in your controller. A menu item is automagically
disabled when the specified action method can't be found, so a simple
typo is often the culprit for problems like this.

sherm--


 --
 If you can't be kind, at least have the decency to be vague.
 ___

 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/sherm.pendley%40gmail.com

 This email sent to [EMAIL PROTECTED]




-- 
Cocoa programming in Perl: http://camelbones.sourceforge.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 [EMAIL PROTECTED]


Re: Opening a Panel

2008-06-27 Thread Ken Thomases

On Jun 27, 2008, at 6:31 PM, Alex Wait wrote:

and when my program runs, the Preferences menu item is grayed out.  
I checked

to make sure it was Enabled and it is.

Is there some property I need to set?


By default, Cocoa automatically enables/disables menu items.  It does  
this based on their target and action.  If the target implements the  
action, then the menu is enabled; if not, it's disabled.  If the  
target is First Responder (i.e. nil), then Cocoa scans the responder  
chain for an object that responds to the action.  If it finds one,  
the menu item is enabled; otherwise, it's disabled.


So, double-check that you've set the menu item's action.  If it's  
connected to a specific target object, make sure that object responds  
to that selector.  (Check spelling and case!)  If it's connected to  
First Responder, make sure that something in the responder chain  
responds.  For a Preferences menu, it's usually the application  
delegate/controller or the application object which would ultimately  
respond.  If you have an object which is supposed to be the  
application delegate, make sure it really is.  That's often  
accomplished by instantiating the delegate in the main nib and  
connecting the application's delegate outlet to it.


Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Opening a Panel

2008-06-27 Thread Alex Wait
apologies to all ;)

I had misspelled my action's name. I am still getting used to Obj C and it's
ability to compile methods that haven't been declared. :)

On Fri, Jun 27, 2008 at 6:15 PM, Ken Thomases [EMAIL PROTECTED] wrote:

 On Jun 27, 2008, at 6:31 PM, Alex Wait wrote:

  and when my program runs, the Preferences menu item is grayed out. I
 checked
 to make sure it was Enabled and it is.

 Is there some property I need to set?


 By default, Cocoa automatically enables/disables menu items.  It does this
 based on their target and action.  If the target implements the action, then
 the menu is enabled; if not, it's disabled.  If the target is First
 Responder (i.e. nil), then Cocoa scans the responder chain for an object
 that responds to the action.  If it finds one, the menu item is enabled;
 otherwise, it's disabled.

 So, double-check that you've set the menu item's action.  If it's connected
 to a specific target object, make sure that object responds to that
 selector.  (Check spelling and case!)  If it's connected to First Responder,
 make sure that something in the responder chain responds.  For a Preferences
 menu, it's usually the application delegate/controller or the application
 object which would ultimately respond.  If you have an object which is
 supposed to be the application delegate, make sure it really is.  That's
 often accomplished by instantiating the delegate in the main nib and
 connecting the application's delegate outlet to it.

 Cheers,
 Ken




-- 
If you can't be kind, at least have the decency to be vague.
___

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 [EMAIL PROTECTED]


Re: Opening a Panel

2008-06-27 Thread Kyle Sluder
On Fri, Jun 27, 2008 at 10:01 PM, Alex Wait [EMAIL PROTECTED] wrote:
 I had misspelled my action's name. I am still getting used to Obj C and it's
 ability to compile methods that haven't been declared. :)

You haven't specified what was misspelled (just the implementation or
the interface declaration as well) so I'll point out the following: if
you declare that instances of your class respond to -foo in the
@interface block, but then in your @implementation block do not define
-foo (through misspelling or negligence) then the compiler should warn
you that you have an incomplete class definition.  Always heed this
warning.  In fact, always heed all warnings.  Of course, if you didn't
specify -foo in your class's interface, you won't get this message.

If the problem was in your nib, IB may be able to warn you that you
specified an incorrect action.  If you directly connect a view to a
target and specify an action that the object doesn't claim to respond
to (again, misspelling or neglecting to type the action as IBAction
are the most common culprits) then IB will throw up a warning.  But if
you connect the view to First Responder, IB has no idea what objects
are in the responder chain and can't provide this helpful warning.

The point I'm trying to make is to always heed warnings and fix them.
As a beginner, in particular, you should probably turn on Treat
Warnings as Errors in your target settings, so that you can't ignore
compiler warnings.

--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 [EMAIL PROTECTED]


Re: Core data question in multiwindow doc app

2008-06-27 Thread Steven Hamilton


On 28/06/2008, at 4:32 AM, Ben Trumbull wrote:


When I add a new account entity my outlineview doesn't know. Should I
be using a notification to find out when a new account entity is
added. If so, which one?


The easiest way to track insertions and deletions in the  
NSManagedObjectContext is the notification  
NSManagedObjectContextObjectsDidChangeNotification.


Yep, seems easy enough but I can't get it to send a notification. I  
add an Account entity and the notification isn't sent. However, if I  
save and reload the file, or close and reopen the window with the  
outlineview my tree is rebuilt and I see the new account. I'm sure its  
to do with the way I'm referencing the manageObjectContext. I'm not  
very happy about this [self.document ] path I keep using. Is this the  
correct way to source the MOC in a  document app?


	[[NSNotificationCenter defaultCenter] addObserver:self  
selector:@selector(buildSourceList)  
name:@NSManagedObjectContextObjectsDidChangeNotification object: 
[self.document managedObjectContext]];


___

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 [EMAIL PROTECTED]


How can I find the source of random crashes when using debug frameworks

2008-06-27 Thread Markus Spoettl

Hello All,

  I'm trying to hunt down a crash bug for two days now and I'm at a  
complete loss, have finally run out of ideas what else I can try.


I've read the Corbin Dunn's EXC_BAD_ACCESS blog post as well as the  
debugger magic tech note. I turned on debug frameworks,  
NSZombieEnabled and NSAutoreleaseFreedObjectCheckEnabled environment  
variables and since then all hell broke loose. I'm getting crashes  
deep in the frameworks, some called from my code, some seemingly random.


One thing I noticed is that I don't get any Zombie warnings. I don't  
know whether that means that it actually is working as expected (in  
the sense that I'm not over-releasing objects) or that something is  
corrupt and the system is unable to tell me what's going on for some  
reason.


I've reviewed my code over and over again and disabled large portions,  
and while I'm sure there is something wrong that I cause, I have no  
idea how I could be causing crashes like the ones below. If anyone has  
an idea what I can do to get to the source of this, I'd really  
appreciate pointers.


I'm using Xcode 3.0 on 10.5.3. The app uses WebKit and QuartzCore  
frameworks. I'm using the debug build configuration (no default  
settings changed) and I've set up the target to use the debug  
framework suffix and set NSZombieEnabled and  
NSAutoreleaseFreedObjectCheckEnabled to YES in the target's  
environment variables.


Regards
Markus

Example Crash Stack 1

GDB: Program received signal:  “EXC_BAD_ACCESS”.

#0  0x943a9036 in CFEqual
#1  0x94375ac5 in __CFDictionaryFindBuckets2
#2  0x943780cc in CFDictionaryAddValue
#3  0x948c4ddf in _LSCopyDownloadAssessmentDictionaryInternal
#4  0x948c338a in _LSCopyDownloadAssessmentDictionary
#5  0x9579fdc9 in _initDownloadAssessment
#6  0x9579f926 in CFURLResponseCopySuggestedFilename
#7  0x931de91e in -[NSURLResponse suggestedFilename]
#8  0x92bca05b in WebCore::ResourceResponse::doUpdateResourceResponse
#9  0x92b75deb in WebCore::ResourceResponseBase::updateResourceResponse
#10 0x92b75dc2 in WebCore::ResourceResponseBase::mimeType
#11 0x92c3ed23 in WebCore::SubresourceLoader::didReceiveResponse
#12	0x92bc9a00 in -[WebCoreResourceHandleAsDelegate  
connection:didReceiveResponse:]
#13	0x931de81a in -[NSURLConnection(NSURLConnectionReallyInternal)  
sendDidReceiveResponse:]

#14 0x931de76a in _NSURLConnectionDidReceiveResponse
#15 0x9579f645 in sendDidReceiveResponseCallback
#16 0x9579dcde in _CFURLConnectionSendCallbacks
#17 0x9579d63f in muxerSourcePerform
#18 0x943a660e in CFRunLoopRunSpecific
#19 0x943a6cf8 in CFRunLoopRunInMode
#20 0x94e28da4 in RunCurrentEventLoopInMode
#21 0x94e28bbd in ReceiveNextEventCommon
#22 0x94e28a31 in BlockUntilNextEventMatchingListInMode
#23 0x9162d505 in _DPSNextEvent
#24	0x9162cdb8 in -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:]

#25 0x91625df3 in -[NSApplication run]
#26 0x915f3030 in NSApplicationMain
#27 0x394c in main at main.m:13

Example Crash Stack 2

GDB: Program received signal:  “EXC_BAD_ACCESS”.

#0  0x943a91d5 in CFHash
#1  0x943ac7fb in __CFSetFindBuckets1b
#2  0x943acfdd in CFSetGetValue
#3  0x943a1890 in __CFRunLoopFindMode
#4  0x943a515c in CFRunLoopAddTimer
#5	0x931ba517 in -[NSObject(NSDelayedPerforming)  
performSelector:withObject:afterDelay:inModes:]

#6  0x917d10a5 in -[NSToolbarView windowDidUpdate:]
#7  0x9317954a in _nsnote_callback
#8  0x943879ba in __CFXNotificationPost
#9  0x94387c93 in _CFXNotificationPostNotification
#10	0x931767b0 in -[NSNotificationCenter  
postNotificationName:object:userInfo:]

#11 0x9317fff8 in -[NSNotificationCenter postNotificationName:object:]
#12 0x916ec312 in -[NSWindow update]
#13 0x94414c85 in -[NSArray makeObjectsPerformSelector:]
#14	0x9162eb22 in -[NSApplication(NSWindowCache)  
_updateWindowsUsingCache]

#15 0x9162e955 in -[NSApplication updateWindows]
#16 0x9162e897 in _handleWindowsNeedUpdateNote
#17 0x943a49a2 in __CFRunLoopDoObservers
#18 0x943a5d05 in CFRunLoopRunSpecific
#19 0x943a6cf8 in CFRunLoopRunInMode
#20 0x94e28da4 in RunCurrentEventLoopInMode
#21 0x94e28bbd in ReceiveNextEventCommon
#22 0x94e28a31 in BlockUntilNextEventMatchingListInMode
#23 0x9162d505 in _DPSNextEvent
#24	0x9162cdb8 in -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:]

#25 0x91625df3 in -[NSApplication run]
#26 0x915f3030 in NSApplicationMain
#27 0x394c in main at main.m:13


--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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:

Re: NSString uppercaseString

2008-06-27 Thread Shawn Erickson
On Fri, Jun 27, 2008 at 8:37 PM, Sam Mo [EMAIL PROTECTED] wrote:

 Could I assume if the doc does not mention releasing the memory, then I
 don't have to worry about it?

No :)

Read and understand the memory management programming guide for Cocoa.
Cocoa memory management is easy and consistent so as a result the API
documents only call out the exceptions to the rule and don't rehash
what is talked about in the memory management guide.

-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 [EMAIL PROTECTED]


while loop with sleep(): logging works, but not UI events

2008-06-27 Thread Daniel Richman

Hi All,

I'm trying to program a simple timer app: you enter a number of seconds, 
and it updates a text field every second with the number of secs 
remaining. The problem is that I'm not able to do anything with the UI 
while this is going on. Here's my code:


- (IBAction)startTimer:(id)sender
{
   [startButton setState:NSOffState];
  
   int timeInSeconds = [((NSNumber *)[inTextField objectValue]) intValue];
  
   while (timeInSeconds  0) {
   [outTextField setStringValue:[NSString stringWithFormat:@%d 
more second(s) to go, timeInSeconds]];
  
   sleep(1);

   timeInSeconds--;
   }
  
   [outTextField setStringValue:@Finished timing];

   NSBeep();
}

What's happening is that if I enter a number and then press 'start', 
'start' stays in the 'pressed' position until the loop finishes, after 
which it returns to the normal position. My guess is that this is 
stopping any other UI events from occurring. This would also explain why 
I'm able to log a message each time the loop iterates.


But I'm still not sure why the button is staying pressed. Thoughts, anyone?

Daniel
___

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 [EMAIL PROTECTED]


Re: while loop with sleep(): logging works, but not UI events

2008-06-27 Thread Shawn Erickson
On Fri, Jun 27, 2008 at 8:55 PM, Daniel Richman
[EMAIL PROTECTED] wrote:
 Hi All,

 I'm trying to program a simple timer app: you enter a number of seconds, and
 it updates a text field every second with the number of secs remaining. The
 problem is that I'm not able to do anything with the UI while this is going
 on. Here's my code:

Don't loop like this. Think about what is taking place... you are
looping never allowing your main thread to do anything else. Your loop
is not returning out to the normal runloop which handles user input
and drives your UI.

Look at using NSTimer to trigger a callback that will allow you to
update UI as needed.

-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 [EMAIL PROTECTED]


NSPopupButton Bindings-Related Issue

2008-06-27 Thread Keary Suska
Generally, my needs are simple. In this case, I need a sheet that displays
an nspopupbutton populated with product names, where a user can select an
item from the popup and a description of the item would appear in a
designated space below the control, and of course I want to retrieve the
value after the sheet is dismissed, providing that the correct button is
pressed. Sounds easy, right?

So, I have an NSPanel with an NSPopupButton, NSTextField, and two buttons
(Cancel and Use). The NSPopupButton content is bound to
ProductController, which is a special NSArrayController subclass whose
content is an array objects I am interested in, with key arrangedObjects
no key path. Content values is bound to same with key path name.
Selected value is bound to same but with controller key selection and
key path name. NSTextField value is bound to ProductController
selection key path descrip.

Okeydoke. BTW, there are some popup items that I want disabled, so I turn
off autoenableitems in awakeFromNib and disable them before I display the
sheet. Peachy keen cool. Popup appears as expected. However, when I select
an item, the NSTextField doesn't update. Furthermore, all of the disabled
items automagically enable (that's bad too). Crazy, huh?

Any ideas, anyone?

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business


___

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 [EMAIL PROTECTED]


Re: Why aren't my bindings firing?

2008-06-27 Thread Charles Srstka

On Jun 27, 2008, at 8:06 PM, Ken Thomases wrote:

A binding is not just an automated two-way connection between KVC/ 
KVO-conforming properties.


In particular, the binding name you pass to  
bind:toObject:withKeyPath:options: is not in the same namespace as  
properties.  Binding names are something else. Furthermore,  
implementing bindings is more than just creating KVC/KVO-conforming  
properties.  A binding is a specific feature of a class which  
requires a specific implementation.  See How Do Bindings Work? in  
the Cocoa Bindings Programming Topics to see code listings which  
illustrate the work that must be done to make a class support a  
binding.


http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html


You might be tempted to create a two-way connection between  
properties by using KVO.  It might work, but I suspect you'll get  
infinite loops.


As a matter of design, you shouldn't hook two properties up in this  
way to try to keep them always equal.  If they're always equal, why  
store the data in two places? The state of the application (or  
document or whatever) should be stored (once) in the model.  The  
controller is responsible for reading the state of the model and  
configuring the view to reflect that.  (Both parts of that may be  
automated using KVO, but note that both the controller and the view  
will have to implement specific response to the KVO notifications.   
The view's specific response is part of implementing a binding.)  In  
response to user manipulation, a view may inform the controller of  
some action or new value.  (Again, this part of the view's behavior  
may be implemented for a binding, in which case it might inform the  
controller using KVC.)  The controller in turn translates that  
action or value change into instructions to the model to modify  
itself.  (This is often custom, direct invocation of the model's  
methods, but may also be done via KVC.)


Well I'll admit that I'm relatively new to bindings, because most of  
the work I've done with Cocoa has been with old projects that  
originated prior to their introduction, so I haven't really been too  
much into the bindings concept, which is why I'm trying to get myself  
up to speed now, and pretty much teach myself how they work. With that  
said, aren't bindings *always* creating a two-way connection between  
properties? For example, say you have a generalized view like an  
NSTextField. It's got a property called stringValue which is set via  
the -stringValue and -setStringValue: methods. Sure, as a view, it's  
rendering an object from my model on the screen, but at the same time  
it's gotta store its data somewhere, because otherwise its drawRect:  
method won't know what it should draw, and of course NSTextField can't  
know about the objects in your model, because if it did, then it  
wouldn't work with any other models and would lose its generalization,  
working only with the specific model that existed in your application.  
Now normally, an app would set the NSTextField's stringValue  
property via the accessor methods, but now Bindings present us with a  
new way to bind a property in the model with the stringValue  
property in the NSTextField.


Or that's what I thought it was, anyway. If Bindings don't do that,  
then I'm a little confused as to what they actually *do*.


In my case, what I have is a document object and a bunch of view  
objects of a certain class. The view object's class wraps some  
portable code that I didn't write, and basically provide some glue  
between a portable C++ object and the Cocoa Obj-C system, with some  
drawing methods on top to display the object. The view has a title  
property set by the portable code (which my glue code bridges to the  
setter method of the view object when the portable code wants to  
change it). Usually the title is an independent property of the view  
class, but for this one particular instance of that class I want to  
bind it to my document's display name so that it will be the window's  
title, but only for that particular instance, not for every instance  
of the class. Now I could do that easily enough via notifications, and  
that's what I would have done in 2004, when I still had to support  
Jaguar, but part of the reason I'm trying to do this is because I'm  
trying to teach myself about the new stuff (I realize the concept of  
bindings is actually a few years old by now) so that I can get a grasp  
of what it is, and how to use it. In actuality, there would be a few  
more properties I'd want to bind later on, but first I need to know  
exactly what is the difference between binding the title of a view  
object to a variable in the model or controller, or doing the same  
thing with the many bindable properties exposed by view objects in  
Interface Builder, such as Font in an NSTextField, Tool Tip in a  
button, or Enabled or Hidden in pretty much anything. 

Re: while loop with sleep(): logging works, but not UI events

2008-06-27 Thread Shawn Erickson
On Fri, Jun 27, 2008 at 8:59 PM, Shawn Erickson [EMAIL PROTECTED] wrote:
 On Fri, Jun 27, 2008 at 8:55 PM, Daniel Richman
 [EMAIL PROTECTED] wrote:
 Hi All,

 I'm trying to program a simple timer app: you enter a number of seconds, and
 it updates a text field every second with the number of secs remaining. The
 problem is that I'm not able to do anything with the UI while this is going
 on. Here's my code:

 Look at using NSTimer to trigger a callback that will allow you to
 update UI as needed.

As Stephen noted... you need record the start time (or record the end
time) then check current time (look at NSDate) to ensure you count out
the requested amount of time. Also you should fire your timer every
0.75 of seconds (or so) to ensure your UI update is consistent/smooth.
Firing every second may cause your timer to fire a little after 1
second later so your UI could skip from say 50s to 52s.

-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 [EMAIL PROTECTED]


Re: Prevent Asynchronous operation of beginSheetModalForWindow

2008-06-27 Thread Graham Cox


On 28 Jun 2008, at 12:38 am, John Love wrote:


[code snipped]


Finally, you nailed it, almost (one small bug, see below). Phew!





Okay ... all the snippets are done ... now, the questions:

(1) warning: no doSheetSelection:contextInfo method found which, I  
think, is

due to the fact that the external class of mFileSheetDelegate =
FileController, yet when referenced in SaveSheetController, it's =  
id, a
general pointer.  But, I thought all anonymous pointers were  
resolved at
runtime ... am I just going to force myself to ignore this Build  
Warning,

knowing that it will all go away at runtime???



The reason for this is because the sheet controller is not aware of  
your File Controller's methods. Nor should it be. So how to resolve  
it? The answer is to declare the callback method as an informal  
protocol *within SheetController.h* Thus:


@interface NSObject (SheetSelectionDelegate)

- (void) doSheetSelection:(int)returnCode contextInfo: 
(void*)contextInfo;


@end

Now, your sheet controller does know that there is a method that has  
this signature, so the warning will go away. But because the method is  
defined as a category of NSObject, you still have avoided exposing  
SheetController to the inner workings of your FileController. This is  
the more precise, and correct meaning of informal protocol, and  
generally you implement them as categories on NSObject.



(2)I still get unrecognized selector .. but,


That's because you're targeting the wrong object. Here:

   [NSApp beginSheet:[self window]
 modalForWindow:parentWindow
 modalDelegate:theTarget		// 
-- uh-oh

 didEndSelector:@selector
(sheetDidEnd:returnCode:contextInfo:)
 contextInfo:contextInfo];

You should be passing 'self', not 'theTarget' as  modalDelegate. Why?  
Because it is the sheet controller that is the modal delegate of the  
*sheet*, which is what this specifies. The target is the delegate of  
the sheet *controller*, so the sheet itself doesn't want this. You  
already dealt with that by recording the target in your own ivar.


You have got to get these relationships straight in your mind. It's  
not that hard. I've goaded and prompted you and written your code for  
you piece by piece - that's great, it solves your problem. But has it  
increased your understanding? I fear it hasn't, and it still all seems  
like voodoo. I'm not sure what I can do about that.


cheers, Graham


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: simple question about passing around pointers to objects

2008-06-27 Thread Graham Cox

Then you'd be wrong. You should use [a autorelease];

G.


On 28 Jun 2008, at 10:19 am, Daniel Richman wrote:


I would use [a retain];



___

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 [EMAIL PROTECTED]


Re: simple question about passing around pointers to objects

2008-06-27 Thread Graham Cox

Actually, in the context of this:

NSArray *a = [NSArray arrayFromObjects:someObject, anotherObject, nil];

you would do nothing, since that method returns an autoreleased  
NSAarray already.



But in a situation where you alloc/inited an object, you would  
autorelease before returning it.




G.




On 28 Jun 2008, at 2:21 pm, Graham Cox wrote:


Then you'd be wrong. You should use [a autorelease];

G.


On 28 Jun 2008, at 10:19 am, Daniel Richman wrote:


I would use [a retain];



___

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/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Style Question

2008-06-27 Thread Alex Wait
I have noticed, coming from C++ and Visual Studio (at school), a couple
style differences

if (value) {
//do something
}

insteasd of

if (value)
{
//do something
}

Also since I am using this style, XCode doesn't tab in for me when I type {
then a return. This is the style I taught and I would like to continue the
good habits
during the summer.

Is this a Cocoa style? I've seen it on this mailing list and in the
Hillegeass book.

-- 
If you can't be kind, at least have the decency to be vague.
___

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 [EMAIL PROTECTED]


Re: Style Question

2008-06-27 Thread Shawn Erickson
On Fri, Jun 27, 2008 at 9:30 PM, Alex Wait [EMAIL PROTECTED] wrote:

 Also since I am using this style, XCode doesn't tab in for me when I type {
 then a return.

It will if you enable it (at least it always does for me).

Use whatever coding style you want however do try to follow Cocoa like
naming convention.

Personally for methods I have the { on the line following the method
definition while for all other blocks (most other) I have the { at the
trailing end of the line (aka end of the if statement line, etc.).

-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 [EMAIL PROTECTED]


Re: Style Question

2008-06-27 Thread Alex Wait
I got another Style related question.

if I have a member, let's say a NSString, called FirstName...

would the setter still be setFirstName?

I notice how it capitalizes the first letter even if the member doesn't
start with a capital letter.
if I have a three word named variable, let's say firstNameFirst
how would it find it? Or does it do a case insensitive compare?


On Fri, Jun 27, 2008 at 9:40 PM, Shawn Erickson [EMAIL PROTECTED] wrote:

 On Fri, Jun 27, 2008 at 9:30 PM, Alex Wait [EMAIL PROTECTED] wrote:

  Also since I am using this style, XCode doesn't tab in for me when I type
 {
  then a return.

 It will if you enable it (at least it always does for me).

 Use whatever coding style you want however do try to follow Cocoa like
 naming convention.

 Personally for methods I have the { on the line following the method
 definition while for all other blocks (most other) I have the { at the
 trailing end of the line (aka end of the if statement line, etc.).

 -Shawn




-- 
If you can't be kind, at least have the decency to be vague.
___

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 [EMAIL PROTECTED]


Re: Style Question

2008-06-27 Thread Rob Ross

I love this one. This becomes a religious issue for some people.

Both styles are popular, you should feel comfortable reading either  
one. Write in the one you like best.


Btw, how many people realize this convention comes from the early KR  
C book, and the *only* reason they wrote it this way was to minimize  
the number of lines of text their examples would take up on each  
page? It's a type-setting design decision, and has nothing to do with  
how pure a programmer you are.


On the tabbing issue, XCode seems to format each line *after* you hit  
return. It usually fixes the line and does the right thing. So type  
your {, hit return, type your next line, hit return, and see if that  
then indents the previous line for you.



Rob Ross, Lead Software Engineer
E! Networks

---
Beware of he who would deny you access to information, for in his  
heart he dreams himself your master. -- Commissioner Pravin Lal




On Jun 27, 2008, at 9:30 PM, Alex Wait wrote:

I have noticed, coming from C++ and Visual Studio (at school), a  
couple

style differences

if (value) {
//do something
}

insteasd of

if (value)
{
//do something
}

Also since I am using this style, XCode doesn't tab in for me when  
I type {
then a return. This is the style I taught and I would like to  
continue the

good habits
during the summer.

Is this a Cocoa style? I've seen it on this mailing list and in the
Hillegeass book.

--
If you can't be kind, at least have the decency to be vague.
___

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/rob.ross%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Style Question

2008-06-27 Thread Shawn Erickson
On Fri, Jun 27, 2008 at 9:44 PM, Alex Wait [EMAIL PROTECTED] wrote:
 I got another Style related question.

/me points at ...

http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/index.html

-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 [EMAIL PROTECTED]


Re: NSString uppercaseString

2008-06-27 Thread Jens Alfke


On 27 Jun '08, at 8:51 PM, Shawn Erickson wrote:

Could I assume if the doc does not mention releasing the memory,  
then I

don't have to worry about it?


No :)


Well, to respond a bit more positively, it's not what the doc says so  
much as what the method's named, that tells you what its behavior is.


In general, only the methods alloc, new, copy and mutableCopy  
create references that you're responsible for releasing. In all other  
cases you're not responsible for releasing the object returned; either  
it belongs to another object already, or it's already been  
autoreleased so it'll be cleaned up later.


There are some details/subtleties (some having to do with the exact  
lifespan of a returned object) but the above is most of what you need  
to keep in mind.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Style Question

2008-06-27 Thread Jens Alfke


On 27 Jun '08, at 9:44 PM, Alex Wait wrote:


if I have a member, let's say a NSString, called FirstName...
would the setter still be setFirstName?


Yes. But you shouldn't name the property FirstName. Property and  
method (and instance variable) names should be lowercased. There are  
some exceptions made when the name begins with an acronym, most  
commonly URL, that needs to remain uppercase for legibility.


Honestly, no one reading your code is going to care whether you put  
braces at the end of a line or on a new line. But naming conventions  
are important and can help or confuse other people (or yourself, a  
year later) trying to understand it.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Style Question

2008-06-27 Thread Alex Wait
I was meaning to imply that if it was called FirstName would setFirstName
still be called?

I know the convention for naming variables. :)

On Fri, Jun 27, 2008 at 10:13 PM, Jens Alfke [EMAIL PROTECTED] wrote:


 On 27 Jun '08, at 9:44 PM, Alex Wait wrote:

  if I have a member, let's say a NSString, called FirstName...
 would the setter still be setFirstName?


 Yes. But you shouldn't name the property FirstName. Property and method
 (and instance variable) names should be lowercased. There are some
 exceptions made when the name begins with an acronym, most commonly URL,
 that needs to remain uppercase for legibility.

 Honestly, no one reading your code is going to care whether you put braces
 at the end of a line or on a new line. But naming conventions are important
 and can help or confuse other people (or yourself, a year later) trying to
 understand it.

 —Jens




-- 
If you can't be kind, at least have the decency to be vague.
___

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 [EMAIL PROTECTED]


KVO Question -- Really Simple for Pros

2008-06-27 Thread Alex Wait
Practicing some KVO concepts.

I have this line

[person addObserver:textField forKeyPath:@firstName
options:NSKeyValueObservingOptionNew context:NULL];


person is App Controller's Person object.
textField is a NSTextField
person does have a firstName property of type NSString

When I click on a button that updates the firstName property I get this
message

2008-06-27 22:17:29.751 Bindings1[21896:10b] NSTextField: 0x123c30: An
-observeValueForKeyPath:ofObject:change:context: message was received but
not handled.
Key path: firstName
Observed object: firstName: Basic and lastName: Wait
Change: {
kind = 1;
new = Basic;
}
Context: 0x0


At least it's firing! ^_^
But I was sure since I have a firstName method and a setFirstName method it
would update the textField. I have used IB to bind the value of the
textField to the value of the person object and that works when I edit the
textfield (yay). So I know I have the proper methods. I think.

Am I doing something wrong? (I assume I am)

-- 
If you can't be kind, at least have the decency to be vague.
___

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 [EMAIL PROTECTED]


Re: KVO Question -- Really Simple for Pros

2008-06-27 Thread mmalc crawford


On Jun 27, 2008, at 10:20 PM, Alex Wait wrote:

But I was sure since I have a firstName method and a setFirstName  
method it

would update the textField. I have used IB to bind the value of the
textField to the value of the person object and that works when I  
edit the

textfield (yay). So I know I have the proper methods. I think.


Observing != binding:
	http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html 



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 [EMAIL PROTECTED]


Re: KVO Question -- Really Simple for Pros

2008-06-27 Thread Alex Wait
could you be more specific that just a link? ;)

On Fri, Jun 27, 2008 at 10:23 PM, mmalc crawford [EMAIL PROTECTED]
wrote:


 On Jun 27, 2008, at 10:20 PM, Alex Wait wrote:

  But I was sure since I have a firstName method and a setFirstName method
 it
 would update the textField. I have used IB to bind the value of the
 textField to the value of the person object and that works when I edit the
 textfield (yay). So I know I have the proper methods. I think.

  Observing != binding:

 http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html
 

 mmalc




-- 
If you can't be kind, at least have the decency to be vague.
___

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 [EMAIL PROTECTED]


Re: Help getting custom cell layout in NSOutlineView column

2008-06-27 Thread Sebastian Nowicki


On 28/06/2008, at 2:57 AM, Sebastian Nowicki wrote:



On 28/06/2008, at 12:05 AM, j o a r wrote:


This is a good piece of sample code to show how to create a complex
custom cell subclass:

http://developer.apple.com/samplecode/PhotoSearch/

j o a r



Thanks, that helped a lot. I've got a problem changing the height of  
the cell. Whatever I try to do it doesn't seem to want to get  
larger. Do I have to set something in the table or somewhere else to  
make it change?


cellSizeForBounds: returns a height value of 74, while  
drawInteriorWithFrame:inView: recieves an NSRect with a height value  
of 17. How do I get drawInteriorWithFrame:inView: to receive the  
proper value? cellSizeForBounds: doesn't even get called until I hover  
over a cell for a few seconds. What method am I supposed to override  
to tell the table the real height value? I don't see anything from the  
example that would do that. As far as I can tell I have everything  
implemented that the sample does.

smime.p7s
Description: S/MIME cryptographic signature
___

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 [EMAIL PROTECTED]