Re: Editable PopUpButtons

2009-04-26 Thread Benjamin Dobson


On 26 Apr 2009, at 04:18:56, Arun wrote:


Hi

Is the any control which is similar to NSPopUpButtonCell but still  
editable?


Thanks
Arun KA


NSComboBox.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Editable PopUpButtons

2009-04-26 Thread Jerry Krinock


On 2009 Apr 25, at 20:18, Arun wrote:

Is the any control which is similar to NSPopUpButtonCell but still  
editable?


I presume you mean NSPopUpButton, which is a control that wraps  
NSPopUpButtonCell which is a cell.


Look at "NSComboBox".

Too bad someone couldn't have thunk up a better name for NSComboBox.   
NSEditableMenu?


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Editable PopUpButtons

2009-04-26 Thread Quincey Morris

On Apr 26, 2009, at 00:07, Jerry Krinock wrote:


On 2009 Apr 25, at 20:18, Arun wrote:

Is the any control which is similar to NSPopUpButtonCell but still  
editable?


I presume you mean NSPopUpButton, which is a control that wraps  
NSPopUpButtonCell which is a cell.


Look at "NSComboBox".

Too bad someone couldn't have thunk up a better name for  
NSComboBox.  NSEditableMenu?


Except that NSComboBox is a kind of text field, not a kind of menu.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Coca equivalent to NMInstall?

2009-04-26 Thread Trygve Inda
Is there an equivalent to NMInstall in Cocoa? I want to be able to post an
error message to the OSW and then immediately quit, but still have my
message show up to the user. This is from a faceless background application.

Thanks,

Trygve


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Coca equivalent to NMInstall?

2009-04-26 Thread Ken Thomases

On Apr 26, 2009, at 2:52 AM, Trygve Inda wrote:

Is there an equivalent to NMInstall in Cocoa? I want to be able to  
post an

error message to the OSW and then immediately quit, but still have my
message show up to the user. This is from a faceless background  
application.


It's not Cocoa, but CFUserNotificiation is probably the closest in  
spirit to NMInstall.  I don't know if the notification dialog persists  
if your process exits.


Cheers,
Ken

___

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

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

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

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


Re: Coca equivalent to NMInstall?

2009-04-26 Thread Dave Keck
> It's not Cocoa, but CFUserNotificiation is probably the closest in spirit to
> NMInstall.  I don't know if the notification dialog persists if your process
> exits.

It does.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Clicking through a NSView with CALayers

2009-04-26 Thread Bill Cheeseman

On Apr 25, 2009, at 10:08 PM, Rowan Nairn wrote:

On Sat, 25 Apr 2009 at 17:26 AM, Bill Cheeseman  
 wrote:

I have an identical setup on an application I'm currently working on,
and clickthrough works just fine for me.


Really?  I hope we're talking about the same thing here.  I just
created a new blank Cocoa Application, and changed the window to a
custom class with this initialization code:


Making the window invisible isn't relevant -- visual transparency and  
clickthrough are two different qualities. To make a window transparent  
to mouse events, you have to call -[NSWindow  
setIgnoresMouseEvents:YES]. Note that the entire window will be  
clickthrough, not just transparent areas. Clickthrough works even on  
windows that are not invisible. It's normally used to make overlay  
windows.


--

Bill Cheeseman - b...@cheeseman.name
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.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


NSString may not respond to a method in documentation?

2009-04-26 Thread Mr. Gecko
Hello, I'm having a weird warning about NSString and I have no idea  
why it's happening, maybe you could tell me why?


This is my code.
NSString *string = [[[NSString alloc] initWithData:data  
encoding:NSUTF8StringEncoding] autorelease];
NSArray *components = [string componentsSeparatedByCharactersInSet: 
[NSCharacterSet characterSetWithCharactersInString:@"\r\n"]];


And this is the warning.
warning: 'NSString' may not respond to '- 
componentsSeparatedByCharactersInSet:'


I think this is weird because componentsSeparatedByCharactersInSet is  
in the documentation for NSString It still works, but I don't know why  
xcode would give me this warning.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Strange error message when trying to print

2009-04-26 Thread Peter Hudson
When I try to print a document ( to PDF ) the app can sometimes hang -  
and  I get a long message which looks like debug printout from the OS  
in the debug console.


The last section of the message seems to contain the crux of the  
problem : -



Sun Apr 26 12:42:51 peter-hudsons-macbook-pro.local tofile[6484]  
: The function `CGPDFDocumentGetMediaBox' is obsolete and will  
be removed in an upcoming update. Unfortunately, this application, or  
a library it uses, is using this obsolete function, and is thereby  
contributing to an overall degradation of system performance. Please  
use `CGPDFPageGetBoxRect' instead.

INFO: cgpdftopdf (PID 6484) exited with no errors.




My code does not directly call this method.

Any suggestions would be helpful.

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: NSString may not respond to a method in documentation?

2009-04-26 Thread Dave Geering
> I think this is weird because componentsSeparatedByCharactersInSet is in the
> documentation for NSString It still works, but I don't know why xcode would
> give me this warning.

This method was added in Mac OS 10.5, so if you're using the Cocoa
framework from the 10.4 SDK you will get that warning, and your
program won't work on Mac OS 10.4.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSString may not respond to a method in documentation?

2009-04-26 Thread Mr. Gecko

Oh ok, thanks.

On Apr 26, 2009, at 8:08 AM, Dave Geering wrote:

I think this is weird because componentsSeparatedByCharactersInSet  
is in the
documentation for NSString It still works, but I don't know why  
xcode would

give me this warning.


This method was added in Mac OS 10.5, so if you're using the Cocoa
framework from the 10.4 SDK you will get that warning, and your
program won't work on Mac OS 10.4.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


FSPathCopyObjectSync and symbolic links?

2009-04-26 Thread Iceberg-Dev
Is it possible to copy a symbolic link (the symbolic link file and  
not the item it references) using the FSPathCopyObjectSync API?


No valuable info was found in the documentation, the list archive,  
google results.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Multiple cell in a table column

2009-04-26 Thread Jerry Krinock


On 2009 Apr 25, at 20:17, Arun wrote:


Is it possible to have multiple Cells in a single table column?


No.

I need to have NSTextFiledCell and NSPopUpButtonCell in a single  
table column.


Same answer I gave you yesterday when you wanted an text + image.   
Subclass NSCell again, or reconsider if you ^really^ need to have that  
in one column instead of two.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: parsing a string into words

2009-04-26 Thread Alastair Houghton

On 26 Apr 2009, at 04:33, Jeffrey Oleander wrote:

NSArray * tokens = [string componentsSeparatedByCharactersInSet:  
whitespaceCharacterSet];


No, no, no.  If you read Gerriet's original post, you would have  
noticed that he even explained that what you just said won't work,  
because not all languages use whitespace to separate words like  
English does.


You probably want to be using CFStringTokenizer(), at least on OS X.   
For cross-platform code, ICU is probably your best bet.


Kind regards,

Alastiar.

--
http://alastairs-place.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: FSPathCopyObjectSync and symbolic links?

2009-04-26 Thread Michael Hall


On Apr 26, 2009, at 8:22 AM, Iceberg-Dev wrote:

Is it possible to copy a symbolic link (the symbolic link file and  
not the item it references) using the FSPathCopyObjectSync API?


No valuable info was found in the documentation, the list archive,  
google results.


The File Manager Reference
http://developer.apple.com/documentation/Carbon/Reference/ 
File_Manager/Reference/reference.html#//apple_ref/c/func/ 
FSCopyObjectSync

saying
A pointer to the source object to copy. The object can be a file or  
a directory.




would suggest to me that a symlink file would be OK.

Not sure if your searching came across "FSCopyObject - /Sources/ 
FSCopyObject.c"

http://developer.apple.com/SampleCode/FSCopyObject/listing3.html

but it might be informative to your question.

I was into these or similar links for a problem of my own yesterday  
but "the documentation, the list archive and google results" did lead  
to a resolution which they often do. I wasn't aware symlinks might be  
a problem until I started getting -1407 File Manager errors that  
seemed related to these files. Since you are aware in advance they  
might be a concern a little testing might give you a more definite  
answer and save some searching.
(Fwiw, I eliminated the use in one place of an FSSpec since these  
seem to be getting more and more deprecated these days and I used  
FSPathMakeRefWithOptions (10.4+) in another place which looked like  
it would default resolve symlinks and these changes seemed to correct  
my own problem. No -1407 errors).


Mike Hallhallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: NSPopUpButtonCell Keeps on Trackin'! Demo, Movie

2009-04-26 Thread Jerry Krinock
Well, even after distilling into a tiny demo, I still can't figure  
this one out.  A popup menu attached to a regular button works fine.   
But when using it as an NSTableHeaderCell, it keeps tracking the mouse  
even after it's closed.


How can one work around this?

Here's a 30-second movie:

   http://sheepsystems.com/engineering/projects/KOT/KeepOnTrackin.mov

and the tiny demo project (56 KB):

   http://sheepsystems.com/engineering/projects/KOT/KeepOnTrackin.zip

and finally, for those who would rather just look at the code:


#import "KOTAppDel.h"


@implementation KOTAppDel

// Start a ticking timer.  When the timer pauses, we'll know
// that one of our popup menus is tracking the mouse.
- (void)applicationDidFinishLaunching:(NSNotification*)note {
[NSTimer scheduledTimerWithTimeInterval:1.0
 target:self
   selector:@selector(tick)
   userInfo:nil
repeats:YES] ;
}

- (void)tick {
NSLog(@"tick") ;
}

- (void)logChoice:(id)sender {
NSLog(@"You clicked \"%...@\"", [sender title]) ;
}

