Re: “EXC_BAD_ACCESS” on Custom TableV iew with custom NSCell when clicking.

2010-02-18 Thread Gustavo Pizano
Hello Corbin.

ok, so I read your blog post, its great, I love it.

I followed what you said there with my application, when the app crashes I see 
the address, I search for it and I see only one result, so I click the arrow  
next to the address to check the history and I have this situation.
first I have a Malloc, responsible CoreData, responsible caller [NSSQLCore 
_prepareResultsFromResultSet:usingFetchPlan:withMatchingRows:],
and right after that event I have the Zombie. responsible CoreData, Responsible 
caller [NSManageObject objectDictionaryWithValuesForKeys:]

So when I click the zombie and check the extended view, the last line of code 
that I have control over is the accessor for the userDictionary attribute in 
the User ManagedObject, which has these lines of code.

-(NSDictionary *)userDictionary{
return [self dictionaryWithValuesForKeys:[NSArray 
arrayWithObjects:@"firstName",@"lastName",@"avatar",@"title",nil]];
}

I also have this line of code in the User ManageDObject
+(NSSet *)keyPathsForValuesAffectingUserDictionary{
return [NSSet 
setWithObjects:@"firstName",@"lastName",@"avatar",@"title",nil];
}
dunno if this affects in somehow.. I stilld on't get what for is it, i think 
its to track changes of the object for those keys.

So, if I have comming back to the initial quesiton, if I have no ivars in the 
cusotm NSCell, Im just drawing the values in the values like this