- (NSMenu*)makeMenu {
NSMenu* menu = [[NSMenu alloc] init] ;
NSArray* choices = [NSArray arrayWithObjects:
@"Me",
@"Oh",
@"My",
nil] ;
for (NSString* choice in choices) {
NSMenuItem* item ;
item = [[NSMenuItem alloc] init] ;
[item setRepresentedObject:choice] ;
[item setTitle:choice] ;
[item setAction:@selector(logChoice:)] ;
[menu addItem:item] ;
[item release] ;
}

return [menu autorelease] ;
}

- (void)awakeFromNib {
[table setDelegate:self] ;
}

// Action method for the button
- (IBAction)buttonClicked:(id)sender {
NSPopUpButtonCell* popUpCell = [[NSPopUpButtonCell alloc] init] ;

[popUpCell setMenu:[self makeMenu]] ;
[popUpCell performClickWithFrame:NSZeroRect
 inView:sender] ;
[popUpCell release] ;
}

// Table View delegate method.
// A little more complicated since we have to dig into the
// parts of the table, and assign it as a header cell.
- (void)   tableView:(NSTableView*)tableView
  mouseDownInHeaderOfTableColumn:(NSTableColumn *)tableColumn {
NSTableHeaderView *headerView = [tableView headerView] ;

NSPopUpButtonCell* popUpCell = [[NSPopUpButtonCell alloc] init] ;
[tableColumn setHeaderCell:popUpCell] ;

[popUpCell setMenu:[self makeMenu]] ;
[popUpCell performClickWithFrame:NSZeroRect
  inView:headerView] ;
[popUpCell release] ;
}

@end


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Trying to get flagsChanged: to work

2009-04-26 Thread Mike Abdullah


On 25 Apr 2009, at 9:07PM, Sean McBride wrote:


Dave DeLong (davedel...@me.com) on 2009-04-25 1:46 PM said:

Interesting.  Coming from the world of iPhone dev, this seems wrong  
to

me.  On the iPhone, a view's controller is in the chain by default.


NSViewController was added in 10.5.  Perhaps automatically adding it  
to

the chain would have caused backwards compatibility problems.  No such
problems on iPhone.  (Yet. :))


More important is the question of where in the chain to place it. This  
post may help:

http://katidev.com/blog/2008/04/17/nsviewcontroller-the-new-c-in-mvc-pt-2-of-3/

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Nested AutoRelease Pools Crash

2009-04-26 Thread Trygve Inda
- (void)threadMethod:(id)anObject
{
   NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init];

   NSDictionary*userDefaults = [NSUserDefaults standardUserDefaults]
   importantValue = [[userDefaults objectForKey:@"myKey"] boolValue];

while (1)
{
NSAutoreleasePool* innerPool = [[NSAutoreleasePool alloc] init];

if (![self threadMustExit])
[self doStuffWith:importantValue];
if (![self threadMustExit])
[self doMoreStuff];
if (![self threadMustExit])
[self doEvenMore];

[innerPool release];

if ([lock lockWhenCondition:kConditionThreadMustExit])
{
[lock unlock];
break;
}
}

[lock lock];
[lock unlockWithCondition:kConditionThreadIdle];

[outterPool release];
}


This crashes the second time through the loop (when innerPool is being
created for the second time). Why?

I need to drain the pool each time through the inner loop. I am not using
Garbage Collection.

Thread 4 Crashed:
0   libobjc.A.dylib   0x9557f688 objc_msgSend + 24
1   com.xericdesign.earthdesk.core0x8b3c 0x1000 + 31548
2   com.apple.Foundation  0x92a0e7ed -[NSThread main] + 45
3   com.apple.Foundation  0x92a0e394 __NSThread__main__ + 308
4   libSystem.B.dylib 0x90e7b095 _pthread_start + 321
5   libSystem.B.dylib 0x90e7af52 thread_start + 34


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Nested AutoRelease Pools Crash

2009-04-26 Thread Trygve Inda
> - (void)threadMethod:(id)anObject
> {
>NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init];
> 
>NSDictionary*userDefaults = [NSUserDefaults standardUserDefaults]
>importantValue = [[userDefaults objectForKey:@"myKey"] boolValue];
> 
> while (1)
> {
> NSAutoreleasePool* innerPool = [[NSAutoreleasePool alloc] init];

Hmmm... I changed this to:

   NSAutoreleasePool* innerPool;

   innerPool = [[NSAutoreleasePool alloc] init];

Since it needs to be re-alloc'd each time, but it still give the same crash.

Thread 4 Crashed:
0   libobjc.A.dylib   0x9557f688 objc_msgSend + 24
1   com.xericdesign.earthdesk.core0x8b3c 0x1000 + 31548
2   com.apple.Foundation  0x92a0e7ed -[NSThread main] + 45
3   com.apple.Foundation  0x92a0e394 __NSThread__main__ + 308
4   libSystem.B.dylib 0x90e7b095 _pthread_start + 321
5   libSystem.B.dylib 0x90e7af52 thread_start + 34


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Nested AutoRelease Pools Crash

2009-04-26 Thread Clark Cox
2009/4/26 Trygve Inda :
>> - (void)threadMethod:(id)anObject
>> {
>>    NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init];
>>
>>    NSDictionary*    userDefaults = [NSUserDefaults standardUserDefaults]
>>    importantValue = [[userDefaults objectForKey:@"myKey"] boolValue];
>>
>>     while (1)
>>     {
>>         NSAutoreleasePool* innerPool = [[NSAutoreleasePool alloc] init];
>
> Hmmm... I changed this to:
>
>   NSAutoreleasePool* innerPool;
>
>   innerPool = [[NSAutoreleasePool alloc] init];
>
> Since it needs to be re-alloc'd each time, but it still give the same crash.

That changes nothing about your code (i.e. they both do the same thing).

>
> Thread 4 Crashed:
> 0   libobjc.A.dylib                   0x9557f688 objc_msgSend + 24
> 1   com.xericdesign.earthdesk.core    0x8b3c 0x1000 + 31548
> 2   com.apple.Foundation              0x92a0e7ed -[NSThread main] + 45
> 3   com.apple.Foundation              0x92a0e394 __NSThread__main__ + 308
> 4   libSystem.B.dylib                 0x90e7b095 _pthread_start + 321
> 5   libSystem.B.dylib                 0x90e7af52 thread_start + 34

Well, what message are you sending to what object at
"com.xericdesign.earthdesk.core0x8b3c 0x1000 + 31548"?


-- 
Clark S. Cox III
clarkc...@gmail.com
___

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

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

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

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


Re: Nested AutoRelease Pools Crash

2009-04-26 Thread Michael Ash
2009/4/26 Trygve Inda :
> - (void)threadMethod:(id)anObject
> {
>   NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init];
>
>   NSDictionary*    userDefaults = [NSUserDefaults standardUserDefaults]
>   importantValue = [[userDefaults objectForKey:@"myKey"] boolValue];
>
>    while (1)
>    {
>        NSAutoreleasePool* innerPool = [[NSAutoreleasePool alloc] init];
>
>        if (![self threadMustExit])
>            [self doStuffWith:importantValue];
>        if (![self threadMustExit])
>            [self doMoreStuff];
>        if (![self threadMustExit])
>            [self doEvenMore];
>
>        [innerPool release];
>
>        if ([lock lockWhenCondition:kConditionThreadMustExit])
>        {
>            [lock unlock];
>            break;
>        }
>    }
>
>    [lock lock];
>    [lock unlockWithCondition:kConditionThreadIdle];
>
>    [outterPool release];
> }
>
>
> This crashes the second time through the loop (when innerPool is being
> created for the second time). Why?

How about posting your real code instead of a weird paraphrase? This
won't even compile. Aside from the obvious doMoreStuff methods in the
middle, the lockWhenCondition: method returns void, so if ([lock
lockWhenCondition:kConditionThreadMustExit]) is not going to compile.
It's impossible to diagnose a problem when we're not even looking at
the same code as the code that crashes.

> I need to drain the pool each time through the inner loop. I am not using
> Garbage Collection.
>
> Thread 4 Crashed:
> 0   libobjc.A.dylib                   0x9557f688 objc_msgSend + 24
> 1   com.xericdesign.earthdesk.core    0x8b3c 0x1000 + 31548
> 2   com.apple.Foundation              0x92a0e7ed -[NSThread main] + 45
> 3   com.apple.Foundation              0x92a0e394 __NSThread__main__ + 308
> 4   libSystem.B.dylib                 0x90e7b095 _pthread_start + 321
> 5   libSystem.B.dylib                 0x90e7af52 thread_start + 34

Looks like a pretty standard memory mismanagement crash to me. Turn on
zombies and start seeing what's being over-released.

Mike
___

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

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

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

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


Re: Nested AutoRelease Pools Crash

2009-04-26 Thread Dave Keck
> - (void)threadMethod:(id)anObject
> {
>   NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init];
>
>   NSDictionary*    userDefaults = [NSUserDefaults standardUserDefaults]
>   importantValue = [[userDefaults objectForKey:@"myKey"] boolValue];

+standardUserDefaults don't return no dictionary.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Getting the message text of a mail

2009-04-26 Thread Nicko van Someren
Without wanting to discuss undocumented APIs, you might want to Google  
'GPGMail' as an example of a plug-in for Mail.app which adds support  
for using the Open Source GPG mail encryption code.  The plug-in makes  
a fairly good stab at being compatible across a number of versions of  
Mail.app and OS X.


Having said that, Scott is quite right that based on historical  
precedent this WILL BREAK when the next version of Mail.app.  There  
really should be an API for this sort of thing so please do add your  
voice by filing a bug report.


Nicko

On 21 Apr 2009, at 15:08, Julien Jalon wrote:

The problem is not really that your plugin might be broken by a new  
version of mail but that it might break mail without the user  
understanding it's caused by your plugin.


--
Julien from his iPhone

Le 21 avr. 2009 à 23:47, geoff...@fileflow.com a écrit :



On 21 Apr 2009, at 22:53, Kyle Sluder wrote:

On Tue, Apr 21, 2009 at 4:17 PM, Scott Anguish  
 wrote:
You should know that there is no public API for writing a  
Mail.app plugin.


And please file a bug regarding this glaring omission.

--Kyle Sluder



Good point. I know all this but I'm willing to take the chance and  
update version of the plugins when new Mail.app is coming. But I  
really would need some help getting the body message as a String.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


NSTask, or threading?

2009-04-26 Thread James Maxwell

Hello All,

My current project uses something like a database - it's not a  
database, but the idea is that it both stores knowledge, and  
"searches" its stored knowledge during runtime. I'll call this  
database-like entity the "dataThing"... The dataThing is complex -  
lots of calculations going on in there.


It's a music app, and the dataThing is listening to input MIDI events,  
doing a bunch of processing, then returning something from its stored  
knowledge. If all of this happens in the main run loop, it remains  
stable, but as the amount of stored knowledge goes up, and the music  
gets busier, the playback starts to drag and stutter - i.e., the  
amount of work being done in the dataThing is too time consuming, and  
the playback starts to suffer.


I tried doing really simple threading of some of the dataThing's work,  
using performSelectorInBackground, but that's causes crashes,  
apparently arising from objects being freed before their time. I also  
tried NSOperation and NSOperationQueue, but that does basically the  
same thing. The errors aren't totally consistent - they range from  
unexplained exc_bad_access crashes to NSZombie errors about messaging  
freed objects, and so on... Anyway, the main point seems to be that  
the dataThing really needs to be able to run completely serially, with  
it's own data, and yet be allowed to "lag behind" to a certain degree  
when the processing gets heavy, without disturbing playback of the  
MIDI data. This lagging isn't a huge problem, in itself, as I can deal  
with the lag in response time at a later point in execution (i.e.,  
when I handle the return of the dataThing).


So, how can I put my dataThing into some process, thread, etc., in a  
way that keeps it totally in its "own world", so to speak? It seems  
like NSTask is the way to go, but perhaps there's also a way to just  
create a single, persistent thread for the dataThing to run on...(??)
What I'd like to do is to instantiate my dataThing and run in a  
separate process (or similar), then just send it my input MIDI  
messages, and listen for its responses. Does that sound like a job for  
NSTask? I guess what's not clear to me about NSTask is how to use it  
for something that *isn't* already a "program" - everything I'm  
finding about NSTask seems to imply that the task is a separate  
program (every tutorial seems to be about wrapping command-line apps).  
In my case, it will just be a few classes, that process the input MIDI  
data in series, and return the result:


MIDI event --> [class 1 -> class 2 -> class 3] -> result

What I want is more like:

MIDI event --> output -->  
integrate result

 \ --> [class 1 -> class 2 -> class 3] -> result /

Any tips greatly appreciated. Sorry for the long message...

J.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Nested AutoRelease Pools Crash

2009-04-26 Thread Trygve Inda
> 2009/4/26 Trygve Inda :
>> - (void)threadMethod:(id)anObject
>> {
>>   NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init];
>> 
>>   NSDictionary*    userDefaults = [NSUserDefaults standardUserDefaults]
>>   importantValue = [[userDefaults objectForKey:@"myKey"] boolValue];
>> 
>>    while (1)
>>    {
>>        NSAutoreleasePool* innerPool = [[NSAutoreleasePool alloc] init];
>> 
>>        if (![self threadMustExit])
>>            [self doStuffWith:importantValue];
>>        if (![self threadMustExit])
>>            [self doMoreStuff];
>>        if (![self threadMustExit])
>>            [self doEvenMore];
>> 
>>        [innerPool release];
>> 
>>        if ([lock lockWhenCondition:kConditionThreadMustExit])
>>        {
>>            [lock unlock];
>>            break;
>>        }
>>    }
>> 
>>    [lock lock];
>>    [lock unlockWithCondition:kConditionThreadIdle];
>> 
>>    [outterPool release];
>> }
>> 
>> 
>> This crashes the second time through the loop (when innerPool is being
>> created for the second time). Why?
> 
> How about posting your real code instead of a weird paraphrase? This
> won't even compile. Aside from the obvious doMoreStuff methods in the
> middle, the lockWhenCondition: method returns void, so if ([lock
> lockWhenCondition:kConditionThreadMustExit]) is not going to compile.
> It's impossible to diagnose a problem when we're not even looking at
> the same code as the code that crashes.