-(void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView{

NSDictionary * cellValues = [self objectValue]; 
NSString * firstName = [cellValues valueForKey:@"firstName"];
NSString * lastName = [cellValues valueForKey:@"lastName"];

...
}
then what am I doing wrong?

thx.
Gustavo


On Feb 17, 2010, at 11:31 PM, Corbin Dunn wrote:

> 
> On Feb 17, 2010, at 2:14 PM, Gustavo Pizano wrote:
> 
>> 
>> On Feb 17, 2010, at 11:03 PM, Jim Correia wrote:
>> 
>>> On Feb 17, 2010, at 4:41 PM, Gustavo Pizano wrote:
>>> 
 Maybe I misunderstood I must conform NSCopying protocol also even when 
 using core data? 
>>> 
>>> If you have an NSCell subclass which adds iVars, you must implement 
>>> -copyWithZone: to do correct memory management.
>>> 
>>> Your -copyWithZone: needs to work correctly within the bounds of the object 
>>> ownership rules.
>>> 
>>> If you have an object iVar which shouldn’t be copied, but is still an owned 
>>> reference, then you can (and must) retain it instead in the copy.
>>> 
>>> (You should do this for all cells with iVars, not just ones with object 
>>> iVars, so that your subclass will behave correctly in the future even if 
>>> NSCell doesn’t implement its behavior using NSCopyObject.)
>>> 
>>> - Jim
>> 
>> Hello Jim
>> HMM digging more into the problem.. definitely it seems because Im not 
>> copying properly the NSManagedObject Paul Robinson says in one old post:
>> 
>> "The short answer is that you need to override the setObjectValue: method 
>> (which tries to copy your uncopyable NSManagedObject) in your custom NSCell 
>> to convert your NSManagedObject into an NSValue (which is copyable)."
>> 
>> 
>> And taking what you said,  so if my User ManagedObject returns me the 
>> NSDictionary with the key-value of its attributes, then in the cell I must 
>> set it as an ivar within the method setObjectValue, then implement the 
>> copyWithZone and return the copy of it isn't it? right now I don't have any 
>> ivar in my custom cell.. sooo .  := :S.
> 
> I think Jim and I are leading you off track; if your cell has no extra ivars, 
> then you don't have to worry about the cell implementing copyWithZone:.
> 
> I still think you should read my blog posting and see why the crash happens 
> with zombies on.
> 
> 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 arch...@mail-archive.com


Re : Proper way to initialize application support file

2010-02-18 Thread Peter Hudson
"  Files that are necessary should be inside your app bundle,  
usually."




I put some files into the app bundle which were essential for the app  
to run -

but also needed to be modified at run time.

The first time our app was installed on a server ( for a number of  
users to have access to )
we got into trouble as the sysadmin would not give write permission on  
the application folder

to anybody.

Is there another way to do this ?

Peter



___

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

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

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

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


Re: Re : Proper way to initialize application support file

2010-02-18 Thread Graham Lee

On 18 Feb 2010, at 09:36, Peter Hudson wrote:

> "  Files that are necessary should be inside your app bundle, usually."
> 
> 
> 
> I put some files into the app bundle which were essential for the app to run -
> but also needed to be modified at run time.
> 

Those definitely shouldn't be changed inside the app bundle, as you'll break 
your code's identity.

> The first time our app was installed on a server ( for a number of users to 
> have access to )
> we got into trouble as the sysadmin would not give write permission on the 
> application folder
> to anybody.
> 
> Is there another way to do this ?


You could _distribute_ them in the app bundle, then copy the files to 
~/Library/Application Support/com.yourcompany.yourapp/ when it is first 
launched. Use and change the deployed copies from then on.


Cheers,
Graham.

-- 
Graham Lee
http://blog.securemacprogramming.com/
Coming soon - Professional Cocoa Application Security
http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0470525959.html

___

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

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

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

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


cocoa API to get List of hard disk Partitions

2010-02-18 Thread Arjun SM
Hi,

   Can any one help me out on How I can get the List of all hard disk
partions mounted on the the System along with the Icon, just like Disk
Utility application does. (Image below.)


[image:
?ui=2&view=att&th=126df98c109f6b52&attid=0.1&disp=attd&realattid=ii_126df98c109f6b52&zw]


I have used the  NSWorkspace : iconForFile:path,  by passing the "/" for the
Path and  this would return an image of the boot partions only.

thanks,
~Arjun
<>___

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

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

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

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

Re: Spotlight while running windows modal

2010-02-18 Thread jonat...@mugginsoft.com

On 18 Feb 2010, at 05:30, Kiel Gillard wrote:

> Hi all,
> 
> I'm trying to cancel a modal NSAlert when Spotlight determines a file exists 
> in the file system. I create and start the NSMetadataQuery before I run the 
> alert modal. However I do not receive notifications of changes to my metadata 
> query while my application is running modal.
> 
> The docs indicate NSMetadataQuery and MDQuery operate on particular modes of 
> an application's run loop however I am required to run the NSAlert modal.
> 
> I used an NSAlert with a modal session but that produced strange results. 
> These results did not include the observer receiving the appropriate 
> notifications for changes to my metadata query.
> 
> Is there some way I can have the best of both worlds?
> 
You could try using a modal sheet, if it fits your modal requirements:

// show the save sheet
[NSApp beginSheet:[self window] modalForWindow:_modalForWindow 
modalDelegate:self 
   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
  contextInfo:NULL];

I use such a configuration and my app continues to receive events from my run 
loop attached network sources.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com

> Thanks in advance,
> 
> Kiel
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jonathan%40mugginsoft.com
> 
> This email sent to jonat...@mugginsoft.com

___

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

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

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

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


Re: cocoa API to get List of hard disk Partitions

2010-02-18 Thread Kiel Gillard
On 18/02/2010, at 8:44 PM, Arjun SM wrote:

> Hi,
> 
>   Can any one help me out on How I can get the List of all hard disk
> partions mounted on the the System along with the Icon, just like Disk
> Utility application does. (Image below.)
> 
> 
> [image:
> ?ui=2&view=att&th=126df98c109f6b52&attid=0.1&disp=attd&realattid=ii_126df98c109f6b52&zw]
> 
> 
> I have used the  NSWorkspace : iconForFile:path,  by passing the "/" for the
> Path and  this would return an image of the boot partions only.
> 

See this sample code from Apple 


HTH,

Kiel

> thanks,
> ~Arjun
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


NSPropertyListSerialization error with apparently OK data

2010-02-18 Thread Graham Cox
I have a structure I'm trying to write as an xml plist. The structure is an 
array of dictionaries, each dictionary contains a string "catname" and another 
array of dictionaries, "items". The second level of dictionaries consist of two 
strings each, "id" and "name".

Example:

(gdb) po catList
(
{
catname = "Legends & Inset Maps";
items = {(
{
id = "7CBC1609-ADFB-4CA9-A748-CABE9076842F";
name = "World - eastern hemisphere";
},
{
id = "402DEB4D-8C2E-4F4D-9151-E6BA01D194E7";
name = "World - western hemisphere";
},
{
id = "6500292B-FDE1-45B7-AFD9-8A0136B25717";
name = "Legend 4";
},
{
id = "CC96E4F2-1B20-4496-8962-15B617B3FAF9";
name = "Legend 2";
},
 ... hundreds of similar entries omitted...
)};
},
{
catname = "DrawKit Defaults";
items = {(
{
id = "6B1A0430-204A-4012-B96D-A4EE9890A2A3";
name = "Basic Track";
},
{
id = "1DFD6D8A-6C8B-4E4B-9186-90F64654F79F";
name = Basic;
},
{
id = "326CF635-7863-42C6-900D-CFFC7D57505E";
name = "Helvetica 18.0pt";
}
)};
}
)

When I submit this array to the serialization method:

NSData* data = [NSPropertyListSerialization 
dataFromPropertyList:catList format:NSPropertyListXMLFormat_v1_0 
errorDescription:&errDesc];

(I know this is deprecated from 10.6 forward but I need to support 10.5 for now)
I get the error:

 "Property list invalid for format"

Since I'm only using arrays, dictionaries and strings, that should be a valid 
plist, shouldn't it? I've missed something, but what?

I'm also wondering why some strings appear quoted and others are not when I 
dump the structure in gdb, and whether that's significant.

--Graham




___

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

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

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

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


Re: NSPropertyListSerialization error with apparently OK data

2010-02-18 Thread Matt Gough
Don't know, but maybe 'id' is reserved.

I seem to recall a similar issue with archiving strings that were "NULL" or 
"nil" or something.

Matt
On 18 Feb 2010, at 11:25:10, Graham Cox wrote:

> I have a structure I'm trying to write as an xml plist. The structure is an 
> array of dictionaries, each dictionary contains a string "catname" and 
> another array of dictionaries, "items". The second level of dictionaries 
> consist of two strings each, "id" and "name".
> 
> Example:
> 
> (gdb) po catList
> (
> {
>catname = "Legends & Inset Maps";
>items = {(
>{
>id = "7CBC1609-ADFB-4CA9-A748-CABE9076842F";
>name = "World - eastern hemisphere";
>},
>{
>id = "402DEB4D-8C2E-4F4D-9151-E6BA01D194E7";
>name = "World - western hemisphere";
>},
>{
>id = "6500292B-FDE1-45B7-AFD9-8A0136B25717";
>name = "Legend 4";
>},
>{
>id = "CC96E4F2-1B20-4496-8962-15B617B3FAF9";
>name = "Legend 2";
>},
> ... hundreds of similar entries omitted...
> )};
> },
> {
>catname = "DrawKit Defaults";
>items = {(
>{
>id = "6B1A0430-204A-4012-B96D-A4EE9890A2A3";
>name = "Basic Track";
>},
>{
>id = "1DFD6D8A-6C8B-4E4B-9186-90F64654F79F";
>name = Basic;
>},
>{
>id = "326CF635-7863-42C6-900D-CFFC7D57505E";
>name = "Helvetica 18.0pt";
>}
> )};
> }
> )
> 
> When I submit this array to the serialization method:
> 
>   NSData* data = [NSPropertyListSerialization 
> dataFromPropertyList:catList format:NSPropertyListXMLFormat_v1_0 
> errorDescription:&errDesc];
> 
> (I know this is deprecated from 10.6 forward but I need to support 10.5 for 
> now)
> I get the error:
> 
> "Property list invalid for format"
> 
> Since I'm only using arrays, dictionaries and strings, that should be a valid 
> plist, shouldn't it? I've missed something, but what?
> 
> I'm also wondering why some strings appear quoted and others are not when I 
> dump the structure in gdb, and whether that's significant.
> 
> --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/mgough%40humyo.com
> 
> This email sent to mgo...@humyo.com

___

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

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

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

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


Re: NSPropertyListSerialization error with apparently OK data

2010-02-18 Thread Graham Cox

On 18/02/2010, at 10:29 PM, Matt Gough wrote:

> Don't know, but maybe 'id' is reserved.


Well, I just tried changing that to something else and I get the same problem. 
I also tried using NSPropertyListBinaryFormat_v1_0 and I still get the same 
error.

--Graham


___

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

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

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

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


Re: NSPropertyListSerialization error with apparently OK data

2010-02-18 Thread Jean-Daniel Dupas

Don't think so, archiving is not serialization and it's just a dump of the 
object in XML/binary format, so you can't have reserved keyword.


The plist look definitively OK. (it's even possible to import it in Plist 
Editor as a text formatted plist if you remove the extra '{' '}' enclosing the 
inner array).

I'm almost sure it will not help, but you may try the 10.6 function which 
returns an NSError. Maybe the NSError is more informative than the returned 
error string.

And you can also try with subset of the list to determine if a specific entry 
in your list is the culprit.

Le 18 févr. 2010 à 12:29, Matt Gough a écrit :

> Don't know, but maybe 'id' is reserved.
> 
> I seem to recall a similar issue with archiving strings that were "NULL" or 
> "nil" or something.
> 
> Matt
> On 18 Feb 2010, at 11:25:10, Graham Cox wrote:
> 
>> I have a structure I'm trying to write as an xml plist. The structure is an 
>> array of dictionaries, each dictionary contains a string "catname" and 
>> another array of dictionaries, "items". The second level of dictionaries 
>> consist of two strings each, "id" and "name".
>> 
>> Example:
>> 
>> (gdb) po catList
>> (
>> {
>>   catname = "Legends & Inset Maps";
>>   items = {(
>>   {
>>   id = "7CBC1609-ADFB-4CA9-A748-CABE9076842F";
>>   name = "World - eastern hemisphere";
>>   },
>>   {
>>   id = "402DEB4D-8C2E-4F4D-9151-E6BA01D194E7";
>>   name = "World - western hemisphere";
>>   },
>>   {
>>   id = "6500292B-FDE1-45B7-AFD9-8A0136B25717";
>>   name = "Legend 4";
>>   },
>>   {
>>   id = "CC96E4F2-1B20-4496-8962-15B617B3FAF9";
>>   name = "Legend 2";
>>   },
>> ... hundreds of similar entries omitted...
>> )};
>> },
>> {
>>   catname = "DrawKit Defaults";
>>   items = {(
>>   {
>>   id = "6B1A0430-204A-4012-B96D-A4EE9890A2A3";
>>   name = "Basic Track";
>>   },
>>   {
>>   id = "1DFD6D8A-6C8B-4E4B-9186-90F64654F79F";
>>   name = Basic;
>>   },
>>   {
>>   id = "326CF635-7863-42C6-900D-CFFC7D57505E";
>>   name = "Helvetica 18.0pt";
>>   }
>> )};
>> }
>> )
>> 
>> When I submit this array to the serialization method:
>> 
>>  NSData* data = [NSPropertyListSerialization 
>> dataFromPropertyList:catList format:NSPropertyListXMLFormat_v1_0 
>> errorDescription:&errDesc];
>> 
>> (I know this is deprecated from 10.6 forward but I need to support 10.5 for 
>> now)
>> I get the error:
>> 
>> "Property list invalid for format"
>> 
>> Since I'm only using arrays, dictionaries and strings, that should be a 
>> valid plist, shouldn't it? I've missed something, but what?
>> 
>> I'm also wondering why some strings appear quoted and others are not when I 
>> dump the structure in gdb, and whether that's significant.
>> 
>> --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/mgough%40humyo.com
>> 
>> This email sent to mgo...@humyo.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/devlists%40shadowlab.org
> 
> This email sent to devli...@shadowlab.org

-- Jean-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 arch...@mail-archive.com


Re: NSPropertyListSerialization error with apparently OK data

2010-02-18 Thread Graham Cox

On 18/02/2010, at 10:44 PM, Jean-Daniel Dupas wrote:

> And you can also try with subset of the list to determine if a specific entry 
> in your list is the culprit.


OK, seems likely to be the problem, unless it's the sheer size. The list has 
several thousand entries, but I haven't read of any restrictions anywhere.

--Graham


___

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

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

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

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


NSTableViewDataSource Protocol

2010-02-18 Thread Michael Davey
Hi,

I am writing an app that needs to be able to target 10.5 at least and hopefully 
10.4, but I have just found that the way that table views are handled has 
changed - does anyone have a link to some documentation for the old way to do 
things?

Many thanks,

Mikey___

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

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

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

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


Re : Proper way to initialize application support file

2010-02-18 Thread Peter Hudson

I'm getting confused.

It seems that any files that are 'essential to the running of the  
app'  are placed in the bundle.


It also seems that any files that are 'essential to the running of the  
app',  if they are in the bundle,  must not be modified.


The type of files which I put in the bundle are both essential for the  
app to run and need ( from time to time ) to be modified.


Copying from bundle to elsewhere and then modifying the copies is not  
a runner - as the user would want their format data back as it was  
when they restart the app.




Peter


___

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

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

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

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


Re: NSTableViewDataSource Protocol

2010-02-18 Thread Graham Cox

On 18/02/2010, at 11:07 PM, Michael Davey wrote:

>  I have just found that the way that table views are handled has changed


That's news to the rest of us! NSTableView dataSource still works just fine.

--Graham


___

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

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

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

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


Re: NSTableViewDataSource Protocol

2010-02-18 Thread Michael Davey
Weird, cos when I change the Active SDK in Xcode to 10.5 I get the following 
error:

cannot find protocol declaration for 'NSTableViewDataSource'

And the docs here: 

http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html

Suggest that it is available to 10.6 and later

Any idea what I might be doing wrong?

On 18 Feb 2010, at 12:14, Graham Cox wrote:

> 
> On 18/02/2010, at 11:07 PM, Michael Davey wrote:
> 
>> I have just found that the way that table views are handled has changed
> 
> 
> That's news to the rest of us! NSTableView dataSource still works just fine.
> 
> --Graham
> 
> 

___

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

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

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

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


Re: Re : Proper way to initialize application support file

2010-02-18 Thread Graham Cox

On 18/02/2010, at 11:09 PM, Peter Hudson wrote:

> I'm getting confused.
> 
> It seems that any files that are 'essential to the running of the app'  are 
> placed in the bundle.
> 
> It also seems that any files that are 'essential to the running of the app',  
> if they are in the bundle,  must not be modified.
> 
> The type of files which I put in the bundle are both essential for the app to 
> run and need ( from time to time ) to be modified.
> 
> Copying from bundle to elsewhere and then modifying the copies is not a 
> runner - as the user would want their format data back as it was when they 
> restart the app.


Think of it this way. Files you open directly from your bundle should be 
considered READ ONLY. Therefore if you want to use a modified version, you have 
to copy them elsewhere so that they can be read/write, and that somewhere else 
is usually ~/Library/Application Support//

I don't see a conflict between this and your users getting the modified 
versions when they rerun the app. The modified files are still right where you 
left them. Your app will need to perform some sort of merge between the 
unmodified bundle version and any modified versions it finds in app support, so 
that the total set of files the user is working with is the latest. It can be a 
lot of work - in fact I'm working on something like that right now.

If you mean they need up-to-date files if the app is moved to another machine 
or installed for another user, there's not a lot you can do about that except 
instruct them to take the modified files with them. Most apps would not be 
designed that way.

--Graham


___

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

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

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

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


Re: NSTableViewDataSource Protocol

2010-02-18 Thread Graham Cox

On 18/02/2010, at 11:21 PM, Michael Davey wrote:

> Weird, cos when I change the Active SDK in Xcode to 10.5 I get the following 
> error:
> 
> cannot find protocol declaration for 'NSTableViewDataSource'
> 
> And the docs here: 
> 
> http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html
> 
> Suggest that it is available to 10.6 and later
> 
> Any idea what I might be doing wrong?
> 


In 10.6, NSTableViewDataSource became a formal protocol, where previously it 
was an informal one. While the docs are strictly correct, they're a bit 
misleading since the methods of the protocol have been available since 10.0

If your datasource is declared thus:

@interface MyDS 

...

@end

you need to remove the angle bracket part for 10.5

--Graham


___

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

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

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

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


Re: NSTableViewDataSource Protocol

2010-02-18 Thread Mike Abdullah
All that's changed is it's gone from an informal protocol:

@interface NSObject (NSTableViewDataSource)
...
@end

to a formal one:

@protocol NSTableViewDataSource 
...
@end



On 18 Feb 2010, at 12:07, Michael Davey wrote:

> Hi,
> 
> I am writing an app that needs to be able to target 10.5 at least and 
> hopefully 10.4, but I have just found that the way that table views are 
> handled has changed - does anyone have a link to some documentation for the 
> old way to do things?
> 
> Many thanks,
> 
> Mikey___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

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

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

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


Re: NSTableViewDataSource Protocol

2010-02-18 Thread Michael Davey
My class is describes as follows:

@interface AppController : NSObject 


I tried removing NSObject and putting it there, but that did not work - any 
clues?

Thanks, btw

On 18 Feb 2010, at 12:28, Graham Cox wrote:

> 
> On 18/02/2010, at 11:21 PM, Michael Davey wrote:
> 
>> Weird, cos when I change the Active SDK in Xcode to 10.5 I get the following 
>> error:
>> 
>> cannot find protocol declaration for 'NSTableViewDataSource'
>> 
>> And the docs here: 
>> 
>> http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html
>> 
>> Suggest that it is available to 10.6 and later
>> 
>> Any idea what I might be doing wrong?
>> 
> 
> 
> In 10.6, NSTableViewDataSource became a formal protocol, where previously it 
> was an informal one. While the docs are strictly correct, they're a bit 
> misleading since the methods of the protocol have been available since 10.0
> 
> If your datasource is declared thus:
> 
> @interface MyDS 
> 
> ...
> 
> @end
> 
> you need to remove the angle bracket part for 10.5
> 
> --Graham
> 
> 

___

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

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

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

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


Re: Proper way to initialize application support file

2010-02-18 Thread Stuart Malin
On Feb 18, 2010, at 12:30 AM, Paul Johnson wrote:

> I see the data I get from the internet as not in the strictest sense
> 'necessary' for the program to run, just that it would be unable to do
> very much without it. So using my loose definition, the Application
> Support folder would be the place to create my data file.

This does not to me sound like a loose definition, and in my opinion this is 
exactly the kind of circumstance in which you should use the Application 
Support folder. If that data is specific to a user, then put it in 
~/Application Support/appInfo. You can (and should) get the path for such 
directories  from NSPathUtilities:

For the system's Application Folder:
NSArray *paths = 
NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, 
NSSystemDomainMask, YES); 
s = [paths objectAtIndex:0];

For the user's Application Folder:
NSArray *paths = 
NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, 
NSUserDomainMask, YES); 
s = [paths objectAtIndex:0];

NSSearchPathForDirectoriesInDomains is described in Foundation Functions 
Reference. Values for the parameters (NSSearchPathDirectory and 
NSSearchPathDomainMask) are described in  the Foundation Data Types Reference. 
Or just look at the enums declared in NSPathUtilities.h


___

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

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

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

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


Re: NSTableViewDataSource Protocol

2010-02-18 Thread Graham Cox

On 18/02/2010, at 11:37 PM, Michael Davey wrote:

> My class is describes as follows:
> 
> @interface AppController : NSObject 
> 
> 
> I tried removing NSObject and putting it there, but that did not work - any 
> clues?
> 
> Thanks, btw
> 


Yes, do what I told you, remove the NSTableViewDataSource from the protocol 
list, like this:

> @interface AppController : NSObject 

--Graham


___

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

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

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

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


Fwd: Re : Proper way to initialize application support file

2010-02-18 Thread Peter Hudson



Begin forwarded message:


From: Peter Hudson 
Date: 18 February 2010 12:46:55 GMT
To: Graham Cox 
Subject: Re: Re : Proper way to initialize application support file

I started out this way to avoid exactly the problem you get from  
requiring users to move critical files around.  Most of our users  
are not comfortable with computers, let alone moving files  
around !   Add in the problem of making sure they read the right  
pages of the manual ( if they can find it ) and then do this through  
language barriers ... ( we run in many languages ) ..


Peter


On 18 Feb 2010, at 12:22, Graham Cox wrote:



On 18/02/2010, at 11:09 PM, Peter Hudson wrote:


I'm getting confused.

It seems that any files that are 'essential to the running of the  
app'  are placed in the bundle.


It also seems that any files that are 'essential to the running of  
the app',  if they are in the bundle,  must not be modified.


The type of files which I put in the bundle are both essential for  
the app to run and need ( from time to time ) to be modified.


Copying from bundle to elsewhere and then modifying the copies is  
not a runner - as the user would want their format data back as it  
was when they restart the app.



Think of it this way. Files you open directly from your bundle  
should be considered READ ONLY. Therefore if you want to use a  
modified version, you have to copy them elsewhere so that they can  
be read/write, and that somewhere else is usually ~/Library/ 
Application Support//


I don't see a conflict between this and your users getting the  
modified versions when they rerun the app. The modified files are  
still right where you left them. Your app will need to perform some  
sort of merge between the unmodified bundle version and any  
modified versions it finds in app support, so that the total set of  
files the user is working with is the latest. It can be a lot of  
work - in fact I'm working on something like that right now.


If you mean they need up-to-date files if the app is moved to  
another machine or installed for another user, there's not a lot  
you can do about that except instruct them to take the modified  
files with them. Most apps would not be designed that way.


--Graham







___

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

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

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

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


Re: NSTableViewDataSource Protocol

2010-02-18 Thread Michael Davey
OK, just did some reading on informal protocols, thanks a lot for your help

Mikey


On 18 Feb 2010, at 12:40, Graham Cox wrote:

> 
> On 18/02/2010, at 11:37 PM, Michael Davey wrote:
> 
>> My class is describes as follows:
>> 
>> @interface AppController : NSObject 
>> 
>> 
>> I tried removing NSObject and putting it there, but that did not work - any 
>> clues?
>> 
>> Thanks, btw
>> 
> 
> 
> Yes, do what I told you, remove the NSTableViewDataSource from the protocol 
> list, like this:
> 
>> @interface AppController : NSObject 
> 
> --Graham
> 
> 

___

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

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

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

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


Re: Re : Proper way to initialize application support file

2010-02-18 Thread Graham Cox

On 18/02/2010, at 11:46 PM, Peter Hudson wrote:

> I started out this way to avoid exactly the problem you get from requiring 
> users to move critical files around.  Most of our users are not comfortable 
> with computers, let alone moving files around !   Add in the problem of 
> making sure they read the right pages of the manual ( if they can find it ) 
> and then do this through language barriers ... ( we run in many languages ) 


I'm not suggesting they do move the files around. Your app can move them around 
to do what it needs to do, and the user is none the wiser. They need not care 
if a resource they are using comes from the bundle or from app support, it Just 
Works, right?

Since you haven't really defined what these files are or how they're used, I 
can only give general and vague suggestions. My app does something apparently 
similar - we supply a default set of content in the form of graphics and these 
come in the bundle. On first startup we copy the file to app support so that 
the user can customise and add to the available graphics. Currently this is 
just one file, so "the latest" is always the one in app support, but actually 
this is a drawback on a number of levels so I'm working on splitting this out 
into one file per graphic, and the app will combine the bundle (read only) 
files with the app support (read/write) files to present a unified set to the 
user. They don't care where they come from, they just use them.

If the same app is copied/installed elsewhere, all the new installation gets is 
the original bundle set, not any new ones the other user made. That's 
completely normal and I would say expected behaviour.

The simple fact is that you cannot reliably update your app as it runs by 
writing files to its bundle. So however you need it to work, this option is not 
available.

--Graham


___

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

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

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

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


[SOLVED]: NSPropertyListSerialization error with apparently OK data

2010-02-18 Thread Graham Cox

On 18/02/2010, at 10:51 PM, Graham Cox wrote:

Turns out one of the "arrays" was actually a set, and thus invalid in a plist. 
Took a long time to realise that -valueForKey: on NSSet returns another set, 
not an array. Once realised, simply fixed. Five hours later... D'oh!

--Graham


___

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

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

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

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


super call in the middle of a block of code ..

2010-02-18 Thread Roland King
I have this piece of code in my UITableViewController subclass (that is also my 
tableview delegate)

-(void)setEditing:(BOOL)editing animated:(BOOL)animated
{
if( editing )
preEditPath = [ [ [ self tableView ] indexPathForSelectedRow ] 
retain ];

[ super setEditing:editing animated:animated ];

if( !editing )
{
[ [ self tableView ] selectRowAtIndexPath:preEditPath 
animated:YES scrollPosition:UITableViewScrollPositionNone ];
[ preEditPath release ];
preEditPath = nil;
}
}

The object here is to catch the current selection on the tableview when the 
table goes into edit mode (because when it does, the selection is nil'ed with 
no delegate call)  and then restore it when the table comes out of edit mode. 
In the meantime I'm using the delegate calls which do exist to deal with the 
case where the selected row is moved or deleted so I restore the right thing. 

The super call is in the middle of the block because I've observed that it's 
that super call which removes the selection whether you are entering or exiting 
edit mode, so if I call it right at the start of the block, the selection is 
nil'ed before I cache it, if I call super at the end of the block, the super 
call deselects the selection I just put back. 

But having a super call in the middle of an overriden method seems wrong to me, 
and a bit fragile, and it relies on the observation that that's where the 
selection is nil'ed. Is this unusual, totally wrong or ok? 
___

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

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

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

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


Re: The 64 pixels width limit on Windows

2010-02-18 Thread Eric Gorr

On Feb 17, 2010, at 9:52 PM, Hank Heijink (Mailinglists) wrote:

> On Feb 17, 2010, at 4:55 PM, Eric Gorr wrote:
> 
>> On Feb 4, 2010, at 3:13 PM, Hank Heijink (Mailinglists) wrote:
>> 
>>> On Feb 4, 2010, at 2:51 PM, Eric Gorr wrote:
>>> 
 When I am resizing my window, I have a delegate method 
 windowWillResize:toSize: which is being called. What I am finding odd is 
 that the width of the size being passed in will never go below 64 pixels 
 even if the width for contentMinSize and minSize is less then 64 pixels. I 
 can easily force the window to be less then 64 pixels.
 
 So, does anyone know where this 64 pixels limit is coming from?
>>> 
>>> Measure from the left edge of the window to the rightmost edge of the 
>>> maximize button: 64 pixels. I doubt you can adjust it, but who knows - 
>>> maybe if you get rid of the title bar?
>> 
>> Can one override the 64 pixel limit?
> 
> In Cocoa? I doubt that very much. Maybe if you drop down to Carbon, but I 
> haven't tried that myself.

Perhaps, but the goal is to avoid Carbon stuff. But, if this were possible, I 
would be interested.

In any case, I have filed a bug report on this - rdar://7662356.

Btw, the reason why this is important is that the window is a resizable NSPanel 
which contains several tool buttons which the user needs to be able to arrange 
in a single column.

The width of the buttons is not large enough so a single column of them would 
cause the panel to be wide enough to show the zoom button, so the zoom button 
is hidden - which is common among such interfaces.

If anyone is interested, a sample application demonstrating the problem can be 
found at - http://ericgorr.net/cocoadev/WindowWillResize.zip

The other odd thing I noticed is that once one gets to < 64 pixels, calls to 
windowWillResize:toSize: becomes jumpy. It only seems to be called if the 
cursor is moving to the left "fast enough" to trigger the call. Moving by 
single pixels to the left will not cause windowWillResize:toSize: to be called.

___

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

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

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

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


Re: The 64 pixels width limit on Windows

2010-02-18 Thread Hank Heijink (Mailinglists)
On Feb 18, 2010, at 10:08 AM, Eric Gorr wrote:

 Measure from the left edge of the window to the rightmost edge of the 
 maximize button: 64 pixels. I doubt you can adjust it, but who knows - 
 maybe if you get rid of the title bar?
>>> 
>>> Can one override the 64 pixel limit?
>> 
>> In Cocoa? I doubt that very much. Maybe if you drop down to Carbon, but I 
>> haven't tried that myself.
> 
> Perhaps, but the goal is to avoid Carbon stuff. But, if this were possible, I 
> would be interested.
> 
> In any case, I have filed a bug report on this - rdar://7662356.
> 
> Btw, the reason why this is important is that the window is a resizable 
> NSPanel which contains several tool buttons which the user needs to be able 
> to arrange in a single column.

I don't know your design, but if you use an HUD-style NSPanel, that limitation 
doesn't apply. Would that be an option? It would certainly be the easiest way 
out.

Hank

___

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

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

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

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


Re: The 64 pixels width limit on Windows

2010-02-18 Thread Eric Gorr

On Feb 18, 2010, at 10:21 AM, Hank Heijink (Mailinglists) wrote:

> On Feb 18, 2010, at 10:08 AM, Eric Gorr wrote:
> 
> Measure from the left edge of the window to the rightmost edge of the 
> maximize button: 64 pixels. I doubt you can adjust it, but who knows - 
> maybe if you get rid of the title bar?
 
 Can one override the 64 pixel limit?
>>> 
>>> In Cocoa? I doubt that very much. Maybe if you drop down to Carbon, but I 
>>> haven't tried that myself.
>> 
>> Perhaps, but the goal is to avoid Carbon stuff. But, if this were possible, 
>> I would be interested.
>> 
>> In any case, I have filed a bug report on this - rdar://7662356.
>> 
>> Btw, the reason why this is important is that the window is a resizable 
>> NSPanel which contains several tool buttons which the user needs to be able 
>> to arrange in a single column.
> 
> I don't know your design, but if you use an HUD-style NSPanel, that 
> limitation doesn't apply. Would that be an option? It would certainly be the 
> easiest way out.