Sorry - the real code is huge and hard to narrow down - working on it.


___

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

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

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

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


Re: Nested AutoRelease Pools Crash

2009-04-26 Thread Trygve Inda
>> - (void)threadMethod:(id)anObject
>> {
>>   NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init];
>> 
>>   NSDictionary*    userDefaults = [NSUserDefaults standardUserDefaults]
>>   importantValue = [[userDefaults objectForKey:@"myKey"] boolValue];
> 
> +standardUserDefaults don't return no dictionary.
> 

Sorry - what I thought were irrelevant parts were partly removed to keep the
email line wrap nice. I'll try to narrow it down some more.

T.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: parsing a string into words

2009-04-26 Thread Jeffrey Oleander

At Sun, 2009-04-26, 09:01, Alastair Houghton  
wrote:
>> At 2009 Apr 26, 04:33, Jeffrey Oleander wrote:
>> NSArray * tokens = [string
>> componentsSeparatedByCharactersInSet:
>> whitespaceCharacterSet];

> No, no, no.  If you read Gerriet's original post,
> you would have noticed that he even explained
> that what you just said won't work, because not
> all languages use whitespace to separate words
> like English does.
>
> You probably want to be using CFStringTokenizer(),
> at least on OS X.  For cross-platform code,
> ICU is probably your best bet.

Thanks for that info and the pointer to the ICU.
http://userguide.icu-project.org/boundaryanalysis
BreakIterator
Character, Word, Line or Sentence
"you provide an appropriate CharacterIterator"
UChar *

I was half expecting that response because I was
aware that "not all languages use white space to
separate words", but hoping for some magic in
NSString.
Unfortunately, CFStringTokenizer is not available 
in 10.3.9, and no, I do not have a chest of silver 
or gold behind my pillow to run around buying 
newer hardware and software, let alone doing so
every 2 years; we're in re-boot-strapping mode
in the land of the globalized Bush-Clinton-Bush-Obama
depression.

This makes ICU suspect: 
"Copyright (c) 2000 - 2008 IBM and Others"
Is Apple one of the "Others"?  The "using ICU" 
list is a mixed bag of reputable firms and 
unethical rogues, and I don't see any 
additional info on who is behind "ICU".

As much as I enjoy languages (I've taken a few
in college, and 10 years ago I was on a couple 
Unicode e-mailing lists mainly to read the 
interesting discussion about the differences), 
for now I'll stick with the US+Euro+Japanese+
Latin+Hebrew solution that I have, that uses 
Objective-C and doesn't drag me into the 
complications of Objective-C++ and transferring 
data around to different stores based on 
different programming language and framework 
conventions, that I can immediately use, 
can trust, and seems amenable to reasonable 
later modification to handle the remote out-liers.

Onward.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Clicking through a NSView with CALayers

2009-04-26 Thread Rowan Nairn
On Sun, Apr 26, 2009 at 3:08 AM, Bill Cheeseman  wrote:
> Making the window invisible isn't relevant -- visual transparency and
> clickthrough are two different qualities. To make a window transparent to
> mouse events, you have to call -[NSWindow setIgnoresMouseEvents:YES]. Note
> that the entire window will be clickthrough, not just transparent areas.
> Clickthrough works even on windows that are not invisible. It's normally
> used to make overlay windows.

Ok.  I think a little detail of my requirements got lost in this
thread somewhere.  I'm sorry I'm not able to ask this question clearly
enough.  Thanks for keeping at this.  So the little detail is this:  I
don't want to make my whole window transparent to mouse events.  There
are bits of my window on which I want to detect clicks.  Those are the
bits that I've drawn on.  I want the bits I haven't drawn on, the
visually transparent bits, to ignore clicks.

When I use [NSView drawRect:] this works as expected - any pixel that
is visually transparent is also transparent to clicks.  However when I
use a layer (either hosted or backed) the whole area intercepts
clicks, whether visually transparent or not.  I'm starting to think
there's no way around this so I might just go back to [NSView
drawRect:] even though it makes the animation slower.

Hope that was somewhat clearer.  Thanks for the help,
Rowan
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTask, or threading?

2009-04-26 Thread Joseph Kelly
You'll most likely want to put your MIDI stuff on a worker thread, and  
add synchronization around any data that could possibly be shared  
between threads.


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

It's non-trivial work if you are unfamiliar with concurrency. You will  
likely be troubleshooting deadlocks and memory incursions, and timing  
related bugs. But there's probably no other way.


Good luck!

Joe K.

On Apr 26, 2009, at 10:39 AM, James Maxwell wrote:


Hello All,

My current project uses something like a database - it's not a  
database, but the idea is that it both stores knowledge, and  
"searches" its stored knowledge during runtime. I'll call this  
database-like entity the "dataThing"... The dataThing is complex -  
lots of calculations going on in there.


It's a music app, and the dataThing is listening to input MIDI  
events, doing a bunch of processing, then returning something from  
its stored knowledge. If all of this happens in the main run loop,  
it remains stable, but as the amount of stored knowledge goes up,  
and the music gets busier, the playback starts to drag and stutter -  
i.e., the amount of work being done in the dataThing is too time  
consuming, and the playback starts to suffer.