Interesting.  I had not considered that before. Thank you!

The real question is then how to handle another feature required of the 
NSPanel's which is to window shade them. Currently, the minimize button has 
been overridden to provide this behavior. However, if it were easy to get some 
other kind of window shade button or indicator into the title bar (and, I'm 
guessing that it is), this is certainly an option.

I will have to consider it some more to determine whether or not it really fits.


___

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

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

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

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


Re: super call in the middle of a block of code ..

2010-02-18 Thread Luke the Hiesterman
This seems fine to me. Generally, when subclassing, the contract is that you 
must call super - there is nothing said about where in your method you do so.

Luke

On Feb 18, 2010, at 5:58 AM, Roland King wrote:

> I have this piece of code in my UITableViewController subclass (that is also 
> my tableview delegate)
> 
> -(void)setEditing:(BOOL)editing animated:(BOOL)animated
> {
>   if( editing )
>   preEditPath = [ [ [ self tableView ] indexPathForSelectedRow ] 
> retain ];
>   
>   [ super setEditing:editing animated:animated ];
>   
>   if( !editing )
>   {
>   [ [ self tableView ] selectRowAtIndexPath:preEditPath 
> animated:YES scrollPosition:UITableViewScrollPositionNone ];
>   [ preEditPath release ];
>   preEditPath = nil;
>   }
> }
> 
> The object here is to catch the current selection on the tableview when the 
> table goes into edit mode (because when it does, the selection is nil'ed with 
> no delegate call)  and then restore it when the table comes out of edit mode. 
> In the meantime I'm using the delegate calls which do exist to deal with the 
> case where the selected row is moved or deleted so I restore the right thing. 
> 
> The super call is in the middle of the block because I've observed that it's 
> that super call which removes the selection whether you are entering or 
> exiting edit mode, so if I call it right at the start of the block, the 
> selection is nil'ed before I cache it, if I call super at the end of the 
> block, the super call deselects the selection I just put back. 
> 
> But having a super call in the middle of an overriden method seems wrong to 
> me, and a bit fragile, and it relies on the observation that that's where the 
> selection is nil'ed. Is this unusual, totally wrong or ok? 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com
> 
> This email sent to luket...@apple.com

___

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

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

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

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


Re: NSTableViewDataSource Protocol

2010-02-18 Thread Sean McBride
On 2/18/10 12:07 PM, Michael Davey said:

>I am writing an app that needs to be able to target 10.5 at least and
>hopefully 10.4, but I have just found that the way that table views are
>handled has changed - does anyone have a link to some documentation for
>the old way to do things?



"Formal Protocol Adoption" says:

If you need to target Leopard or Tiger with the same sources, you should
conditionally declare empty protocols, or else the compiler will
complain about missing protocols declarations. For example:
#if MAC_OS_X_VERSION_10_6 > MAC_OS_X_VERSION_MAX_ALLOWED
@protocol NSConnectionDelegate  @end
#endif

--

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


___

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

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

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

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


Re: “EXC_BAD_ACCESS” on Custom TableV iew with custom NSCell when clicking.

2010-02-18 Thread Corbin Dunn

On Feb 18, 2010, at 12:24 AM, Gustavo Pizano wrote:

> Hello Corbin.
> 
> ok, so I read your blog post, its great, I love it.
> 
> I followed what you said there with my application, when the app crashes I 
> see the address, I search for it and I see only one result, so I click the 
> arrow  next to the address to check the history and I have this situation.
> first I have a Malloc, responsible CoreData, responsible caller [NSSQLCore 
> _prepareResultsFromResultSet:usingFetchPlan:withMatchingRows:],
> and right after that event I have the Zombie. responsible CoreData, 
> Responsible caller [NSManageObject objectDictionaryWithValuesForKeys:]

There should be a free event at some point; make sure you check the option to 
keep track of all retain/releases -- look for the last release. That callstack 
is the last person who "owned" the object had it, and released it. Based on 
that information, you need to some how ensure it is retained longer than that 
time period.

corbin


> 
> So when I click the zombie and check the extended view, the last line of code 
> that I have control over is the accessor for the userDictionary attribute in 
> the User ManagedObject, which has these lines of code.
> 
> -(NSDictionary *)userDictionary{  
>   return [self dictionaryWithValuesForKeys:[NSArray 
> arrayWithObjects:@"firstName",@"lastName",@"avatar",@"title",nil]];
> }
> 
> I also have this line of code in the User ManageDObject
> +(NSSet *)keyPathsForValuesAffectingUserDictionary{
>   return [NSSet 
> setWithObjects:@"firstName",@"lastName",@"avatar",@"title",nil];
> }
> dunno if this affects in somehow.. I stilld on't get what for is it, i think 
> its to track changes of the object for those keys.
> 
> So, if I have comming back to the initial quesiton, if I have no ivars in the 
> cusotm NSCell, Im just drawing the values in the values like this
> 
> -(void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView{
>   
>   NSDictionary * cellValues = [self objectValue]; 
>   NSString * firstName = [cellValues valueForKey:@"firstName"];
>   NSString * lastName = [cellValues valueForKey:@"lastName"];
> 
> ...
> }
> then what am I doing wrong?
> 
> thx.
> Gustavo
> 
> 
> On Feb 17, 2010, at 11:31 PM, Corbin Dunn wrote:
> 
>> 
>> On Feb 17, 2010, at 2:14 PM, Gustavo Pizano wrote:
>> 
>>> 
>>> On Feb 17, 2010, at 11:03 PM, Jim Correia wrote:
>>> 
 On Feb 17, 2010, at 4:41 PM, Gustavo Pizano wrote:
 
> Maybe I misunderstood I must conform NSCopying protocol also even when 
> using core data? 
 
 If you have an NSCell subclass which adds iVars, you must implement 
 -copyWithZone: to do correct memory management.
 
 Your -copyWithZone: needs to work correctly within the bounds of the 
 object ownership rules.
 
 If you have an object iVar which shouldn’t be copied, but is still an 
 owned reference, then you can (and must) retain it instead in the copy.
 
 (You should do this for all cells with iVars, not just ones with object 
 iVars, so that your subclass will behave correctly in the future even if 
 NSCell doesn’t implement its behavior using NSCopyObject.)
 
 - Jim
>>> 
>>> Hello Jim
>>> HMM digging more into the problem.. definitely it seems because Im not 
>>> copying properly the NSManagedObject Paul Robinson says in one old post:
>>> 
>>> "The short answer is that you need to override the setObjectValue: method 
>>> (which tries to copy your uncopyable NSManagedObject) in your custom NSCell 
>>> to convert your NSManagedObject into an NSValue (which is copyable)."
>>> 
>>> 
>>> And taking what you said,  so if my User ManagedObject returns me the 
>>> NSDictionary with the key-value of its attributes, then in the cell I must 
>>> set it as an ivar within the method setObjectValue, then implement the 
>>> copyWithZone and return the copy of it isn't it? right now I don't have any 
>>> ivar in my custom cell.. sooo .  := :S.
>> 
>> I think Jim and I are leading you off track; if your cell has no extra 
>> ivars, then you don't have to worry about the cell implementing 
>> copyWithZone:.
>> 
>> I still think you should read my blog posting and see why the crash happens 
>> with zombies on.
>> 
>> 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 arch...@mail-archive.com


Animating an Attached Window (was: Drawing Attention to a Control...)

2010-02-18 Thread Jerry Krinock

On 2010 Feb 03, at 14:36, jonat...@mugginsoft.com wrote:

> On 3 Feb 2010, at 21:04, Jerry Krinock wrote:
> 
>> An app I'm developing has a multi-tabbed window.  Sometimes one of the Error 
>> Recovery Options is to click into some tab and adjust control Foo.  And in 
>> many cases, either due to the complexity of it, or to help the user learn 
>> where the control is, I want them to actually do it themselves, using the 
>> control.
>> 
>> So, when a user clicks the Recovery Option "Change Foo", I reveal the tab, 
>> and then I'm thinking that I'd like to maybe draw a red outline around the 
>> frame of the control.  Are there any API, Apple or other frameworks that I 
>> should consider to do something like this?
>> 
>> How about that fat blue arrow which Apple uses to direct users to menu items 
>> after searching in Help?  Any way to get ahold of that?
> 
> What about using a child window?
> I use MAAttachedWindow for this sort of thing.
> 
> http://mattgemmell.com/2007/10/03/maattachedwindow-nswindow-subclass

Thanks, Jonathan.  Using Matt Gemmel's idea of making an attached window, I 
wrote a class that makes a fat arrow with a blue gradient that looks like the 
one you get when you click a menu item after searching in Help.

Now, I'd like it to be animated, like Apple's fat blue Help arrow, moving 
slowly in a little circle.  In Matt's code, he moves the attached window by 
re-creating it.  I could do this brute force, offsetting the frame with 
x=cos(wt) and y=sin(wt).

In the Core Animation Programming Guide > Animatable Properties, it says that 
'position' can be animated, and this has the effect of animating the frame.  
I've never used Core Animation.  Is Core Animation the tool for this job or 
should I use my brute force? 

Thanks,

Jerry Krinock


___

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

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

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

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


Re: NSTableViewDataSource Protocol

2010-02-18 Thread Michael Davey
Thanks for that!

On 18 Feb 2010, at 16:05, Sean McBride wrote:

> On 2/18/10 12:07 PM, Michael Davey said:
> 
>> I am writing an app that needs to be able to target 10.5 at least and
>> hopefully 10.4, but I have just found that the way that table views are
>> handled has changed - does anyone have a link to some documentation for
>> the old way to do things?
> 
> 
> 
> "Formal Protocol Adoption" says:
> 
> If you need to target Leopard or Tiger with the same sources, you should
> conditionally declare empty protocols, or else the compiler will
> complain about missing protocols declarations. For example:
> #if MAC_OS_X_VERSION_10_6 > MAC_OS_X_VERSION_MAX_ALLOWED
> @protocol NSConnectionDelegate  @end
> #endif
> 
> --
> 
> Sean McBride, B. Eng s...@rogue-research.com
> Rogue Researchwww.rogue-research.com
> Mac Software Developer  Montréal, Québec, Canada
> 
> 

___

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

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

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

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


Re: Animating an Attached Window (was: Drawing Attention to a Control...)

2010-02-18 Thread jonat...@mugginsoft.com
> 
> Thanks, Jonathan.  Using Matt Gemmel's idea of making an attached window, I 
> wrote a class that makes a fat arrow with a blue gradient that looks like the 
> one you get when you click a menu item after searching in Help.
> 
> Now, I'd like it to be animated, like Apple's fat blue Help arrow, moving 
> slowly in a little circle.  In Matt's code, he moves the attached window by 
> re-creating it.  I could do this brute force, offsetting the frame with 
> x=cos(wt) and y=sin(wt).
> 
> In the Core Animation Programming Guide > Animatable Properties, it says that 
> 'position' can be animated, and this has the effect of animating the frame.  
> I've never used Core Animation.  Is Core Animation the tool for this job or 
> should I use my brute force? 

I shake an authentication window on failure using the following CA code. 

NSWindowController subclass

// shake it
[[self window] setAnimations:[NSDictionary dictionaryWithObject:[self 
shakeAnimation:[[self window] frame]] forKey:@"frameOrigin"]];
[[[self window] animator] setFrameOrigin:[[self window] frame].origin];


/*
 
 shake animation
 http://www.cimgf.com/2008/02/27/core-animation-tutorial-window-shake-effect/
 
 */
- (CAKeyframeAnimation *)shakeAnimation:(NSRect)frame
{
CAKeyframeAnimation *shakeAnimation = [CAKeyframeAnimation animation];

CGMutablePathRef shakePath = CGPathCreateMutable();
CGPathMoveToPoint(shakePath, NULL, NSMinX(frame), NSMinY(frame));
int idx;
for (idx = 0; idx < numberOfShakes; ++idx)
{
CGPathAddLineToPoint(shakePath, NULL, NSMinX(frame) - 
frame.size.width * vigourOfShake, NSMinY(frame));
CGPathAddLineToPoint(shakePath, NULL, NSMinX(frame) + 
frame.size.width * vigourOfShake, NSMinY(frame));
}
CGPathCloseSubpath(shakePath);
shakeAnimation.path = shakePath;
shakeAnimation.duration = durationOfShake;
return shakeAnimation;
}

Regards

Jonathan

> 
> Thanks,
> 
> Jerry Krinock
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jonathan%40mugginsoft.com
> 
> This email sent to jonat...@mugginsoft.com

___

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

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

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

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


Determine smallest height of vertical scrollbar

2010-02-18 Thread Eric Gorr
Other then creating a dummy NSScoller and incrementally decreasing it's height 
until usableParts returns 0, is there any easy way to determine what the 
minimum height of a vertical scrollbar should be so that usableParts will not 
return NSNoScrollerParts?

What I need to be able to do is limit the height of my window based, in part, 
on whether or not a vertical scrollbar will have usable parts.




___

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

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

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

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


Re: “EXC_BAD_ACCESS” on Custom TableV iew with custom NSCell when clicking.

2010-02-18 Thread Gustavo Pizano
HEllo Corbin, 
It seem its fixed, I didn't realize an ivar in the Custom NSCell, I forgot I 
put it there thinking in using it to hold the name of the user and be able to 
sort the table, which right now I can;t tell how to do it, I took out that 
ivar, and it hasn't crash so far.. still Im gonna keep trying to make it crash 
and if it happens, then I will do what you suggested.

Thanks for the help and the blog link.. I learned a something else I wished to 
know but didn't know where to find it. 

Gustavo

On Feb 18, 2010, at 5:06 PM, Corbin Dunn wrote:

> 
> On Feb 18, 2010, at 12:24 AM, Gustavo Pizano wrote:
> 
>> Hello Corbin.
>> 
>> ok, so I read your blog post, its great, I love it.
>> 
>> I followed what you said there with my application, when the app crashes I 
>> see the address, I search for it and I see only one result, so I click the 
>> arrow  next to the address to check the history and I have this situation.
>> first I have a Malloc, responsible CoreData, responsible caller [NSSQLCore 
>> _prepareResultsFromResultSet:usingFetchPlan:withMatchingRows:],
>> and right after that event I have the Zombie. responsible CoreData, 
>> Responsible caller [NSManageObject objectDictionaryWithValuesForKeys:]
> 
> There should be a free event at some point; make sure you check the option to 
> keep track of all retain/releases -- look for the last release. That 
> callstack is the last person who "owned" the object had it, and released it. 
> Based on that information, you need to some how ensure it is retained longer 
> than that time period.
> 
> corbin
> 
> 
>> 
>> So when I click the zombie and check the extended view, the last line of 
>> code that I have control over is the accessor for the userDictionary 
>> attribute in the User ManagedObject, which has these lines of code.
>> 
>> -(NSDictionary *)userDictionary{ 
>>  return [self dictionaryWithValuesForKeys:[NSArray 
>> arrayWithObjects:@"firstName",@"lastName",@"avatar",@"title",nil]];
>> }
>> 
>> I also have this line of code in the User ManageDObject
>> +(NSSet *)keyPathsForValuesAffectingUserDictionary{
>>  return [NSSet 
>> setWithObjects:@"firstName",@"lastName",@"avatar",@"title",nil];
>> }
>> dunno if this affects in somehow.. I stilld on't get what for is it, i think 
>> its to track changes of the object for those keys.
>> 
>> So, if I have comming back to the initial quesiton, if I have no ivars in 
>> the cusotm NSCell, Im just drawing the values in the values like this
>> 
>> -(void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView{
>>  
>>  NSDictionary * cellValues = [self objectValue]; 
>>  NSString * firstName = [cellValues valueForKey:@"firstName"];
>>  NSString * lastName = [cellValues valueForKey:@"lastName"];
>> 
>> ...
>> }
>> then what am I doing wrong?
>> 
>> thx.
>> Gustavo
>> 
>> 
>> On Feb 17, 2010, at 11:31 PM, Corbin Dunn wrote:
>> 
>>> 
>>> On Feb 17, 2010, at 2:14 PM, Gustavo Pizano wrote:
>>> 
 
 On Feb 17, 2010, at 11:03 PM, Jim Correia wrote:
 
> On Feb 17, 2010, at 4:41 PM, Gustavo Pizano wrote:
> 
>> Maybe I misunderstood I must conform NSCopying protocol also even when 
>> using core data? 
> 
> If you have an NSCell subclass which adds iVars, you must implement 
> -copyWithZone: to do correct memory management.
> 
> Your -copyWithZone: needs to work correctly within the bounds of the 
> object ownership rules.
> 
> If you have an object iVar which shouldn’t be copied, but is still an 
> owned reference, then you can (and must) retain it instead in the copy.
> 
> (You should do this for all cells with iVars, not just ones with object 
> iVars, so that your subclass will behave correctly in the future even if 
> NSCell doesn’t implement its behavior using NSCopyObject.)
> 
> - Jim
 
 Hello Jim
 HMM digging more into the problem.. definitely it seems because Im not 
 copying properly the NSManagedObject Paul Robinson says in one old post:
 
 "The short answer is that you need to override the setObjectValue: method 
 (which tries to copy your uncopyable NSManagedObject) in your custom 
 NSCell to convert your NSManagedObject into an NSValue (which is 
 copyable)."
 
 
 And taking what you said,  so if my User ManagedObject returns me the 
 NSDictionary with the key-value of its attributes, then in the cell I must 
 set it as an ivar within the method setObjectValue, then implement the 
 copyWithZone and return the copy of it isn't it? right now I don't have 
 any ivar in my custom cell.. sooo .  := :S.
>>> 
>>> I think Jim and I are leading you off track; if your cell has no extra 
>>> ivars, then you don't have to worry about the cell implementing 
>>> copyWithZone:.
>>> 
>>> I still think you should read my blog posting and see why the crash happens 
>>> with zombies on.
>>> 
>>> corbin
>> 
> 

_

How do I get keyboard events in an NSStatusWindowLevel window while my application is not frontmost?

2010-02-18 Thread Daniel Káčer
After creating a translucent NSPanel and I want to get keyboard events  
in this window. It seems that there are only keyboard events when my  
application is the active application while I want keyboard events  
even when my application isn't active but the window is visible.


Basically I want behavior like that provided by the Quicksilver  
application.


Does anybody have any hints on how to do this?



Regards

Donald
___

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

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

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

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


Re: “EXC_BAD_ACCESS” on Custom TableV iew with custom NSCell when clicking.

2010-02-18 Thread Corbin Dunn

On Feb 18, 2010, at 9:17 AM, Gustavo Pizano wrote:

> HEllo Corbin, 
> It seem its fixed, I didn't realize an ivar in the Custom NSCell, I forgot I 
> put it there thinking in using it to hold the name of the user and be able to 
> sort the table, which right now I can;t tell how to do it, I took out that 
> ivar, and it hasn't crash so far.. still Im gonna keep trying to make it 
> crash and if it happens, then I will do what you suggested.

Ah! So it was the extra ivar in your custom cell. That's was my initial guess. 
the extra ivar is okay; you just have to retain or copy it in the cell's 
implementation of -copyWithZone:

corbin

> 
> Thanks for the help and the blog link.. I learned a something else I wished 
> to know but didn't know where to find it. 
> 
> Gustavo
> 
> On Feb 18, 2010, at 5:06 PM, Corbin Dunn wrote:
> 
>> 
>> On Feb 18, 2010, at 12:24 AM, Gustavo Pizano wrote:
>> 
>>> Hello Corbin.
>>> 
>>> ok, so I read your blog post, its great, I love it.
>>> 
>>> I followed what you said there with my application, when the app crashes I 
>>> see the address, I search for it and I see only one result, so I click the 
>>> arrow  next to the address to check the history and I have this situation.
>>> first I have a Malloc, responsible CoreData, responsible caller [NSSQLCore 
>>> _prepareResultsFromResultSet:usingFetchPlan:withMatchingRows:],
>>> and right after that event I have the Zombie. responsible CoreData, 
>>> Responsible caller [NSManageObject objectDictionaryWithValuesForKeys:]
>> 
>> There should be a free event at some point; make sure you check the option 
>> to keep track of all retain/releases -- look for the last release. That 
>> callstack is the last person who "owned" the object had it, and released it. 
>> Based on that information, you need to some how ensure it is retained longer 
>> than that time period.
>> 
>> corbin
>> 
>> 
>>> 
>>> So when I click the zombie and check the extended view, the last line of 
>>> code that I have control over is the accessor for the userDictionary 
>>> attribute in the User ManagedObject, which has these lines of code.
>>> 
>>> -(NSDictionary *)userDictionary{
>>> return [self dictionaryWithValuesForKeys:[NSArray 
>>> arrayWithObjects:@"firstName",@"lastName",@"avatar",@"title",nil]];
>>> }
>>> 
>>> I also have this line of code in the User ManageDObject
>>> +(NSSet *)keyPathsForValuesAffectingUserDictionary{
>>> return [NSSet 
>>> setWithObjects:@"firstName",@"lastName",@"avatar",@"title",nil];
>>> }
>>> dunno if this affects in somehow.. I stilld on't get what for is it, i 
>>> think its to track changes of the object for those keys.
>>> 
>>> So, if I have comming back to the initial quesiton, if I have no ivars in 
>>> the cusotm NSCell, Im just drawing the values in the values like this
>>> 
>>> -(void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView{
>>> 
>>> NSDictionary * cellValues = [self objectValue]; 
>>> NSString * firstName = [cellValues valueForKey:@"firstName"];
>>> NSString * lastName = [cellValues valueForKey:@"lastName"];
>>> 
>>> ...
>>> }
>>> then what am I doing wrong?
>>> 
>>> thx.
>>> Gustavo
>>> 
>>> 
>>> On Feb 17, 2010, at 11:31 PM, Corbin Dunn wrote:
>>> 
 
 On Feb 17, 2010, at 2:14 PM, Gustavo Pizano wrote:
 
> 
> On Feb 17, 2010, at 11:03 PM, Jim Correia wrote:
> 
>> On Feb 17, 2010, at 4:41 PM, Gustavo Pizano wrote:
>> 
>>> Maybe I misunderstood I must conform NSCopying protocol also even when 
>>> using core data? 
>> 
>> If you have an NSCell subclass which adds iVars, you must implement 
>> -copyWithZone: to do correct memory management.
>> 
>> Your -copyWithZone: needs to work correctly within the bounds of the 
>> object ownership rules.
>> 
>> If you have an object iVar which shouldn’t be copied, but is still an 
>> owned reference, then you can (and must) retain it instead in the copy.
>> 
>> (You should do this for all cells with iVars, not just ones with object 
>> iVars, so that your subclass will behave correctly in the future even if 
>> NSCell doesn’t implement its behavior using NSCopyObject.)
>> 
>> - Jim
> 
> Hello Jim
> HMM digging more into the problem.. definitely it seems because Im not 
> copying properly the NSManagedObject Paul Robinson says in one old post:
> 
> "The short answer is that you need to override the setObjectValue: method 
> (which tries to copy your uncopyable NSManagedObject) in your custom 
> NSCell to convert your NSManagedObject into an NSValue (which is 
> copyable)."
> 
> 
> And taking what you said,  so if my User ManagedObject returns me the 
> NSDictionary with the key-value of its attributes, then in the cell I 
> must set it as an ivar within the method setObjectValue, then implement 
> the copyWithZone and return the copy of it isn't it? right now I don't 

Re: How do I get keyboard events in an NSStatusWindowLevel window while my application is not frontmost?

2010-02-18 Thread Jens Alfke


On Feb 18, 2010, at 9:22 AM, Daniel Káčer wrote:

After creating a translucent NSPanel and I want to get keyboard  
events in this window. It seems that there are only keyboard events  
when my application is the active application while I want keyboard  
events even when my application isn't active but the window is  
visible.
Basically I want behavior like that provided by the Quicksilver  
application.


If you want to handle a particular keystroke (like Quicksilver's Ctrl- 
Space) no matter what app is active, define a system hot-key. There is  
sample code showing how to do this, but I don't know an exact name or  
URL.


Once your hot key has triggered, call [NSApp  
activateIgnoringOtherApps: YES] and [myWindow makeKeyAndOrderFront:  
nil], so your window will have focus and will receive typing.


—Jens___

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

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

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

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


Hillegass printing challenge

2010-02-18 Thread Michael de Haan
Hi all,
May I ask about an issue I am having adding page numbers to a print out.
I implemented the following method:


- (void)drawPageBorderWithSize:(NSSize)borderSize
{
   // NSPrintOperation *po = [NSPrintOperation currentOperation];
//NSPrintInfo *pi = [po printInfo];

NSRect currentFrame = [self frame]; 
NSRect newFrame= NSMakeRect(0, 0, borderSize.width, borderSize.height);
[self setFrame:newFrame];

NSFont *f = [attributes objectForKey:NSFontAttributeName];
float capHeigth = [ f capHeight];
NSString *string = [ NSString stringWithFormat:@"Page %d", currentPage + 1];
float stringX = (borderSize.width - (float)[string length])/2.0;
[self lockFocus];
[string drawAtPoint:NSMakePoint(stringX, borderSize.height - (1.7 * 
capHeigth))
withAttributes:attributes];
[self unlockFocus];
[self setFrame:currentFrame];
}


A while ago, there were questions to the list about printInfo "margin" calls. 
At that time, it appears  the consensus was that these calls are buggy. I think 
they still are, as my code showed that the margins returned bore no 
relationship to the margins set in page Setup.  As a workaround, I used the 
above approach. What do others do to deduce the user's margin settingsor 
it's possible that I am missing something else.
Thanks in advance.___

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

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

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

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


Re: How do I get keyboard events in an NSStatusWindowLevel window while my application is not frontmost?

2010-02-18 Thread Daniel Káčer

thank you very much ... your second hint was what I needed to know :)

Donald


On Feb 18, 2010, at 19:03 , Jens Alfke wrote:


On Feb 18, 2010, at 9:22 AM, Daniel Káčer wrote:

After creating a translucent NSPanel and I want to get keyboard  
events in this window. It seems that there are only keyboard events  
when my application is the active application while I want keyboard  
events even when my application isn't active but the window is  
visible.
Basically I want behavior like that provided by the Quicksilver  
application.


If you want to handle a particular keystroke (like Quicksilver's Ctrl- 
Space) no matter what app is active, define a system hot-key. There is  
sample code showing how to do this, but I don't know an exact name or  
URL.


Once your hot key has triggered, call [NSApp  
activateIgnoringOtherApps: YES] and [myWindow makeKeyAndOrderFront:  
nil], so your window will have focus and will receive typing.


—Jens

___

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

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

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

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


NSWindow - how to resize it keeping aspect ratio?

2010-02-18 Thread Alexander Bokovikov

Hi, All,

I'm sorry if this is a stupid question, but I don't see an evident answer... 
I need the subj, but don't see appropriate NSWindow method... Am I missing 
something?


Any help would be appreciated.

Best regards,
Alexander 


___

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

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

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

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


Re: NSWindow - how to resize it keeping aspect ratio?

2010-02-18 Thread Hank Heijink (Mailinglists)
On Feb 18, 2010, at 1:55 PM, Alexander Bokovikov wrote:

> Hi, All,
> 
> I'm sorry if this is a stupid question, but I don't see an evident answer... 
> I need the subj, but don't see appropriate NSWindow method... Am I missing 
> something?

Implement the NSWindow delegate method - (NSSize)windowWillResize:(NSWindow 
*)sender toSize:(NSSize)frameSize. In that method, return an NSSize that has 
the right aspect ratio.

Good luck,
Hank

___

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

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

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

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


Re: NSWindow - how to resize it keeping aspect ratio?

2010-02-18 Thread Jim Correia
On Feb 18, 2010, at 1:55 PM, Alexander Bokovikov wrote:

> I'm sorry if this is a stupid question, but I don't see an evident answer... 
> I need the subj, but don't see appropriate NSWindow method... Am I missing 
> something?

-[NSWindow setAspectRatio:]
-[NSWindow setContentAspectRatio:]

- Jim

___

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

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

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

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


Re: NSWindow - how to resize it keeping aspect ratio?

2010-02-18 Thread Eric Gorr

On Feb 18, 2010, at 1:55 PM, Alexander Bokovikov wrote:

> Hi, All,
> 
> I'm sorry if this is a stupid question, but I don't see an evident answer... 
> I need the subj, but don't see appropriate NSWindow method... Am I missing 
> something?

You could check out NSWindow's setAspectRatio or setContentAspectRatio.

These are discussed in NSWindow's programming guide.

___

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

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

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

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


NSTableView with PopUpButtonCell column with different content per row

2010-02-18 Thread Sean McBride
Hi all,

I'm looking for some pointers on how to have a TableView where one
column uses a PopUpButtonCell who's contents need to be different for
different rows.

A contrived example:

OS Name OS Version


So in the 'OS Version' column, I want the popup's contents to be either
one list or another list depending on 'OS Name' of any given row.

Any suggestions?

Thanks,

--

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


___

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

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

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

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


Re: NSTableView with PopUpButtonCell column with different content per row

2010-02-18 Thread Kyle Sluder
On Thu, Feb 18, 2010 at 12:38 PM, Sean McBride  wrote:
> So in the 'OS Version' column, I want the popup's contents to be either
> one list or another list depending on 'OS Name' of any given row.
>
> Any suggestions?

Hook yourself up as the delegate of the column's popup button cell's
menu, and implement -menuNeedsUpdate: to populate the menu with the
correct set of items depending on the selected item.

--Kyle Sluder
___

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

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

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

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


Re: NSTableView with PopUpButtonCell column with different content per row

2010-02-18 Thread Quincey Morris
On Feb 18, 2010, at 12:38, Sean McBride wrote:

> I'm looking for some pointers on how to have a TableView where one
> column uses a PopUpButtonCell who's contents need to be different for
> different rows.
> 
> A contrived example:
> 
> OS Name OS Version
> 
> 
> So in the 'OS Version' column, I want the popup's contents to be either
> one list or another list depending on 'OS Name' of any given row.

Aside from what Kyle suggested (adjusting the menu dynamically "in" the 
interface), you could simply have your window controller provide an array 
property with version strings for the current OS (along with a KVO dependency 
to keep the property in sync with the current OS), and bind the popup content 
to that array.

However, I'd suggest that perhaps you're asking the wrong question -- there 
might be a deeper data model design issue.

Presumably your data model would have an "OS" property (maybe an integer 
constant, maybe a string, maybe an object) and a "version" property (ditto). It 
seems to me it's up to the data model to specify which are the valid versions 
for each OS value, otherwise how can the data model validate itself? The 
consequence would be that it's the data model's responsibility to supply the 
arrays [of integers/strings/objects] that ultimately allow you to populate your 
popups appropriately. It would then be up to the window controller (or perhaps 
a view) to transform the pure data model information into the properties that 
the interface needs for binding purposes.

Without that, the danger is that your data model depends for its correctness on 
its internal rules being re-implemented correctly in the view portion of your 
design. That would likely be an abuse of the MVC pattern.

FWIW.


___

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

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

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

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


Re: NSTableView with PopUpButtonCell column with different content per row

2010-02-18 Thread Jerry Krinock

On 2010 Feb 18, at 13:30, Quincey Morris wrote:

> you could simply have your window controller provide an array property with 
> version strings for the current OS (along with a KVO dependency to keep the 
> property in sync with the current OS), and bind the popup content to that 
> array.
> 
> However, I'd suggest that perhaps you're asking the wrong question -- there 
> might be a deeper data model design issue.

Quincey's answer is excellent, and abstract.  Let me give you a concrete 
example from one of my projects.  Presumably your table is bound to an array 
controller whose contentSet or contentArray is bound to a collection of Foo 
objects in your data model.

Table Column Bindings for "OS Version" column:

Content:
  Bind to: FooArrayController
  Controller Key: arrangedObjects
  Model Key Path: osVersionChoices

Content Values:
  Bind to: FooArrayController
  Controller Key: arrangedObjects
  Model Key Path: osVersionChoices.osVersionDisplayName

Selected Object:
  Bind to: FooArrayController
  Controller Key: arrangedObjects
  Model Key Path: osVersion

In your data model,

@interface Foo {
}

@property (retain) NSString* osVersion ; // Could also be NSNumber

/* Returns an array of NSStrings (or NSNumbers) */
- (NSArray*)osVersionChoices ;

...

@end

And finally, and I forgot who it was who gave me this invaluable tip, you 
implement a category on NSString (or NSNumber) which defines 
-osVersionDisplayName.  You can do your localization or transforming in here.  
I've never been able to get a Value Transformer to work in an NSTableColumn 
binding.  But the category works every time.

Note that -osVersionChoices and of course -osVersionDisplay name are readonly.  
No problem.  If you table is not editable, -osVersion can be readonly too.

___

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

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

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

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


Re: Hillegass printing challenge

2010-02-18 Thread Graham Cox

On 19/02/2010, at 6:06 AM, Michael de Haan wrote:

> Hi all,
> May I ask about an issue I am having adding page numbers to a print out.
> I implemented the following method:
> 
> 
> - (void)drawPageBorderWithSize:(NSSize)borderSize
> {
>   // NSPrintOperation *po = [NSPrintOperation currentOperation];
>//NSPrintInfo *pi = [po printInfo];
> 
>NSRect currentFrame = [self frame]; 
>NSRect newFrame= NSMakeRect(0, 0, borderSize.width, borderSize.height);
>[self setFrame:newFrame];
> 
>NSFont *f = [attributes objectForKey:NSFontAttributeName];
>float capHeigth = [ f capHeight];
>NSString *string = [ NSString stringWithFormat:@"Page %d", currentPage + 
> 1];
>float stringX = (borderSize.width - (float)[string length])/2.0;
>[self lockFocus];
>[string drawAtPoint:NSMakePoint(stringX, borderSize.height - (1.7 * 
> capHeigth))
>withAttributes:attributes];
>[self unlockFocus];
>[self setFrame:currentFrame];
> }
> 
> 
> A while ago, there were questions to the list about printInfo "margin" calls. 
> At that time, it appears  the consensus was that these calls are buggy. I 
> think they still are, as my code showed that the margins returned bore no 
> relationship to the margins set in page Setup.  As a workaround, I used the 
> above approach. What do others do to deduce the user's margin settingsor 
> it's possible that I am missing something else.


Hi Michael,

I'm not sure that they're buggy, it's just they don't return what you think 
they do, or what their name appears to imply. I added the following to 
NSPrintInfo as a category so I can get the actual paper margins set in Page 
Setup, it might come in handy for you too.



enum
{
PrintInfoTopMarginIndex = 0,
PrintInfoLeftMarginIndex= 1,
PrintInfoBottomMarginIndex  = 2,
PrintInfoRightMarginIndex   = 3
};


@implementation NSPrintInfo (PaperMargins)


- (NSArray*)paperMargins
{
PMPageFormatformat = (PMPageFormat)[self PMPageFormat];
PMPaper paper;
OSStatuserr = PMGetPageFormatPaper( format, &paper );

if( err == noErr )
{
PMPaperMargins  margins;
err = PMPaperGetMargins( paper, &margins );

if( err == noErr )
{
NSMutableArray* array = [NSMutableArray array];
[array addObject:[NSNumber 
numberWithDouble:margins.top]];
[array addObject:[NSNumber 
numberWithDouble:margins.left]];
[array addObject:[NSNumber 
numberWithDouble:margins.bottom]];
[array addObject:[NSNumber 
numberWithDouble:margins.right]];
 
return array;
}
}

return nil;
}



- (double)  topPaperMargin
{
return [[[self paperMargins] objectAtIndex:PrintInfoTopMarginIndex] 
doubleValue];
}



- (double)  leftPaperMargin
{
return [[[self paperMargins] objectAtIndex:PrintInfoLeftMarginIndex] 
doubleValue];
}



- (double)  bottomPaperMargin
{
return [[[self paperMargins] objectAtIndex:PrintInfoBottomMarginIndex] 
doubleValue];
}



- (double)  rightPaperMargin
{
return [[[self paperMargins] objectAtIndex:PrintInfoRightMarginIndex] 
doubleValue];
}


@end


--Graham


___

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

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

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

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


NSTableColumn's 'fontSize' Binding: Just Doesn't Work?

2010-02-18 Thread Jerry Krinock
I know how to control the font size in a table -- the hard way -- by 
subclassing NSTableColumn and overriding -dataCellForRow.  Hoping for an easy 
way, I noticed that NSTableView has a 'fontSize' binding...

fontSize.  An integer value that determines the size, in points, of the font 
used to display the NSTableView.  If fontSize is bound, the font binding is 
disabled.

Whoopee!  So, in Interface Builder, I leave 'font' unbound, and bind thus:

fontSize
  Bind to: Shared User Defaults Controller
  Controller Key: values
  Model Key Path: myFontSize

myFontSize is a key in my user defaults.

Result: It just doesn't work.  Silently ignores the value in user defaults, 
both upon awaking and when it is changed.

This was reported also by Chris Miner two years ago:

http://www.cocoabuilder.com/archive/cocoa/197369-under-what-circumstances-does-the-fontsize-binding-of-nstableview-have-an-effect.html?q=NSTableView+fontSize+binding#197369

I understand that NSUserDefaults bindings do not issue an error if Model Key 
Path does not exist.  But I checked the spelling three times.

Has anyone ever seen this binding work?

Jerry Krinock



___

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

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

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

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


Re: [SOLVED] NSTableColumn's 'fontSize' Binding: Just Doesn't Work?

2010-02-18 Thread Jerry Krinock
Sorry, I just found the answer, in the next paragraph:

   "Binding is Read Only"

Off to do it the hard way


___

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

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

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

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



Use of NSView enterFullScreenMode withOptions causes warning about deprecated CPSSetForegroundOperationState

2010-02-18 Thread Shayne Wissler
Hello,

In my application I have the following call:

  [self enterFullScreenMode:[NSScreen mainScreen] withOptions:0];

This function is documented here, and does not appear to be deprecated:

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/enterFullScreenMode:withOptions:

And yet I am getting the following message right after making this call:

myApp[11220]: CPSSetForegroundOperationState(): This call is
deprecated and should not be called anymore.

I am using the latest released version of OSX, 10.5.8. Any tips would
be appreciated.


Thanks,
 Shayne Wissler
___

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

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

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

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


Re: NSTableColumn's 'fontSize' Binding: Just Doesn't Work?

2010-02-18 Thread Keary Suska
On Feb 18, 2010, at 5:29 PM, Jerry Krinock wrote:

> I know how to control the font size in a table -- the hard way -- by 
> subclassing NSTableColumn and overriding -dataCellForRow.  Hoping for an easy 
> way, I noticed that NSTableView has a 'fontSize' binding...

Why do that, when you could just use the willDisplayCell delegate method?

> fontSize.  An integer value that determines the size, in points, of the font 
> used to display the NSTableView.  If fontSize is bound, the font binding is 
> disabled.
> 
> Whoopee!  So, in Interface Builder, I leave 'font' unbound, and bind thus:
> 
> fontSize
>  Bind to: Shared User Defaults Controller
>  Controller Key: values
>  Model Key Path: myFontSize
> 
> myFontSize is a key in my user defaults.
> 
> Result: It just doesn't work.  Silently ignores the value in user defaults, 
> both upon awaking and when it is changed.
> 
> This was reported also by Chris Miner two years ago:
> 
> http://www.cocoabuilder.com/archive/cocoa/197369-under-what-circumstances-does-the-fontsize-binding-of-nstableview-have-an-effect.html?q=NSTableView+fontSize+binding#197369

That poster seemed to say that the font was nil. If this is the case, font size 
could not produce defined results. What happens when you bind "font" as well?

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 arch...@mail-archive.com


setAction:@selector is not working ?

2010-02-18 Thread David M. Cotter
i'm going to do a popup menu
i run thru all the items and call 

[myMenuItem setAction:@selector(myFunction:)];

upon first run, my "myFunction" never gets called with the result of the menu 
item pick.

but then, it works 100% of the time *after* i switch out then back into my app

whaaa??  does anyone have an idea about this?


___

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

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

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

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


Re: setAction:@selector is not working ?

2010-02-18 Thread Graham Cox

On 19/02/2010, at 12:53 PM, David M. Cotter wrote:

> i'm going to do a popup menu
> i run thru all the items and call 
> 
> [myMenuItem setAction:@selector(myFunction:)];
> 
> upon first run, my "myFunction" never gets called with the result of the menu 
> item pick.
> 
> but then, it works 100% of the time *after* i switch out then back into my app
> 
> whaaa??  does anyone have an idea about this?


What's the target set to?

--Graham


___

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

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

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

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


Re: NSPredicate regex

2010-02-18 Thread martin halter
hello list 

I'd like to check a bunch of Strings if they contain the word "cache". The 
strings are actually paths and I check the last path component. I tried to use 
CoreText to detect words, but the API was a bit overwhelming. So I tried 
NSPredicate which worked like a charm. It detects the word as of word 
boundaries are not characters (numbers, space, dash and everything else). 

{
NSString *regex = @"(?:.*[\\s\\W0-9])*cache(?:[\\s\\W0-9].*)*";
NSPredicate * cacheStringRegex = [NSPredicate predicateWithFormat:@"SELF 
MATCHES %@", regex];
...

NSURL url; // assume this exists, comes from a directory enumerator
if ( [cacheStringRegex evaluateWithObject:[url lastPathComponent]] ) {
NSLog(@"found cache directory");
}
}

sadly, there is an error in the regex and i cannot find it. I had three strings 
where the CPU went to 100% and the app did not recover. here the three strings 
(yes, those are directory names outside of NSCachesDirectory, i was surprised 
too :-)

com.mini.cuckooClock.Widget.7561A773F51A798326D350FE0D5617D29C3D222A.1

binarygod-BGHUDAppKit-d240cfb1a1bc155e961db145dd94e960099711b2

11) mit cachedPreferredFrameSize, ZF_SPOTLIGHT_CACHE_RESULTS, ZF_GLOBAL_SCALE = 
0,707, INITIAL_BACKGROUND, CACHE_FOR_PREVIEWS


Respect to everybody who is fluent in regex. Respect to everybody who knows 
another approach.

regards & thank you in advance

mahal


___

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

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

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

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


Re: Quartz2D paths from vector?

2010-02-18 Thread Brian "Moses" Hall
If it'll work with your particular application, I'd say simplest is  
export PDF with a transparent background and import it into an  
NSImageView or whatever.


-- Moses Hall
   blugs.com

On Feb 17, 2010, at 2:05 PM, cocoa-dev-requ...@lists.apple.com wrote:

However this is quite difficult to draw by numbers. I would like to  
draw my

shapes
in something like Illustrator or Photoshop and then export the Path  
as a

vector path,
.AI or .EPS, and then convert that in to a set of points for  
NSBezier Path

to use.


___

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

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

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

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


Re: setAction:@selector is not working ?

2010-02-18 Thread David M. Cotter
target set to self
this is a menu item class override, the "myFunction" selector is part of the 
menu item class
note it works all the time except for the first time after switching out then in

On Feb 18, 2010, at 6:32 PM, Graham Cox wrote:

> 
> On 19/02/2010, at 12:53 PM, David M. Cotter wrote:
> 
>> i'm going to do a popup menu
>> i run thru all the items and call 
>> 
>> [myMenuItem setAction:@selector(myFunction:)];
>> 
>> upon first run, my "myFunction" never gets called with the result of the 
>> menu item pick.
>> 
>> but then, it works 100% of the time *after* i switch out then back into my 
>> app
>> 
>> whaaa??  does anyone have an idea about this?
> 
> 
> What's the target set to?
> 
> --Graham
> 
> 

___

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

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

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

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


Help with creating CustomViews

2010-02-18 Thread Jean-Henri Duteau
Hi all,

I'm a newcomer when it comes to Cocoa development.  I have some good books and 
they discuss the possibility of CustomViews but the views they create aren't 
the type that I'm interested.  I've scoured the web and haven't found exactly 
the help I need and I've tried the trial-and-error method and it hasn't worked.

What I'm trying to do is the following:
-I have a number of model objects, different instances of the same class.
-I want to create a CustomView that would enable the display of these objects.
-The CustomView is defined in its own NIB file.  It consists of a bunch of 
NSTextField objects laid out in NSBox.
-I then want to use that CustomView all over the place. :)  But for starters, 
I'm trying to create a window with 10 instances of my CustomView.
-I want to drop the CustomView in other NIB files and set up the 
actions/outlets/etc.

The path that I took that seemed to give the best promise was:
I created a CustomViewController (subclassing NSViewController)
In MyDocument.init, I init the CustomViewController with my CustomView NIB file.
In MyDocument.windowControllerDidLoadNib, I call viewController.view setFrame: 
and then windowController.window.contentView addSubView.

That manages to get my CustomView to show up in the document's window.  But 
that was done programatically and not in IB.

Then I looked at the DragAround sample code on the Apple site.  This seemed to 
be exactly give tips for exactly what I wanted, except that the DragAroundView 
draws itself, there is no NIB file for the view.

If someone can point me to some sample code, that would be great.  In the 
meantime, I'll keep trying.

Jean Duteau

___

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

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

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

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


Re: Appropriate -setWantsLayer: timing

2010-02-18 Thread Simon Wolf
Hi Keith,

In addition to David's reply, a small tip is that you can also get things 
working if you call setWantsLayer: and then follow it by assigning a layer:

[self setWantsLayer:YES];
[self setLayer:[CALayer layer]];

Otherwise the layer is added at some undetermined future point which may not 
(in my experience ever) be in the current run loop.

Simon Wolf

Website: http://www.ottersoftware.com
Twitter: http://www.twitter.com/sgaw


On 16 Feb 2010, at 20:52, Keith Duncan wrote:

> I'm wondering when writing a layer hosting view, when the most appropriate 
> time is to set the layer and call -setWantsLayer:YES?
> 
> Calling it in -initWithFrame: is too early and the view fails to 'draw'.
> 
> Keith
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/swolf%40fastmail.co.uk
> 
> This email sent to sw...@fastmail.co.uk

___

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

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

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

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


Implementing Ken-burns Effect

2010-02-18 Thread Kalyanraju M
I am trying to implement Ken-burns effect for iPhone. Implemented Zoom-In And 
Zoom-Out. Got struck while implementing "Panning". 

Any ideas to implement "Panning". 

And need to know the flow of effects like 
1 st panning then Zoom-In And Zoom-Out i.e order of effects.

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/archive%40mail-archive.com

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


Re: Appropriate -setWantsLayer: timing

2010-02-18 Thread Simon Wolf
On 17 Feb 2010, at 09:23, Keith Duncan wrote:

> 
> On 16 Feb 2010, at 21:40, David Duncan wrote:
> 
>>> Calling it in -initWithFrame: is too early and the view fails to 'draw'.
>> 
>> If you are creating the view programmatically, -initWithFrame: should be 
>> fine. If your loading from a nib, then -awakeFromNib is the appropriate 
>> place.
> 
> That's actually a more distilled version of my question. When your layer 
> hosting view may be instantiated programatically, or from a NIB; there is no 
> good place that covers both since the -init methods are too early (I haven't 
> needed to test -initWithCoder: yet).
> 
> Nor have I determined the boundary condition for which it works afterwards, I 
> suspect it's after the has been placed in the view hierarchy. But if that's 
> the case, does the view hierarchy need to be rooted in a window or can it be 
> floating.
> 
> One simple workaround I've been using (but wanted to check for a better 
> solution) is to call -setWantsLayer:YES in -initWithFrame: and layer-back the 
> view's parent in the XIB.