I tried doing really simple threading of some of the dataThing's  
work, using performSelectorInBackground, but that's causes crashes,  
apparently arising from objects being freed before their time. I  
also tried NSOperation and NSOperationQueue, but that does basically  
the same thing. The errors aren't totally consistent - they range  
from unexplained exc_bad_access crashes to NSZombie errors about  
messaging freed objects, and so on... Anyway, the main point seems  
to be that the dataThing really needs to be able to run completely  
serially, with it's own data, and yet be allowed to "lag behind" to  
a certain degree when the processing gets heavy, without disturbing  
playback of the MIDI data. This lagging isn't a huge problem, in  
itself, as I can deal with the lag in response time at a later point  
in execution (i.e., when I handle the return of the dataThing).


So, how can I put my dataThing into some process, thread, etc., in a  
way that keeps it totally in its "own world", so to speak? It seems  
like NSTask is the way to go, but perhaps there's also a way to just  
create a single, persistent thread for the dataThing to run on...(??)
What I'd like to do is to instantiate my dataThing and run in a  
separate process (or similar), then just send it my input MIDI  
messages, and listen for its responses. Does that sound like a job  
for NSTask? I guess what's not clear to me about NSTask is how to  
use it for something that *isn't* already a "program" - everything  
I'm finding about NSTask seems to imply that the task is a separate  
program (every tutorial seems to be about wrapping command-line  
apps). In my case, it will just be a few classes, that process the  
input MIDI data in series, and return the result:


MIDI event --> [class 1 -> class 2 -> class 3] -> result

What I want is more like:

MIDI event --> output -->  
integrate result

\ --> [class 1 -> class 2 -> class 3] -> result /

Any tips greatly appreciated. Sorry for the long message...

J.
___

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

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

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

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


___

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

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

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

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


Re: NSTask, or threading?

2009-04-26 Thread Ken Thomases

On Apr 26, 2009, at 12:39 PM, James Maxwell wrote:

I guess what's not clear to me about NSTask is how to use it for  
something that *isn't* already a "program" - everything I'm finding  
about NSTask seems to imply that the task is a separate program  
(every tutorial seems to be about wrapping command-line apps).


Yes, you have to build a separate executable.  You can't make an  
NSTask to just invoke methods on classes and objects in the main app  
task.


Making a separate executable isn't all that hard.  You can add a  
Foundation tool target to your project.  Add the build product of this  
new target to the main target, so the executable gets copied into your  
application bundle.  Add your classes to the target.  Create a main  
function that does what the task should do.


Passing data between the background task and the main app task will  
require some work.  Maybe it will be sufficient to use pipes to  
communicate to/from the background task's standard input/output.   
Another possibility is Distributed Objects.


The main app has to manage the background task.  It has to start it  
when it's needed, configure it / set it up, and respond appropriately  
if the task exits/crashes/is killed.  It also has to terminate it when  
appropriate -- if you're communicating with it using pipes, then end- 
of-file on the background task's standard input is a good way to tell  
it to terminate.  That way, if the main app crashes or otherwise exits  
without a chance to explicitly clean up, the kernel will still tell  
the background task to terminate as a side effect of implicit cleanup  
(i.e. closing all of the main app's file descriptors).


Cheers,
Ken

___

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

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

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

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


Re: ObjectAlloc and objects that should have been released

2009-04-26 Thread Miles
I've narrowed this down to the smallest case I can.

I have a method that loads a view and immediately releases it:

UIWindow *win= [UIApplication
sharedApplication].keyWindow;
TestVC *test = [[TestVC alloc] init];
[win addSubview:test.view];
[test.view removeFromSuperview];
[test release];

And here is the entire TestVC class:

#import "TestVC.h"

@implementation TestVC

- (id)init
{
self = [super init];
if (self){}
return self;
}

// Implement loadView to create a view hierarchy programmatically, without
using a nib.
- (void)loadView {

UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen
mainScreen] applicationFrame]];
contentView.backgroundColor = [UIColor blackColor];
contentView.autoresizesSubviews = YES;
[contentView release];
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}

- (void)dealloc {
[super dealloc];
}

@end


When I look in ObjectAlloc, TestVC points to the "UIView *contentView"
declaration as created and still living. Is this just an objectAlloc bug, or
is there some other sort of autorelease thing that goes on behind the
scenes? I don't see any reason why this would still be hanging around.

Ugh.







On Fri, Apr 24, 2009 at 7:18 PM, Miles  wrote:

> Very interesting, I'll give all that a shot and report back. Thanks so
> much!
>
>
>
>
> On Apr 24, 2009, at 7:07 PM, Peter N Lewis  wrote:
>
>  On 25/04/2009, at 8:28 , Miles wrote:
>>
>>> I just mean that I'm adding some labels and images to the view. I have
>>> quadruple checked that they are all being released, but I must be
>>> overlooking something.
>>>
>>
>> I doubt its your issue, but I recently had a problem like this that took
>> me far too long to track down.
>>
>> The debugging technique I used was to override retain/release/autorelease
>> and dealloc and have them just call NSLog and super, then set a breakpoint
>> on each, add a backtrace "bt" debugging command and set them to
>> auto-continue.
>>
>> Eventually, after much hair pulling I tracked it down to my
>> removeFromSuperview override neglecting to call super - ouch!
>>
>> But one technique for finding this might be to make a trivial subclass of
>> UIImage that does the above and use it for logo.
>>
>> One other possibility would be - does UIImage cache images created with
>> initWithContentsOfFile?  The tehcnique above might tell you if thats what is
>> happening, because you should see UIImage system code adding it to an
>> array/dictiuonary/set and not releasing it later.
>>
>> Enjoy,
>>  Peter.
>>
>> --
>>Run macros from your iPhone with Keyboard Maestro Control!
>>or take a break with Derzle for your iPhone
>>
>> Keyboard Maestro  Macros for your Mac
>> Aragom Space War  Don't get
>> killed!
>> Derzle  Enjoy a relaxing puzzle.
>>    
>>
>>
>>
>>
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/vardpenguin%40gmail.com
>>
>> This email sent to vardpeng...@gmail.com
>>
>
___

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

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

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

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


Re: NSTask, or threading?

2009-04-26 Thread Richard Frith-Macdonald


On 26 Apr 2009, at 18:39, James Maxwell wrote:


So, how can I put my dataThing into some process, thread, etc., in a  
way that keeps it totally in its "own world", so to speak?


There is a simple an easy way to keep it in a separate thread ... so  
that's probably what you want to do.
You would use 'Distributed Objects' (the NSConnection class) to  
communicate between the main thread and the dataThing thread.


The way it works is as follows:

1. your code creates a pair of NSPort objects to talk to each other.
2. it launches a second thread, and in that thread creates a server  
NSConnection using those ports, and registers your dataThing object as  
the server object for the NSConnection
3. in the main thread another (client) NSConnection is created using  
the same two ports, and you ask the client connection for its 'root  
object'


From then on, the main thread sends messages to the 'root object' of  
the connection exactly as if it was sending them directly to the  
dataThing object, and the NSConnection code manages things for you so  
you don't have to worry about locking.


There's an example of this sort of thing at 
http://lachand.free.fr/cocoa/Threads.html
___

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

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

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

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


Re: Nested AutoRelease Pools Crash

2009-04-26 Thread Greg Guerin

Trygve Inda wrote:

Sorry - what I thought were irrelevant parts were partly removed to  
keep the

email line wrap nice. I'll try to narrow it down some more.



Instead of narrowing it down only for emailing, you might actually  
refactor it so the main loop looks more like the paraphrase you  
originally posted.  More than once, in the process of cleaning up  
code for presentation to someone else, I have found the problem that  
caused me to start cleaning it up for presentation.  Even when I  
didn't find the problem, the cleaned-up code has invariably been  
better as a result.


  -- GG

___

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

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

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

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


Re: Clicking through a NSView with CALayers

2009-04-26 Thread Bill Cheeseman

On Apr 26, 2009, at 2:09 PM, Rowan Nairn wrote:


So the little detail is this:  I
don't want to make my whole window transparent to mouse events.  There
are bits of my window on which I want to detect clicks.  Those are the
bits that I've drawn on.  I want the bits I haven't drawn on, the
visually transparent bits, to ignore clicks.

When I use [NSView drawRect:] this works as expected - any pixel that
is visually transparent is also transparent to clicks.  However when I
use a layer (either hosted or backed) the whole area intercepts
clicks, whether visually transparent or not.  I'm starting to think
there's no way around this so I might just go back to [NSView
drawRect:] even though it makes the animation slower.