Hi Keith,

Whilst I was putting together something recently (it's on my blog is you want 
to see the code) but ended up with the ability to add the layers in 
-awakeFromNib because the view will always be defined in advance.

However I essentially ended up having to call -setWantsLayer: on my view and on 
the parent view as two calls because the parent view didn't always seem to pass 
the layer-backing on down to my view.

I thought that adding layer-backing in -initWithFrame: worked (you might need 
to add a layer at the same time) and I think you'll get away with calling it in 
both -initWithFrame: and in -awakeFromNib without any problems. At the very 
least you could check in -awakeFromNib to see if the view is already 
layer-backed and only call setWantsLayer: if it is not.

Simon Wolf

Website: http://www.ottersoftware.com
Twitter: http://www.twitter.com/sgaw
iChat: simon.w...@mac.com___

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

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

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

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


Real-Time Validation in a NSTextField.

2010-02-18 Thread Abhinay Kartik Reddyreddy
I have a NSTextField which should only accept numbers in a certain range say 
(-72000.00 to 72000.00). 

I tried using NSFormatter whihc worked partially. when i hit any alphabet 
character on the keyboard, the value in the NSTextField stays numeric but the 
cursor moves forward which is not desired. Heres how i set the formatter.

NSNumberFormatter* numFormatr = [[NSNumberFormatter alloc] init];
[numFormatr setFormatterBehavior:NSNumberFormatterBehaviorDefault];
[numFormatr setNumberStyle:NSNumberFormatterDecimalStyle];
[numFormatr setMinimumFractionDigits:2];
[mtextfield setFormatter:numFormatr];

Am i doing something wrong here..?? 

I tried an alternate approach using the delegate method controlTextDidChange:  
I ended up with the same problem as above. cursor position is incremented when 
an invalid character is typed.

- (void) controlTextDidChange:(NSNotification *)obj
{
// get the string value from the textfield
// eliminate invalid characters in the string
// set the result string as stringvalue of textfield
}

I was wondering if  there is any alternative / better approach for validating 
text in a textfield??

Thanks,
Abhinay.


___

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

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

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

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


close: before NSWindowWillCloseNotification

2010-02-18 Thread Charles Burnstagger
Hi all,

I have a typical window/controller on OS X 10.6.2.

When I click the window's close box, my window controller receives the close: 
message before it recevies the windowWillCloseNotification. This seems to be 
backwards in sequence to me. Any ideas why this happens and how to avoid it?

I need to recieve the notification *before* I receive close: since I want to do 
some stuff before the window goes away.

Thanks,

Chuck



  
___

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

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

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

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


Re: Appropriate -setWantsLayer: timing

2010-02-18 Thread Scott Anguish

On Feb 16, 2010, at 5:45 PM, Simon Wolf wrote:

>> 
>> I'm wondering when writing a layer hosting view, when the most appropriate 
>> time is to set the layer and call -setWantsLayer:YES?
>> 
>> Calling it in -initWithFrame: is too early and the view fails to 'draw'.