As far as I know, there is no simple way to do that without drawing  
(and I didn't know you could do it with drawing).


It occurred to me, however, that you could use Quartz event taps to do  
this. Event taps let you intercept clicks globally, in any  
application, and modify them or take other action before you pass them  
along. You could intercept every mouse event at the global session  
level (before it is assigned to an application); determine whether its  
screen location is in your application's window, and which part of  
that window; set clickthrough on or off in your window depending on  
whether that area is transparent; and then send the click along. It  
would automatically go to your application or the application under  
it, depending on your window's clickthrough setting. I believe this  
could be made to work with mouse dragged events as well as click events.


You can read about event taps in Apple's "Quartz Event Services  
Reference" document, and play with them using my free utility, Event  
Taps Testbench, at .


Event taps are complicated if you aren't familiar with them, so if you  
already have a drawing solution maybe that's the best bet.


--

Bill Cheeseman - b...@cheeseman.name
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.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: ObjectAlloc and objects that should have been released

2009-04-26 Thread Miles
Wow. In that particular example it was '[UIScreen mainScreen]
applicationFrame' that was causing the problem. When I changed that to a
CGRectMake, the view was not longer living once I released it. Does
'[UIScreen mainScreen] applicationFrame' cause some sort of caching issue?

Now I'm at a point where this is keeping the view around longer than I think
it should:

NSDictionary *rootDict= [[NSDictionary alloc] initWithContentsOfFile:
filePath];
[rootDict release];

Could someone please explain what this is all about?

Thanks!



On Sun, Apr 26, 2009 at 12:16 PM, Miles  wrote:

> I've narrowed this down to the smallest case I can.
>
> I have a method that loads a view and immediately releases it:
>
> UIWindow *win= [UIApplication
> sharedApplication].keyWindow;
> TestVC *test = [[TestVC alloc] init];
> [win addSubview:test.view];
> [test.view removeFromSuperview];
> [test release];
>
> And here is the entire TestVC class:
>
> #import "TestVC.h"
>
> @implementation TestVC
>
> - (id)init
> {
> self = [super init];
> if (self){}
> return self;
> }
>
> // Implement loadView to create a view hierarchy programmatically, without
> using a nib.
> - (void)loadView {
>
> UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen
> mainScreen] applicationFrame]];
> contentView.backgroundColor = [UIColor blackColor];
> contentView.autoresizesSubviews = YES;
> [contentView release];
> }
>
> - (void)didReceiveMemoryWarning {
> [super didReceiveMemoryWarning];
> }
>
> - (void)dealloc {
> [super dealloc];
> }
>
> @end
>
>
> When I look in ObjectAlloc, TestVC points to the "UIView *contentView"
> declaration as created and still living. Is this just an objectAlloc bug, or
> is there some other sort of autorelease thing that goes on behind the
> scenes? I don't see any reason why this would still be hanging around.
>
> Ugh.
>
>
>
>
>
>
>
>
> On Fri, Apr 24, 2009 at 7:18 PM, Miles  wrote:
>
>> Very interesting, I'll give all that a shot and report back. Thanks so
>> much!
>>
>>
>>
>>
>> On Apr 24, 2009, at 7:07 PM, Peter N Lewis 
>> wrote:
>>
>>  On 25/04/2009, at 8:28 , Miles wrote:
>>>
 I just mean that I'm adding some labels and images to the view. I have
 quadruple checked that they are all being released, but I must be
 overlooking something.

>>>
>>> I doubt its your issue, but I recently had a problem like this that took
>>> me far too long to track down.
>>>
>>> The debugging technique I used was to override retain/release/autorelease
>>> and dealloc and have them just call NSLog and super, then set a breakpoint
>>> on each, add a backtrace "bt" debugging command and set them to
>>> auto-continue.
>>>
>>> Eventually, after much hair pulling I tracked it down to my
>>> removeFromSuperview override neglecting to call super - ouch!
>>>
>>> But one technique for finding this might be to make a trivial subclass of
>>> UIImage that does the above and use it for logo.
>>>
>>> One other possibility would be - does UIImage cache images created with
>>> initWithContentsOfFile?  The tehcnique above might tell you if thats what is
>>> happening, because you should see UIImage system code adding it to an
>>> array/dictiuonary/set and not releasing it later.
>>>
>>> Enjoy,
>>>  Peter.
>>>
>>> --
>>>Run macros from your iPhone with Keyboard Maestro Control!
>>>or take a break with Derzle for your iPhone
>>>
>>> Keyboard Maestro  Macros for your Mac
>>> Aragom Space War  Don't get
>>> killed!
>>> Derzle  Enjoy a relaxing puzzle.
>>>    
>>>
>>>
>>>
>>>
>>> ___
>>>
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/vardpenguin%40gmail.com
>>>
>>> This email sent to vardpeng...@gmail.com
>>>
>>
>
___

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

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

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

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


Re: Nested AutoRelease Pools Crash

2009-04-26 Thread Trygve Inda
> Trygve Inda wrote:
> 
>> Sorry - what I thought were irrelevant parts were partly removed to
>> keep the
>> email line wrap nice. I'll try to narrow it down some more.
> 
> 
> Instead of narrowing it down only for emailing, you might actually
> refactor it so the main loop looks more like the paraphrase you
> originally posted.  More than once, in the process of cleaning up
> code for presentation to someone else, I have found the problem that
> caused me to start cleaning it up for presentation.  Even when I
> didn't find the problem, the cleaned-up code has invariably been
> better as a result.

Yup. I cleaned it up... On of the "doStuff" was accolcating an NSDate that
was needed in the blockUnitl method, but it was getting drained with the
pool before that.

All better now.

T.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: FSPathCopyObjectSync and symbolic links?

2009-04-26 Thread Iceberg-Dev


On Apr 26, 2009, at 4:05 PM, Michael Hall wrote:



On Apr 26, 2009, at 8:22 AM, Iceberg-Dev wrote:

Is it possible to copy a symbolic link (the symbolic link file and  
not the item it references) using the FSPathCopyObjectSync API?


No valuable info was found in the documentation, the list archive,  
google results.


The File Manager Reference
http://developer.apple.com/documentation/Carbon/Reference/ 
File_Manager/Reference/reference.html#//apple_ref/c/func/ 
FSCopyObjectSync

saying
A pointer to the source object to copy. The object can be a file  
or a directory.




would suggest to me that a symlink file would be OK.


From what I'm seeing it's not.

My test case being like this:

I copy a symlink (pointing to a file that does not exist anymore) to  
a destination. When I use FSPathCopyObjectSync, it returns with error  
-43 (file not found).


Not sure if your searching came across "FSCopyObject - /Sources/ 
FSCopyObject.c"

http://developer.apple.com/SampleCode/FSCopyObject/listing3.html

but it might be informative to your question.


This is the solution I've been using till now. And it's a great  
solution if you need to get a solution that runs on Mac OS X 10.2 and  
later. But since I need 64-bit compatibility, I'm looking for  
solutions that I don't have to support if possible.


I was into these or similar links for a problem of my own yesterday  
but "the documentation, the list archive and google results" did  
lead to a resolution which they often do. I wasn't aware symlinks  
might be a problem until I started getting -1407 File Manager  
errors that seemed related to these files. Since you are aware in  
advance they might be a concern a little testing might give you a  
more definite answer and save some searching.
(Fwiw, I eliminated the use in one place of an FSSpec since these  
seem to be getting more and more deprecated these days and I used  
FSPathMakeRefWithOptions (10.4+) in another place which looked like  
it would default resolve symlinks and these changes seemed to  
correct my own problem. No -1407 errors).


My solution so far is to go with FSCopyObjectSync and make the FSRef  
conversion. I was hoping I would escape the conversion by using the  
path version.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Strange NSShadow behaviour in overlapping NSVie ws—bug?

2009-04-26 Thread Benjamin Dobson

Hello all,

I've subclassed NSButtonCell to provide custom drawing. This includes  
an NSShadow. All drawing is done inside the cell's bounds. As I want  
this to work easily in IB with minimum work, I've based it on the  
"Push" button style. This means the clickable button area is  
considerably smaller than the button's frame. This means putting two  
buttons next to each other overlaps the actual frame.


In this situation, the shadow in one of the two buttons is repeatedly  
drawn on top of itself, getting darker and decreasing in quality. Is  
this a bug or am I doing something wrong?


The code can be downloaded here: http://dl.getdropbox.com/u/896591/TestApp.zip

(Yes, I am making a set of HUD controls. And yes, I know there are a  
variety of third party frameworks available. However, I decided to  
create my own—both as a programming exercise and to avoid images.)___


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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Query regarding cursor change

2009-04-26 Thread Deepa

Hi,

I am developing an application for Leopard which is similar to the  
feature 'Open a part of this page in Dashboard' in Safari.


In addition to this, I also want to change the cursor when it enters  
specific area.


I have added a transparent window as a child of my Main Window and am  
handling all my drawing(Highlight) in the view added to the child  
window.


But, this child window cannot be made key window in my application for  
the following reasons:

i) Menu validation problems
ii) If web view is placed in main window, scrollbar of the web view  
looks disabled when child window is key window.
iii) If web view is placed in key window, then scrollbar of the web  
view looks disabled when we click on main window.


But, cursor will change only if the child window is key window. Is  
there any other way to track the cursor change.


Can someone help me out to resolve this issue.


Thanks and regards,
Deepa
de...@robosoftin.com



---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Clicking through a NSView with CALayers

2009-04-26 Thread Rowan Nairn
Thanks for the pointers.  I actually figured out a way to do it.  If
you [NSView setWantsLayer:NO] and render the layer yourself like
so.

- (void)drawRect:(NSRect)dirty {
CGContextRef ctx = [[NSGraphicsContext currentContext] graphicsPort];
CGContextClipToRect(ctx, NSRectToCGRect(dirty));
[[self layer] renderInContext:ctx];
}

...then the transparent pixels end up being transparent to clicks too!
 Can't say I understand what's going on here exactly and I'm guess I'm
using twice as much graphics memory as I need to now but it works.

Rowan