> 
> In addition to David's reply, a small tip is that you can also get things 
> working if you call setWantsLayer: and then follow it by assigning a layer:
> 
> [self setWantsLayer:YES];
> [self setLayer:[CALayer layer]];
> 
> Otherwise the layer is added at some undetermined future point which may not 
> (in my experience ever) be in the current run loop.
> 

This is incorrect.

If you want a layer-hosting view (rather than a layer-backed view) you must do 
this in the reverse order. setLayer: and then setWantsLayer:


___

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

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

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

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


Re: NSTableViewDataSource Protocol

2010-02-18 Thread Scott Anguish

On Feb 18, 2010, at 7:28 AM, Graham Cox wrote:

> In 10.6, NSTableViewDataSource became a formal protocol, where previously it 
> was an informal one. While the docs are strictly correct, they're a bit 
> misleading since the methods of the protocol have been available since 10.0

This has been corrected for the last push or two.

It says available since (whenever) made a formal protocol in 10.6.

___

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

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

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

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


Re: NSPredicate regex

2010-02-18 Thread BJ Homer
I've found Reggy (http://reggyapp.com/) to be *extremely* useful in
debugging regular expressions.

-BJ
___

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

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

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

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


Re: Implementing Ken-burns Effect

2010-02-18 Thread Jens Alfke

On Feb 16, 2010, at 11:18 PM, Kalyanraju M wrote:

> I am trying to implement Ken-burns effect for iPhone. Implemented Zoom-In And 
> Zoom-Out. Got struck while implementing "Panning". 
> 
> Any ideas to implement "Panning". 

Panning's just changing the x/y offset, while zooming changes the x/y scale. So 
figure out a position to start and end, and interpolate between them based on 
the time elapsed.

fract = (now - startTime) / totalTime
x = x0 + fract*(x1-x0)
y = y0 + fract*(y1-y0)
scale = scale0 + fract*(scale1-scale0)

then construct a transform based on x,y and scale, and set that.

—Jens___

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

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

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

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


Re: close: before NSWindowWillCloseNotification

2010-02-18 Thread Jens Alfke

On Feb 18, 2010, at 7:47 PM, Charles Burnstagger wrote:

> I need to recieve the notification *before* I receive close: since I want to 
> do some stuff before the window goes away.

What kind of stuff? The window still exists when you get the windowWillClose 
notification, so you can safely call into it or your views.

If you're talking about interacting with the user (like confirming the close), 
you should implement the -windowShouldClose: delegate method. This gets called 
earlier, before the -close call, and by returning NO from it you can prevent 
the close entirely.

—Jens___

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

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

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

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


How to detect if mouse on border of view

2010-02-18 Thread Mazen M. Abdel-Rahman
Hi All,

I was wondering if there is a straight forward away to know if the mouse is on 
the border of a view?  I know how to detect if the mouse enters a view area by 
using NSTrackingArea - but how can I tell if the mouse is on a border?  I would 
like to replicate iCal's behavior where a user can modify an event on the 
calendar by clicking on the edge of the appt. rectangle and dragging it.  

Thanks,
Mazen
___

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

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

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

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


Re: How to detect if mouse on border of view

2010-02-18 Thread Graham Cox

On 19/02/2010, at 3:44 PM, Mazen M. Abdel-Rahman wrote:

> I was wondering if there is a straight forward away to know if the mouse is 
> on the border of a view?  I know how to detect if the mouse enters a view 
> area by using NSTrackingArea - but how can I tell if the mouse is on a 
> border?  I would like to replicate iCal's behavior where a user can modify an 
> event on the calendar by clicking on the edge of the appt. rectangle and 
> dragging it.  


The "border" of a view doesn't really exist - it's infinitely narrow.

What you really want is to detect that the mouse is inside the view but within 
a pixel or two of the edge. That is easy to work out by comparing the mouse 
point against the bounds to whatever degree of precision you want (I'd suggest 
not making it too precise, as it will be hard to hit - 4 pixels minimum is 
probably OK).

--Graham


___

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

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

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

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


Re: How to detect if mouse on border of view

2010-02-18 Thread Jens Alfke

On Feb 18, 2010, at 8:44 PM, Mazen M. Abdel-Rahman wrote:

> I was wondering if there is a straight forward away to know if the mouse is 
> on the border of a view?  I know how to detect if the mouse enters a view 
> area by using NSTrackingArea - but how can I tell if the mouse is on a 
> border?  I would like to replicate iCal's behavior where a user can modify an 
> event on the calendar by clicking on the edge of the appt. rectangle and 
> dragging it. 

In your mouseDown: method, compare the coordinates against the edges of the 
view's bounds.
Or is there a reason you need to know before the mouse-down occurs?

—Jens___

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

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

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

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


Re: NSPredicate regex

2010-02-18 Thread Stephen J. Butler
On Tue, Feb 16, 2010 at 9:55 AM, martin halter  wrote:
>    NSString *regex = @"(?:.*[\\s\\W0-9])*cache(?:[\\s\\W0-9].*)*";

Your regex is pathological. It's not hard to confuse the matcher with
really convoluted regular expressions. Consider this: how is your
pattern any different from...

NSString *regex = @"cache";

Since your atoms before and after "cache" can match 0 or more times,
you could greatly simplify the thing by just not matching at all!
Never mind the .* inside the atoms.

If you want to match the word cache that is surrounded by some sort of
defined separators, I'd suggest:

(^|[\s\W0-9])cache([\s\W0-9]|$)

Broken down:

- the start of the string, or some other selected separator
- cache
- some other selected separator, or the end of the string

That should match cache in this instances:

"cache"
"cache some other stuff"
"some other stuff cache"
"some other cache stuff"
"cache/some other stuff"
"some other stuff/cache"
"some other/cache/stuff"
"cache0some other stuff"
"some other stuff0cache"
"some other1cache2stuff"

But not: "some othercachestuff"

Note: I'm not familiar with the particular flavor of regexes ICU uses.
More used to Java and PCRE. But this is the basic idea.
___

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

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

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

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