On Sun, Apr 26, 2009 at 12:37 PM, Bill Cheeseman  wrote:
> On Apr 26, 2009, at 2:09 PM, Rowan Nairn wrote:
>
>> So the little detail is this:  I
>> don't want to make my whole window transparent to mouse events.  There
>> are bits of my window on which I want to detect clicks.  Those are the
>> bits that I've drawn on.  I want the bits I haven't drawn on, the
>> visually transparent bits, to ignore clicks.
>>
>> When I use [NSView drawRect:] this works as expected - any pixel that
>> is visually transparent is also transparent to clicks.  However when I
>> use a layer (either hosted or backed) the whole area intercepts
>> clicks, whether visually transparent or not.  I'm starting to think
>> there's no way around this so I might just go back to [NSView
>> drawRect:] even though it makes the animation slower.
>
> As far as I know, there is no simple way to do that without drawing (and I
> didn't know you could do it with drawing).
>
> It occurred to me, however, that you could use Quartz event taps to do this.
> Event taps let you intercept clicks globally, in any application, and modify
> them or take other action before you pass them along. You could intercept
> every mouse event at the global session level (before it is assigned to an
> application); determine whether its screen location is in your application's
> window, and which part of that window; set clickthrough on or off in your
> window depending on whether that area is transparent; and then send the
> click along. It would automatically go to your application or the
> application under it, depending on your window's clickthrough setting. I
> believe this could be made to work with mouse dragged events as well as
> click events.
>
> You can read about event taps in Apple's "Quartz Event Services Reference"
> document, and play with them using my free utility, Event Taps Testbench, at
> .
>
> Event taps are complicated if you aren't familiar with them, so if you
> already have a drawing solution maybe that's the best bet.
>
___

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

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

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

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


Re: Why is NSString->FSRef so hard?

2009-04-26 Thread Sean McBride
Erg Consultant (erg_consult...@yahoo.com) on 2009-04-25 7:33 PM said:

>Isn't there some easy way to get an FSRef from an NSString that is a
>path containing special characters?

You can use NDAlias:


It provides an NSString category that converts to/from FSRef.

Sean


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Drawing Across NSTableView Columns

2009-04-26 Thread K. Darcy Otto
I'm attempting to model a real-world table structure with an  
NSTableView.  Here is what the table structure might look like on  
paper (warning: ASCII art ahead):


1. |  A
2. ||   B
3. |||C
4.  D
5.  E
6.  F

Between the number and the letters are a series of (unbroken) vertical  
lines, running from the row where they were first drawn, to a row  
where it ends.  Where each line begins and ends depends on various  
things going on in the table.  Also, each additional line creates an  
indent in the letters column.  The problem is, how do I model this in  
an NSTableView?  I have considered:


(a) Just using a series of pipes (|), to which the letter is appended  
as the return value for -tableView:objectValueForTableColumn:row: 
(int)row.  This could work, except that as long as the pipes are not  
vertically connected, it looks very ugly.


(b) Creating an image of the lines that is then somehow overlaid on  
the table to give the right effect.


(c) I read about setting the background colour of a table to a  
pattern, which might be based on an image here: http://www.cocoabuilder.com/archive/message/cocoa/2004/6/21/110256 
 I'm not sure whether this would work.


(d) I read about drawing within a custom NSTextField Cell here: http://www.cocoabuilder.com/archive/message/cocoa/2004/3/1/100423 
  I think this might still make the image break at each row.


Regarding (a), I was thinking maybe playing with the line thickness  
between rows, and then making a pipe (|) that is too big to fit within  
the cell might work; but I'm not really sure.


Any ideas how I should go about this?  Thanks.
___

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

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

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

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


Re: NSPopUpButtonCell Keeps on Trackin'! Demo, Movie

2009-04-26 Thread Jim Correia
On Sun, Apr 26, 2009 at 10:41 AM, Jerry Krinock  wrote:

> // Table View delegate method.
> // A little more complicated since we have to dig into the
> // parts of the table, and assign it as a header cell.
> - (void)               tableView:(NSTableView*)tableView
>  mouseDownInHeaderOfTableColumn:(NSTableColumn *)tableColumn {
>    NSTableHeaderView *headerView = [tableView headerView] ;
>
>    NSPopUpButtonCell* popUpCell = [[NSPopUpButtonCell alloc] init] ;
>    [tableColumn setHeaderCell:popUpCell] ;
>
>    [popUpCell setMenu:[self makeMenu]] ;
>    [popUpCell performClickWithFrame:NSZeroRect
>                          inView:headerView] ;
>    [popUpCell release] ;
> }

What you've done is replaced the table column's header cell, and
started a menu tracking session while the table view was already in
the middle of a mouse tracking session.

What are you really trying to accomplish here?

It is hard to offer advice without knowing what you want to build. But
you are probably going to want to take the approach of using a custom
header view (along with custom header cells as necessary.)

- 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: figuring out which TableView I am?

2009-04-26 Thread Jonathan Hess
Why not have a property/instance-variable that controls this directly  
and then set that in awakeFromNib from one of the controller classes  
that has an outlet to each of the table views?


If I maintained your project after you, the tag variable inherited  
from a distant superclass would not be the bit of information that I  
would expect to control the appearance of a table view.


Using the tag is certainly quick and easy, but probably isn't obvious  
or expected.


Jon Hess

On Apr 25, 2009, at 11:54 AM, David Scheidt wrote:



On Apr 25, 2009, at 1:34 PM, WT wrote:


On Apr 25, 2009, at 7:26 PM, David Scheidt wrote:


On Apr 25, 2009, at 1:13 PM, WT wrote:

NSTableView inherits from NSControl, which has methods -tag and - 
setTag. I would suggest assigning a different tag value to each  
instance of your NSTableView subclass (you'd do that in your  
subclass' initializer or -awakeFromNib method) and use the -tag  
method to identify the instance when you need to do so.


That's perfect.  Thanks!


You're welcome. It's my impression that tags are generally under- 
utilized, though very useful.


Yes, certainly very useful: makes this problem a switch statement.   
(And not fogetting to set them in IB, but I made tag == 0 and the  
default: case different ugly colors, so I'll know that someone  
forgot to set the right tag (default is zero), or set it to an  
invalid value when I see them.)   I've got a couple other places in  
this project where they'll likely make sense to use, for much the  
same reasons.





It's also possible to set the tag in IB (it's on the Attributes  
Inspector palette, in the "control" tab).  Since I'm not creating  
any dynamically, I can do that.


It's funny... I fired up IB and created a fake app to check if it  
was possible to set the tag through IB before I replied to your  
first message but, in my haste, missed it so I thought you'd have  
to do it in code.


Well, I'd never used them before.  So I looked them up in the  
NSControl class docs, which say " Tag values are not used  
internally; they are only changed by external invocations of  
setTag:. You typically set tag values in Interface Builder and use  
them at runtime in your application", so I figured there had to be a  
way to set them, and just looked until i found it.

___

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

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

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

This email sent to jh...@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: figuring out which TableView I am?

2009-04-26 Thread WT
NSControl is hardly a distant superclass. It's the immediate  
superclass of NSTableView. Also, why do something more complicated  
when there's an easy, built-in, and fully supported solution already  
in place, namely, tags?


If it's not obvious or expected, it's only because not enough people  
read the superclass documentation when they're looking for information  
on a class and, thus, don't make use of what's already built-in and  
supported. Besides, if expectations are the main issue, that's nothing  
that some in-code comments wouldn't solve.


More importantly, perhaps, is the fact that adding property/ivars is  
not a scalable solution in that it requires adding more code in  
several places if more tables are added. The tags solution only  
requires some fiddling with IB and updating a switch statement. That  
sounds to me a much simpler maintenance problem than having to update  
code in several places.


On the other hand, there's no single solution to most problems in this  
business. If you don't like the tags solution, feel free to do it  
differently.


Wagner

On Apr 27, 2009, at 12:36 AM, Jonathan Hess wrote:

Why not have a property/instance-variable that controls this  
directly and then set that in awakeFromNib from one of the  
controller classes that has an outlet to each of the table views?


If I maintained your project after you, the tag variable inherited  
from a distant superclass would not be the bit of information that I  
would expect to control the appearance of a table view.


Using the tag is certainly quick and easy, but probably isn't  
obvious or expected.


Jon Hess

On Apr 25, 2009, at 11:54 AM, David Scheidt wrote:


On Apr 25, 2009, at 1:34 PM, WT wrote:


On Apr 25, 2009, at 7:26 PM, David Scheidt wrote:


On Apr 25, 2009, at 1:13 PM, WT wrote:

NSTableView inherits from NSControl, which has methods -tag and - 
setTag. I would suggest assigning a different tag value to each  
instance of your NSTableView subclass (you'd do that in your  
subclass' initializer or -awakeFromNib method) and use the -tag  
method to identify the instance when you need to do so.


That's perfect.  Thanks!


You're welcome. It's my impression that tags are generally under- 
utilized, though very useful.


Yes, certainly very useful: makes this problem a switch statement.   
(And not fogetting to set them in IB, but I made tag == 0 and the  
default: case different ugly colors, so I'll know that someone  
forgot to set the right tag (default is zero), or set it to an  
invalid value when I see them.)   I've got a couple other places in  
this project where they'll likely make sense to use, for much the  
same reasons.


It's also possible to set the tag in IB (it's on the Attributes  
Inspector palette, in the "control" tab).  Since I'm not creating  
any dynamically, I can do that.


It's funny... I fired up IB and created a fake app to check if it  
was possible to set the tag through IB before I replied to your  
first message but, in my haste, missed it so I thought you'd have  
to do it in code.


Well, I'd never used them before.  So I looked them up in the  
NSControl class docs, which say " Tag values are not used  
internally; they are only changed by external invocations of  
setTag:. You typically set tag values in Interface Builder and use  
them at runtime in your application", so I figured there had to be  
a way to set them, and just looked until i found it.

___

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

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

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

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


Core Data Suddenly Losing Changes

2009-04-26 Thread Walker Argendeli
I've been working on a project that uses Core Data for a while now.  I  
recently changed the model and ran it, but I noticed an odd behavior:  
I wan't informed that the model had changed and was incompatible.  I  
went ahead and deleted the old xml file and when running the  
application again, it created another file.  The only problem is that  
Core Data has stopped saving.  EVery time I open the application, I'm  
presented with a blank slate.  I haven't been religiously using  
subversion, but I had a commit several days, so I checked out that  
revision. It has the exact same problem, but I'm certain this wasn't  
happening a few days.  I'm not sure what I could've done that could  
have caused this, but I'm completely stuck and going crazy trying to  
get my app to work again.


Thanks,
- Walker Argendeli

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: figuring out which TableView I am?

2009-04-26 Thread Jim Correia
On Sun, Apr 26, 2009 at 7:05 PM, WT  wrote:

> More importantly, perhaps, is the fact that adding property/ivars is not a
> scalable solution in that it requires adding more code in several places if
> more tables are added. The tags solution only requires some fiddling with IB
> and updating a switch statement. That sounds to me a much simpler
> maintenance problem than having to update code in several places.

I guess I'm not following your logic.

I want table 1 to have a blue background, so I set its tag to 3.
I want table 2 to also have a blue background, so I set its tag to 3.

I want table 1 to have red text. Switch off tag, 3 == red text.
I want table 2 to have green text. Oops - tag 3 already means blue
background + red text.

(Substitute any 2 actual properties for my background color + text
color - they are meant for illustration purposes only.)

Overloading tags for other properties is not scalable, because you
only have one property (the tag) which you are overloading to mean N
other properties and/or behaviors.

The only scalable solution to this problem is explicity
iVars/properties for each property/behavior you want to control in
your subclass. (Yes, this means configuring things by hand after
unarchiving your nib, or writing an IB plug-in so you can specify them
in IB.)

- 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: figuring out which TableView I am?

2009-04-26 Thread Graham Cox


On 27/04/2009, at 9:31 AM, Jim Correia wrote:


I want table 1 to have a blue background, so I set its tag to 3.
I want table 2 to also have a blue background, so I set its tag to 3.

I want table 1 to have red text. Switch off tag, 3 == red text.
I want table 2 to have green text. Oops - tag 3 already means blue
background + red text.

(Substitute any 2 actual properties for my background color + text
color - they are meant for illustration purposes only.)



Overloading tags for other properties is not scalable, because you
only have one property (the tag) which you are overloading to mean N
other properties and/or behaviors.



This is true, but your example of non-scalability does reflect a poor  
approach that you wouldn't be likely to follow in practice.


A tag is 32 bits, so can represent 2^32 different states, if used  
wisely. Dividing this into bitfields would allow you to partition it  
into several properties, for example four different colour properties,  
each with 256 possible colours each.


As long as you can specify your needs and know they won't need future  
scaling, you can get more out of a tag that just assigning 1, 2, 3 etc  
might suggest. The bitfield approach does have the downside of needing  
a bit of off-side calculation to arrive at the appropriate 'number'  
and this can be somewhat arcane. And yes, they are much less scalable  
than ivars. But it's definitely an approach that can be used if your  
needs are relatively simple.


--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: figuring out which TableView I am?

2009-04-26 Thread Greg Guerin

Jonathan Hess wrote:

Why not have a property/instance-variable that controls this  
directly and then set that in awakeFromNib from one of the  
controller classes that has an outlet to each of the table views?


If you needed a fully scalable solution with support for arbitrary  
properties, that would be the way to go.  But the OP didn't need  
that.  All he needed was 3 color-scheme variations of an otherwise  
standard NSTableView.


  http://lists.apple.com/archives/cocoa-dev/2009/Apr/msg01800.html

Even supposing the designer can't decide which colors to use for text  
and background, tags can still work. Simply reserve 8-bits of the tag  
for the text-color, 8-bits for the bkgd-color, and index into a table  
of the web-safe colors.


  http://en.wikipedia.org/wiki/Web_colors

Or index into a table of arbitrarily defined colors.  You can get as  
much flexibility of colors as you care to program, and there are  
still 16 bits unused in the tag.


Will this provide a fully scalable solution for arbitrary  
properties?  No.  But it doesn't need to be.  Some things will never  
need to scalable.  When the simpler solution no longer suffices,  
that's the time to create a more complex and scalable one.


  -- GG
___

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

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

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

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


NSTextView re-implementing word wrapping

2009-04-26 Thread Ryan Joseph
After reading through the archives I learned how to turn off word  
wrapping in NSTextView by calling a few methods in both NSText and  
NSTextContainer but calling them in reverse order (reverting the  
effect) did not restore word wrapping properly.


In particular I think the problem is setContainerSize. If I set it to  
a fixed width, text is wrapped but I would like it to follow the view  
bounds like it did originally. Is there a meta-value or something else  
I need to give it? Thanks for your ideas.


Regards,
Josef

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: figuring out which TableView I am?

2009-04-26 Thread Jonathan Hess


On Apr 26, 2009, at 5:19 PM, Greg Guerin wrote:


Jonathan Hess wrote:

Why not have a property/instance-variable that controls this  
directly and then set that in awakeFromNib from one of the  
controller classes that has an outlet to each of the table views?


If you needed a fully scalable solution with support for arbitrary  
properties, that would be the way to go.  But the OP didn't need  
that.  All he needed was 3 color-scheme variations of an otherwise  
standard NSTableView.


 http://lists.apple.com/archives/cocoa-dev/2009/Apr/msg01800.html

Even supposing the designer can't decide which colors to use for  
text and background, tags can still work. Simply reserve 8-bits of  
the tag for the text-color, 8-bits for the bkgd-color, and index  
into a table of the web-safe colors.


 http://en.wikipedia.org/wiki/Web_colors

Or index into a table of arbitrarily defined colors.  You can get as  
much flexibility of colors as you care to program, and there are  
still 16 bits unused in the tag.


Will this provide a fully scalable solution for arbitrary  
properties?  No.  But it doesn't need to be.  Some things will never  
need to scalable.  When the simpler solution no longer suffices,  
that's the time to create a more complex and scalable one.


I don't think anyone is really debating that the tag cannot be  
successfully used. It can. I'm just questioning whether it was good  
advice for someone who's most likely new to the task they're trying to  
accomplish. It would be unfortunate if David left this thread with the  
impression that a switch statement combined with the tag variable of  
NSControl was the defacto way to extend a view classes to contain more  
capabilities.


I think that when someone comes to a list looking for advice, we  
should give them future looking and maintainable advice. If the future  
looking advice seems over-engineered, or too complicated, alternatives  
are certainly appropriate. The OP can decide if they want the quick  
fix or the maintainable one. The most maintainable solution is not the  
tag solution, but it certainly is a workable alternative if the OP  
accepts is lack of self explanation and extensibility.


Jon Hess



 -- GG
___

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

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

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

This email sent to jh...@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: NSPopUpButtonCell Keeps on Trackin'! Demo, Movie

2009-04-26 Thread Jerry Krinock


On 2009 Apr 26, at 15:29, Jim Correia wrote:


What you've done is replaced the table column's header cell, and
started a menu tracking session while the table view was already in
the middle of a mouse tracking session.


Yes, that makes sense because I notice that clicking in the table view  
does not stop the tracking.  So I just tried sending -performClick: to  
the table view, but that didn't help.  I need something like a - 
[NSControl heyStopTracking] message.



What are you really trying to accomplish here?


This is for the header of a table view which displays my data  
objects.  My objects have about a dozen attributes that users may be  
interested in from time to time, but no one wants to see a table with  
12 columns.  So I have placed in two of the three column headers a  
popup menu which allows the user to select the attribute for that  
column.  It all works very nice now except for this glitch.



you are probably going to want to take the approach of using a custom
header view (along with custom header cells as necessary.)


I've already got the custom header cell that draws as its title the  
current popup selection, and also a couple of bezier path triangles  
that point up and down.


The only thing I'd want to customize in the header view would be to  
inhibit or terminate its mouse tracking when the menu was open.  How  
could I do that?


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Core Data Suddenly Losing Changes

2009-04-26 Thread Jerry Krinock


On 2009 Apr 26, at 16:23, Walker Argendeli wrote:

I've been working on a project that uses Core Data for a while now.   
I recently changed the model and ran it, but I noticed an odd  
behavior: I wan't informed that the model had changed and was  
incompatible.  I went ahead and deleted the old xml file and when  
running the application again, it created another file.  The only  
problem is that Core Data has stopped saving.  EVery time I open the  
application, I'm presented with a blank slate.


If you see a blank slate, that does not necessarily mean that your app  
has stopped saving.  It could have mean that it has stopped loading.


As always, use the power of two -- break the problem in half.  First  
step is to look at the xml file with a text editor.


___

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

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

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

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


Re: figuring out which TableView I am?

2009-04-26 Thread WT

On Apr 27, 2009, at 2:19 AM, Greg Guerin wrote:


Jonathan Hess wrote:

Why not have a property/instance-variable that controls this  
directly and then set that in awakeFromNib from one of the  
controller classes that has an outlet to each of the table views?


If you needed a fully scalable solution with support for arbitrary  
properties, that would be the way to go.  But the OP didn't need  
that.  All he needed was 3 color-scheme variations of an otherwise  
standard NSTableView.


And that's precisely why I suggested the tags solution in the first  
place and why I argued in its favor after Jonathan Hess argued against  
it. I never suggested nor implied that the tags solution is the way to  
go in an arbitrary situation.


There are reasons for not over-designing solutions, as I'm sure all of  
you are aware.


Wagner
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: figuring out which TableView I am?

2009-04-26 Thread Jim Correia
On Sun, Apr 26, 2009 at 8:04 PM, Graham Cox  wrote:

> This is true, but your example of non-scalability does reflect a poor
> approach that you wouldn't be likely to follow in practice.
>
> A tag is 32 bits, so can represent 2^32 different states, if used wisely.
> Dividing this into bitfields would allow you to partition it into several
> properties, for example four different colour properties, each with 256
> possible colours each.

Even when used as a bitfield, I'd still argue it is not good design. (It might
be an expedient hack to get something done, and if you are happy with that
as a solution, great.)

It overloads the tag to imply control behavior/appearance, while at the same
time preventing users of your class from using the tag for its original purpose.
(Yes, I realize that the the user of the custom table view is the same person
as the provider of the custom table view.)

- 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: figuring out which TableView I am?

2009-04-26 Thread WT

On Apr 27, 2009, at 1:31 AM, Jim Correia wrote:


On Sun, Apr 26, 2009 at 7:05 PM, WT  wrote:

More importantly, perhaps, is the fact that adding property/ivars  
is not a
scalable solution in that it requires adding more code in several  
places if
more tables are added. The tags solution only requires some  
fiddling with IB

and updating a switch statement. That sounds to me a much simpler
maintenance problem than having to update code in several places.


I guess I'm not following your logic.

I want table 1 to have a blue background, so I set its tag to 3.
I want table 2 to also have a blue background, so I set its tag to 3.

I want table 1 to have red text. Switch off tag, 3 == red text.
I want table 2 to have green text. Oops - tag 3 already means blue
background + red text.

(Substitute any 2 actual properties for my background color + text
color - they are meant for illustration purposes only.)

Overloading tags for other properties is not scalable, because you
only have one property (the tag) which you are overloading to mean N
other properties and/or behaviors.

The only scalable solution to this problem is explicity
iVars/properties for each property/behavior you want to control in
your subclass. (Yes, this means configuring things by hand after
unarchiving your nib, or writing an IB plug-in so you can specify them
in IB.)

- Jim


If you go back to my original reply to David, you'll notice that I  
suggested tags as a means of *identification*, not as a "property  
container". Thus, using your example, table 1 is an instance of his  
subclass of NSTableView having a blue background and red text. Table 2  
is another instance of his subclass of NSTableView, also having a blue  
background but having green text. Assigning to table 1 a tag of, say,  
1 and to table 2 a tag of, say, 2, then a simple switch statement  
allows David to find out which table he's dealing with at any  
particular moment and, thus, set or read any of that table's  
properties (background color, text color, and what-not).


This seems scalable enough and does not involve overloading tags to  
mean anything other an object identifier.


I hope my logic is now clear enough now.

Wagner
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Drawing Across NSTableView Columns

2009-04-26 Thread Jerry Krinock


On 2009 Apr 26, at 15:29, K. Darcy Otto wrote:

(d) I read about drawing within a custom NSTextField Cell here: http://www.cocoabuilder.com/archive/message/cocoa/2004/3/1/100423 
  I think this might still make the image break at each row.


This is the best option, and yes your line will be broken at a row  
boundary, because NSTableView has an intercell spacing.


One option is to set the table's intercellSpacing to { someX, 0.0 }  
but that might have other undesired side effects.


You could also subclass your NSTableView and in your subclass override  
(and don't forget to invoke super) in -drawRect:.  In that method,  
after invoking super, you could draw complete lines from the first row  
all the way down to the bottom and then none will be broken.


In any case, use NSBezierPath to draw the lines.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Dividing NSView to subviews

2009-04-26 Thread Naresh Kongara

Hi,

To get the image, I added the below method (what peter has given)  in  
NSView's category




- (NSImage *)imageFromRect:(NSRect) sourceRect
{
NSSize imgSize = sourceRect.size;

	NSBitmapImageRep *bir = [self  
bitmapImageRepForCachingDisplayInRect:sourceRect];

[bir setSize:imgSize];
[self cacheDisplayInRect:sourceRect toBitmapImageRep:bir];

NSImage* image = [[[NSImage alloc] initWithSize:imgSize] autorelease];
[image addRepresentation:bir];
return image;
}


in the view drawing code i didn't changed any thing.
After preparing the view from which i need to get the images, i just  
replaced the line


	NSImage *img = [[[NSImage alloc] initWithData:[view  
dataWithPDFInsideRect:sourceRect]] autorelease];


with

NSImage *img = [view imageFromRect:sourceRect];



The view drawing is same for both the cases,
but -(NSImage *)imageFromRect:(NSRect) is giving me a some what  
blurred image...



Thanks,
NareshK





On Apr 25, 2009, at 5:52 AM, Michael Ash wrote:


On Fri, Apr 24, 2009 at 8:02 AM, Naresh Kongara
 wrote:

Thanks peter for your reply,

Now there is some improvement in the performance , but the image is  
not that

much clear as the image we are getting with dataWithPDFInsideRect:

is there any way to remove that blur.


The technique that Peter showed will produce *exactly* the same pixels
that get rendered to the screen. If you have blur, it's either because
your view is blurry itself, or your drawing code is blurry. Either
way, we can't tell you what's going wrong unless you post your code.

Mike
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/naresh.kongara%40prithvisolutions.com

This email sent to naresh.kong...@prithvisolutions.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: figuring out which TableView I am?

2009-04-26 Thread Michael Ash
On Sun, Apr 26, 2009 at 8:04 PM, Graham Cox  wrote:
>
> On 27/04/2009, at 9:31 AM, Jim Correia wrote:
>
>> I want table 1 to have a blue background, so I set its tag to 3.
>> I want table 2 to also have a blue background, so I set its tag to 3.
>>
>> I want table 1 to have red text. Switch off tag, 3 == red text.
>> I want table 2 to have green text. Oops - tag 3 already means blue
>> background + red text.
>>
>> (Substitute any 2 actual properties for my background color + text
>> color - they are meant for illustration purposes only.)
>
>> Overloading tags for other properties is not scalable, because you
>> only have one property (the tag) which you are overloading to mean N
>> other properties and/or behaviors.
>
>
> This is true, but your example of non-scalability does reflect a poor
> approach that you wouldn't be likely to follow in practice.
>
> A tag is 32 bits, so can represent 2^32 different states, if used wisely.
> Dividing this into bitfields would allow you to partition it into several
> properties, for example four different colour properties, each with 256
> possible colours each.
>
> As long as you can specify your needs and know they won't need future
> scaling, you can get more out of a tag that just assigning 1, 2, 3 etc might
> suggest. The bitfield approach does have the downside of needing a bit of
> off-side calculation to arrive at the appropriate 'number' and this can be
> somewhat arcane. And yes, they are much less scalable than ivars. But it's
> definitely an approach that can be used if your needs are relatively simple.

The correct approach here is to define a property, or a set of
properties, on your table view subclass to control its appearance,
then set up those properties in your controller in awakeFromNib.

It is entirely baffling to me that people are so reluctant to follow
this approach.

The tag approach offers only one advantage: the ability to set the
value in IB. And this is an extremely limited advantage when the
information available in IB is "3". Give me descriptive code over a
"3" any day of the week.

Meanwhile it offers enormous disadvantages, including but not limited
to extremely opaque code, lack of extensibility, and just general code
smell.

Define properties for your visual differences, set them up in your
controller, and be happy.

Mike
___

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

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

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

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


NSDateFormatter bug in timeZone

2009-04-26 Thread Jon

 it appears there is a bug in Apple's date formatter:

NSDateFormatter *inputFormatter = [[NSDateFormatter 
alloc] init];
[inputFormatter setDateFormat:@"MMM-dd-yy HH:mm:ss 
zzz"];
			NSDate *theDate = [inputFormatter dateFromString:@"Apr-04-09  
10:30:03 PDT"];


this gives the wrong timezone in "theDate"??? (unless of course you  
happen to be in the PDT timezone)it looks like it ignores the  
format, and just puts in current time zone. it should be   -0700   
at the end of the "theDate" if you look at it in a debugger,  but it  
is wrong for anyone that is not in the PDT...



NSDateFormatter *inputFormatter = [[NSDateFormatter 
alloc] init];
[inputFormatter 
setFormatterBehavior:NSDateFormatterBehavior10_4];
			[inputFormatter setLocale:[[NSLocale alloc]  
initWithLocaleIdentifier:@"en_US"]];
			[inputFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT: 
0]];

[inputFormatter setDateFormat:@"MMM-dd-yy HH:mm:ss 
zzz"];

			NSDate *theDate = [inputFormatter dateFromString:@"Apr-04-09  
10:30:03 PDT"];


this gives me a NIL in "theDate"  because timeZoneForSecondsFromGMT   
is some how not working,  or i have it wrong.


also using the natural language formater properly gives me the correct  
time Zone,  but as soon as you store it in a Data Source,  it comes  
back out with the current time zone, and the time adjusted so that it  
is correct time at least...   but this shouldn't happen?  should it.


Jon.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Dividing NSView to subviews

2009-04-26 Thread Peter N Lewis

On 27/04/2009, at 12:16 , Naresh Kongara wrote:

in the view drawing code i didn't changed any thing.
After preparing the view from which i need to get the images, i just  
replaced the line


	NSImage *img = [[[NSImage alloc] initWithData:[view  
dataWithPDFInsideRect:sourceRect]] autorelease];


with

NSImage *img = [view imageFromRect:sourceRect];



The view drawing is same for both the cases,
but -(NSImage *)imageFromRect:(NSRect) is giving me a some what  
blurred image...



My guess (and its only a guess because you haven't posted the drawing  
code) is that the image is being drawn at a different size to the  
original, and hence scaling.


cacheDisplayInRect will return a bit map image which will be blurry if  
scaled.


dataWithPDFInsideRect will (potentially at least) return a PDF image  
which will scale better.


Check your drawing code and ensure it is drawing the image at exactly  
the same size as the original view bounds.


You can also try writing both images to a pdf and tiff and seeing the  
differences.


Enjoy,
   Peter.

--
 Run macros from your iPhone with Keyboard Maestro Control!
 or take a break with Derzle for your iPhone

Keyboard Maestro  Macros for your Mac
Aragom Space War  Don't get  
killed!

Derzle  Enjoy a relaxing puzzle.
   




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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