Re: NSAppleScript - compileAndReturnError always breaks with EXC_BAD_ACCESS

2008-07-16 Thread Alex Wied
I've found the setting which causes the error below and thought I post  
the result in case somebody else runs into the same error.


In menu "Run" disable setting "Enable Guard Malloc" and the scripts  
runs fine without any exceptions.


-Alex

On Jul 6, 2008, at 12:44 AM, Alex Wied wrote:


Greetings,

I have a trivial AppleScript that I would like to compile and run  
under Objective-C. When I try to compile or execute it via  
compileAndReturnError or executeAndReturnError I'm permanetly  
receiving a EXC_BAD_ACCESS.


Here's my code:

=== CODE START ===
- (IBAction) simpleScript:(id)sender
{
	NSAppleScript* theScript = [[NSAppleScript alloc] initWithSource:  
@"beep 3"];

if (theScript != NULL)
{
NSDictionary* errDict = NULL;
// execution of the following line ends with EXC
if (YES == [theScript compileAndReturnError: &errDict])
{
NSLog(@"compiled the script");
[theScript executeAndReturnError: &errDict];
}
[theScript release];
}
}
=== CODE END ===

I did some research and found similar reports that suggested that  
this might be a threading or garbage collection issue. I'm calling  
the code in the main thread (i.e. no threading) and also disabled  
auto garbage collection - without success.


I also tried a variety of other NSAppleScript sample. Whatever I  
try, my debugger always ends up with a EXC_BAD_ACCESS.


The precise error message in the status bar of the debugger is:

GDB: Program received signal: "EXC_BAD_ACCESS".

I'm running XCode 3.1 under Leopard 10.5.4.

Any thoughts what's going wrong here? Is this a known problem?

Any help is greatly appreciated!

Thanks
-Alex


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Keypaths

2008-07-16 Thread Niklas Saers

Hi Scott & Kyle:

On Jul 16, 2008, at 2:22 AM, Scott Anguish wrote:

In fact, as long as you have modeled relationships from parent to
child you can do it, Core Data or not.  Get a reference to Balbo and
Ponto and then use a keypath involving @distinctUnionOfArrays to get
to it.  A bit of set theory is helpful here.
The Key-Value Coding Programming Guide has more info on this,  
including a sample data relationship and what the various operators  
will return when used.


http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html#/ 
/apple_ref/doc/uid/20002176


I've been reading the document you refer to before posting, and  
Hillegass' chapter on the subject, but I'm getting lost in the syntax.  
What would be the correct way of getting the array of nodes, and the  
array of names?


NSArray *nodes = [balbo  
valueForKeyPath:@"@distinctUnionOfArrays.subnodes[name='Ponto  
Baggins'].subnodes"] ??
NSArray *names = [balbo  
valueForKeyPath:@"@distinctUnionOfArrays.subnodes[name='Ponto  
Baggins'].subnodes.name"] ??


Really, it bit that confuses me is "where @property NSString *name is  
'Ponto Baggins'", how do I express that in a keypath?


Cheers

Nik
___

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

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

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

This email sent to [EMAIL PROTECTED]


Converting Windows RC to NIBs (was Re: Creating and App menu from Scratch)

2008-07-16 Thread Uli Kusterer

On 14.07.2008, at 14:53, Bill Royds wrote:
Are there any good tools for porting Application menus and forms  
from other windowing systems (such as MS Windows or X or even  
Carbon) to Cocoa nibs? I have a number of applications that I would  
like to port, but redesigning  the form or menu layout completely  
seems to be rather pointless. I am quite willing to rewrite all the  
code that interacts with the forms or menus, but I am not a graphic  
designer so form layout is better left to experts who have already  
done it.
All I really want is a tool that will put objects without any  
connections or code on a form or menu by parsing a MS .RC file, for  
example


Being able to do this would lead to an large increase in the number  
of Macintosh applications available.



 I'm not aware of an existing tool, though I've said in other similar  
threads (some on Carbon-Dev) that it should be possible to write code  
that does this, as long as the source format is known. Xcode 3 has the  
XML-based XIB format. You could create a few simple test files, see  
what XML it generates for the various objects, see how the sizes of  
these objects differ from their Windows counterparts*, and then write  
code that reads the RC files and outputs the text needed for an XIB.


 (Ignore the huge blob of binary data at the bottom of the XIB,  
that's just a binary, runnable version of the stuff above it)


*) Note that that is actually the hard part -- control sizes may  
differ so substantially, that it may be impossible to do a 1-on-1  
translation of your UI automatically without making it look horrible.  
You may need a graphics designer with a good eye for layout to  
determine how these rects correspond. IMHO, most times you'll have to  
manually fix up things anyway, so you might as well go and recreate  
the UI and let IB's snap-to-guidelines do the job of initial layout.


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





___

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

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

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

This email sent to [EMAIL PROTECTED]


Move window to second display

2008-07-16 Thread Fabian
Hi,

I only have one monitor, so I'm having a bit of a problem figuring this out.

I have a (borderless) window that should be displayed on any display
chosen by the user. I figured the code below would do the trick, but
apparently it's a no go (I use setFrameFromString: when the app is
launched; this is when settings are changed during runtime):

NSRect screenRect = [[NSScreen mainScreen] frame];
NSArray *screens = [NSScreen screens];
int preferredDisplay =  [[[NSUserDefaults  standardUserDefaults]
objectForKey:@"PreferredDisplayID"] intValue];

for (id screen in screens ) {
CGDirectDisplayID display = (CGDirectDisplayID) [[[screen
deviceDescription] valueForKey:@"NSScreenNumber"] unsignedIntValue];
if ( preferredDisplay == display ) {
screenRect = [screen frame];
break;
}
}

[win setFrame:screenRect display:YES];


Please advice.

Thanks
F.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Move window to second display

2008-07-16 Thread Jean-Daniel Dupas


Le 16 juil. 08 à 13:01, Fabian a écrit :


Hi,

I only have one monitor, so I'm having a bit of a problem figuring  
this out.


I have a (borderless) window that should be displayed on any display
chosen by the user. I figured the code below would do the trick, but
apparently it's a no go (I use setFrameFromString: when the app is
launched; this is when settings are changed during runtime):

NSRect screenRect = [[NSScreen mainScreen] frame];
NSArray *screens = [NSScreen screens];
int preferredDisplay =  [[[NSUserDefaults  standardUserDefaults]
objectForKey:@"PreferredDisplayID"] intValue];

for (id screen in screens ) {
CGDirectDisplayID display = (CGDirectDisplayID) [[[screen
deviceDescription] valueForKey:@"NSScreenNumber"] unsignedIntValue];
if ( preferredDisplay == display ) {
screenRect = [screen frame];
break;
}
}

[win setFrame:screenRect display:YES];


Please advice.

Thanks
F.


The screen frame origin represent the screen position relative to the  
whole space. (a point relative to the main screen origin (the one with  
the menu bar)).


The window frame origin is a position relative to the screen origin.

Try this:

screenRect.origin = NSZeroPoint;
[win setFrame:screenRect display:YES];


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Move window to second display

2008-07-16 Thread Fabian
Thanks Jean-Daniel, I will try that.

F.

On Wed, Jul 16, 2008 at 1:21 PM, Jean-Daniel Dupas
<[EMAIL PROTECTED]> wrote:
>
> Le 16 juil. 08 à 13:01, Fabian a écrit :
>
>> Hi,
>>
>> I only have one monitor, so I'm having a bit of a problem figuring this
>> out.
>>
>> I have a (borderless) window that should be displayed on any display
>> chosen by the user. I figured the code below would do the trick, but
>> apparently it's a no go (I use setFrameFromString: when the app is
>> launched; this is when settings are changed during runtime):
>>
>> NSRect screenRect = [[NSScreen mainScreen] frame];
>> NSArray *screens = [NSScreen screens];
>> int preferredDisplay =  [[[NSUserDefaults  standardUserDefaults]
>> objectForKey:@"PreferredDisplayID"] intValue];
>>
>> for (id screen in screens ) {
>>CGDirectDisplayID display = (CGDirectDisplayID) [[[screen
>> deviceDescription] valueForKey:@"NSScreenNumber"] unsignedIntValue];
>>if ( preferredDisplay == display ) {
>>screenRect = [screen frame];
>>break;
>>}
>> }
>>
>> [win setFrame:screenRect display:YES];
>>
>>
>> Please advice.
>>
>> Thanks
>> F.
>
> The screen frame origin represent the screen position relative to the whole
> space. (a point relative to the main screen origin (the one with the menu
> bar)).
>
> The window frame origin is a position relative to the screen origin.
>
> Try this:
>
> screenRect.origin = NSZeroPoint;
> [win setFrame:screenRect display:YES];
>
>
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


how to measure an attributedString or string with attributes

2008-07-16 Thread norio
I think QuickTime API had an api for measuring the width and the  
height of an attributed string.
If width was passed as an argument, the height was returned. And if  
height, returned its width.


Is there any ways to get such information?

Thanks,
Norio Ota
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Duplicate rows appearing in outlineview after creating new Entity in moc, why?

2008-07-16 Thread Jonathan Dann
The duplicate problem is likely fixed by giving the tee controller a  
fetch predicate in IB. Set the predicate to something like  
parent==nil. This will obviously depend on what you've called your  
'parent' property.


I've blogged about doing this with drag and drop in core data and non- 
core data apps.


http://espresso-served-here.com

HTH

Jon

On 15 Jul 2008, at 22:59, "Sean McBride" <[EMAIL PROTECTED]>  
wrote:



Hi all,

I have an outlineview populated by binding to a treecontroller.  It
displays CoreData entities of type "Person".  "Person" has 'parent'  
and

'children' relationships.  Displaying everything works fine.

Now the outlineview must support drops.  In my windowcontroller, I
implement outlineView:acceptDrop:item:childIndex: and look for my  
custom

pasteboard type.  If it's there, I need to create a new "Person"
entity.  How should I do this?

I have tried:
a) [myTreeController add:nil];

b) Person* person = [myTreeController newObject];
   [person setParent:...];

c) Person* person = [NSEntityDescription
 insertNewObjectForEntityForName:@"Person"
 inManagedObjectContext:moc];
   [person setParent:...];

In all cases, the outlineview shows 2 of the new person.  The  
problem is

not on the model side, since if I close and reopen the window, only 1
new person is there.

Thanks,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how to measure an attributedString or string with attributes

2008-07-16 Thread Phil
On Thu, Jul 17, 2008 at 12:18 AM, norio <[EMAIL PROTECTED]> wrote:
> I think QuickTime API had an api for measuring the width and the height of
> an attributed string.
> If width was passed as an argument, the height was returned. And if height,
> returned its width.
>
> Is there any ways to get such information?
>

For an NSString with attributes dictionary, AppKit has a category with
some methods that sound like what you want:


For an NSAttributedString there are a couple of methods in its AppKit
category too:


(Namely, -size and -boundingRectWithSize:options:)

Phil
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Hillegass, Third Edition, Chapter 18

2008-07-16 Thread Jon Buys
Thanks for your help everyone!  I wound up taking a look at someone else's
code that is working, and basing my code off their example.  (Thanks Aron!)
I don't have it working just yet, but I've got a little more reading to do
on NSMutableArray.  My app is not adding the NSBezierPath object to my array
for some reason, but now that I've got a solid direction to go
troubleshooting is much easier.

Again, thanks for your help.  It's good to know there is such an active
community around Cocoa development.

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


Relaunch Finder (without AppleScript)

2008-07-16 Thread Piero Avola

Hello,
I need to relaunch the Finder with my App. I don't want to use any  
scripts therefore. How can I do this with the Cocoa framework?


AV
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CALayer with checkered background like Photoshop's

2008-07-16 Thread Richard Henry
Thanks Jens and Randall for your solutions I've got it working nicely  
now.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Relaunch Finder (without AppleScript)

2008-07-16 Thread Dave DeLong
You could use an NSTask to run "killall Finder"

On Wed, Jul 16, 2008 at 7:57 AM, Piero Avola <[EMAIL PROTECTED]> wrote:
> Hello,
> I need to relaunch the Finder with my App. I don't want to use any scripts
> therefore. How can I do this with the Cocoa framework?
>
> AV
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Relaunch Finder (without AppleScript)

2008-07-16 Thread Shawn Erickson
On Wed, Jul 16, 2008 at 6:57 AM, Piero Avola <[EMAIL PROTECTED]> wrote:
> Hello,
> I need to relaunch the Finder with my App. I don't want to use any scripts
> therefore. How can I do this with the Cocoa framework?

NSWorkspace

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Relaunch Finder (without AppleScript)

2008-07-16 Thread Michael Watson
Someone correct me if I'm wrong, but surely this is a bad way to  
invoke the termination/relaunch a GUI application.



--
m-s


On 16 Jul, 2008, at 10:01, Dave DeLong wrote:


You could use an NSTask to run "killall Finder"

On Wed, Jul 16, 2008 at 7:57 AM, Piero Avola  
<[EMAIL PROTECTED]> wrote:

Hello,
I need to relaunch the Finder with my App. I don't want to use any  
scripts

therefore. How can I do this with the Cocoa framework?

AV

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mikey-san 
%40bungie.org


This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Base64 data string decode to save to file

2008-07-16 Thread Pablo Herrera

I have data encoded as base64 within an NSData instance.

What are recommended methods to decode the data so I may save it to file?


Thanks,

Pablo C. Herrera

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Relaunch Finder (without AppleScript)

2008-07-16 Thread Shawn Erickson
On Wed, Jul 16, 2008 at 6:57 AM, Piero Avola <[EMAIL PROTECTED]> wrote:
> Hello,
> I need to relaunch the Finder with my App. I don't want to use any scripts
> therefore. How can I do this with the Cocoa framework?

You likely should use AppleScript to do this...

NSAppleScript* script = [[[NSAppleScript alloc] initWithSource:@"tell
application \"Finder\" quit"] autorelease];
[script executeAndReturnError:nil]

(typed in mail)

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Base64 data string decode to save to file

2008-07-16 Thread Shawn Erickson
On Wed, Jul 16, 2008 at 7:21 AM, Pablo Herrera <[EMAIL PROTECTED]> wrote:
>
> I have data encoded as base64 within an NSData instance.
>
> What are recommended methods to decode the data so I may save it to file?



-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Relaunch Finder (without AppleScript)

2008-07-16 Thread Uli Kusterer

On 16.07.2008, at 16:01, Dave DeLong wrote:

You could use an NSTask to run "killall Finder"



 Yeah, and in the process you'll unceremoniously abort that 4GB copy  
process the user had going that was this close to finishing, and  
corrupt Finder's preferences...


 If you're on 10.5, use the scripting bridge. If you're on 10.4.x or  
earlier, you can drop down to CoreServices and manually send the Apple  
Event. Create the event using NSAppleEventDescriptor, and then call - 
aeDesc to get an AEDesc to pass to AESend(). The quit Apple event is  
very simple, as it takes no parameters, and is of class/type  
kCoreEventClass/kAEQuitApplication.


 Check the result, though, Finder may refuse to quit if it's busy,  
like aforementioned copy process.


 To launch Finder again after that, use NSWorkspace.

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





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSAppleScript - compileAndReturnError always breaks with EXC_BAD_ACCESS

2008-07-16 Thread Jens Alfke


On 16 Jul '08, at 12:55 AM, Alex Wied wrote:

I've found the setting which causes the error below and thought I  
post the result in case somebody else runs into the same error.
In menu "Run" disable setting "Enable Guard Malloc" and the scripts  
runs fine without any exceptions.


You should file a bug report with Apple. GuardMalloc is only for  
debugging purposes, but code that crashes with it has bugs that may  
cause intermittent crashes in normal use. Software isn't tested with  
GuardMalloc too often [because it causes most programs to run  
unbearably slowly] so this may have slipped past in Apple's own testing.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Base64 data string decode to save to file

2008-07-16 Thread Jens Alfke


On 16 Jul '08, at 7:21 AM, Pablo Herrera wrote:

What are recommended methods to decode the data so I may save it to  
file?


OpenSSL has base64 conversion APIs in its libCrypto. In my code I use  
a nice Obj-C wrapper by Dave Dribin:

http://www.dribin.org/dave/files/base64.zip

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: how do I make chat bubbles using a custom cell

2008-07-16 Thread chaitanya pandit
One idea would be to create an NSBezierPath with the shape of the chat  
bubble, once u have it you can use the CTGradient calss's [gradient  
fillBezierPath] method to fill it with an aqua look.

The CTGradient project is here: 
http://blog.oofn.net/2006/01/15/gradients-in-cocoa/

On 15-Jul-08, at 11:08 PM, TARUN CHAPLOT wrote:


Hello Everyone

I am very new to objective C and working on some application which  
needs to create Chat bubbles similar to iChat.
Can anybody help me to find some documentation or the sample code  
which will help me to make chat bubbles using custom cell.


Any help would be greatly appreciated.

Thanks
Tarun




___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Base64 data string decode to save to file

2008-07-16 Thread Pablo Herrera
Thanks!
 
As I have been looking into this this morning, i found similar uses of
libCrypto--and tried using them.  However, as I recently found out, I am
unable to use these libs as Apple has decided that those libraries would not
be available in my case.  ;)  But I think I have come across some code that
might allow me to do what I want.  I'll be trying it out soon.

Pablo C. Herrera
Systems Engineer
Data Nexus, Inc.
[EMAIL PROTECTED]
(979) 696-3400


 

  _  

From: Jens Alfke [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 16, 2008 10:12 AM
To: Pablo Herrera
Cc: cocoa-dev@lists.apple.com
Subject: Re: Base64 data string decode to save to file



On 16 Jul '08, at 7:21 AM, Pablo Herrera wrote:


What are recommended methods to decode the data so I may save it to file?


OpenSSL has base64 conversion APIs in its libCrypto. In my code I use a nice
Obj-C wrapper by Dave Dribin:
http://www.dribin.org/dave/files/base64.zip

-Jens


GSNSDataExtensions.m
Description: Binary data


GSNSDataExtensions.h
Description: Binary data
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Inter-thread communications (live/deadlock?)

2008-07-16 Thread Keary Suska
7/15/08 3:45 PM, also sprach [EMAIL PROTECTED]:

> I have a problem with inter-thread communications with NSMachPort/
> NSPortMessage - it works one way after initially working both ways..

First off, post your code. We can't say what you are doing wrong if we can't
see what you have done wrong.

> The application has a main parent thread that spawns a child thread.
> The child thread runs inside an object instance.
>
> The parent passes it's NSMachPort instance through the NSThread
> detachNewSelector to the child.  The parent runs a loop and drives
> it's RunLoop.

Is the "parent" a spawned thread as well, i.e. not the "main" thread?
 
> The child once spawned creates it's own NSMachPort instance and then
> packages it up and sends it to the parent (which the parent receives
> correctly). This is the classic Apple documented 'checkin'. It then
> enters the classic while(1) { RunLoop ... } to drive the runloop.

Do you attach the mach port to the run loop? If you don't, the loop will
just exit and not process any events. This would explain the behavior you
are seeing, if it is the case.

> Assumption #1 - as the threads are both running "currentRunLoop" then
> I'm assuming that each thread has it's own RunLoop instance? I
> understand that the RunLoop is thread unsafe.

Yes, each thread will have it's own runloop object. Yes, Runloops are not
thread safe.

> The parent can issue as many messages as it likes to the child
> process. Each message gets to the child thread without a problem -
> each and every time.
> 
> Now comes the interesting bit. The child uses a single method for all it's
> send calls back to the  parent thread - even the checkin uses it - where it
> calls  [NSPortMessage sendMessage: ...]. The observed results are that the
> initial checkin message gets to the parent handlePortMessage: whereas
> subsequent calls don't show any errors but the message does not arrive  at
> handlePortMessage on the parent. They just vanish. The child and  parent
> threads continue as if nothing has happened. The parent can  still issue
> messages to the child..

You may also--if you don't already--watch for
NSPortDidBecomeInvalidNotification notifications on both threads. See
NSNotificationCenter class & related docs for more info, if you aren't
familiar.

HTH,

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Setting Core Data attribute values to related entity attribute values

2008-07-16 Thread Jamie Phelps
I have a Core Data entity in a Master-Detail view. In the detail view,  
I have a button that is bound to the createFoo: method of the selected  
object where Foo is the class name of the related entity. What I want  
to do is use this button to create a Foo and set its relationship  
programmatically.


I have found the section on creating NSManagedObjects in the Core Data  
Programming Guide and understand the NSMutableSet procedure of  
creating the new objects.


 In my awakeFromInsert: method for the Foo class, I want to set  
attribute values based on the related entity. If it's null, I have  
some defaults, but if the relationship is present, I want to set some  
values equal to the corresponding attribute in the related entity as  
defaults.


Is awakeFromInsert: the best place to do this, or should I create  
another method to set those values based on the related entity?


Thanks for the help.

Jamie
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Move window to second display

2008-07-16 Thread Scott Ribe
> The window frame origin is a position relative to the screen origin.
> 
> Try this:
> 
> screenRect.origin = NSZeroPoint;
> [win setFrame:screenRect display:YES];

No, that will just position the window on the main screen. If the window
frame origin were relative to the screen origin rather than the whole space,
then there would be no way using setFrame to move a window to a different
screen.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSButton alternate image problem - not redrawing

2008-07-16 Thread P Teeson

Mac OS X Tiger 10.4.11, Xcode 2.5, G4 867mhz
I am making a Cocoa Application kids game using NSButtons.

They are of behaviour Toggle and of type Square Button and the icon
position is centred (i.e. no title) and each button has a unique tag
and is enabled.

The icon images are in the nib file and consist of
(a) a coloured blank square and
(b) a set of coloured squares with large letters in the centre.

In the nib all buttons have the blank icon image as both image and
alternate image. Connections are made in IB from each button to the
Controller IBAction method. Likewise connections are made from
the Controller IBOutlets to the respective buttons.

When the game begins I successfully retrieve all the icon images from  
the bundle

and keep them as instance variables in my Controller.
(e.g. IBOutlet NSButton * cell0; IBOutlet NSButton *cell1; etc)

The game is played by clicking on a button and a message is sent to  
an IBAction method
in the Controller. It replaces the alternate image with one of the  
(b) icons and disables that button.

..
[sender setAlternateImage:theXiconImage];
[sender setEnabled:NO];
..
This all works exactly and desired.

There is another NSButton to trigger a New Game and it sends a  
message to an IBAction method

in the Controller that re-initialises the buttons as follows:
..
[cell0 setAlternateImage:theBlankImage]; // send messages via IBOutlet
[cell0 setEnabled:YES];
[cell1 setAlternateImage:theBlankImage];
[cell1 setEnabled:YES];
[cell2 setAlternateImage:theBlankImage];
[cell2 setEnabled:YES];
etc
..
(Of course the Model is also reinitialised)

My Problem is this
The View gets redrawn OK.
But now when clicking on a button there is no guarantee that the  
alternate images will appear.
Sometimes they do; sometimes they don't - just displaying the blank  
icon.
And yet the same action method is being called as in the first play  
of the game.


Why do you think this is not redrawing correctly after the  
reinitialisation?


TIA for your suggestions.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Move window to second display

2008-07-16 Thread Jean-Daniel Dupas


Le 16 juil. 08 à 18:15, Scott Ribe a écrit :


The window frame origin is a position relative to the screen origin.

Try this:

screenRect.origin = NSZeroPoint;
[win setFrame:screenRect display:YES];


No, that will just position the window on the main screen. If the  
window
frame origin were relative to the screen origin rather than the  
whole space,
then there would be no way using setFrame to move a window to a  
different

screen.



You're right.

I mix with the  -[NSWindow initWithContentRect:...screen:] method that  
expects a relative to screen frame.





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Move window to second display

2008-07-16 Thread Fabian
Hum, OK. Thanks to both of you. So what's wrong with the code then?

On Wed, Jul 16, 2008 at 6:36 PM, Jean-Daniel Dupas
<[EMAIL PROTECTED]> wrote:
>
> Le 16 juil. 08 à 18:15, Scott Ribe a écrit :
>
>>> The window frame origin is a position relative to the screen origin.
>>>
>>> Try this:
>>>
>>> screenRect.origin = NSZeroPoint;
>>> [win setFrame:screenRect display:YES];
>>
>> No, that will just position the window on the main screen. If the window
>> frame origin were relative to the screen origin rather than the whole
>> space,
>> then there would be no way using setFrame to move a window to a different
>> screen.
>>
>
> You're right.
>
> I mix with the  -[NSWindow initWithContentRect:...screen:] method that
> expects a relative to screen frame.
>
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/slasktrattenator%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSUserDefaultsController, when does value change?

2008-07-16 Thread Matt Neuburg
On Mon, 14 Jul 2008 19:36:29 -0700, "James W. Walker" <[EMAIL PROTECTED]>
said:
>
>On Jul 14, 2008, at 9:34 AM, Matt Neuburg wrote:
>
>> On Sun, 13 Jul 2008 21:29:56 -0700, "James W. Walker" <[EMAIL PROTECTED]
>> >
>> said:
>>> I have a preferences dialog that I'm using with an
>>> NSUserDefaultsController instance, my first use of bindings, and it
>>> works.  But I want to post a notification when a certain setting
>>> changes.  In my method that shows the dialog, I record the old value
>>> of the setting.  In my action method for the OK button, I send a save
>>> message to the defaults controller  (the "applies immediately" option
>>> is off), send a synchronize message to the NSUserDefaults, then check
>>> the value of the setting and compare it to the old value.  But the
>>> value has not changed!  It obviously gets changed at some point,
>>> because the next time I bring up the dialog, the new value has is
>>> there.  What am I missing?
>>
>> What you're doing is unnecessarily complicated. Just use KVO to
>> observe the
>> desired value within the standardUserDefaults. You get a notification
>> contining the old value and the new value. Welcome to the world of
>> bindings.
>
>
>I think I considered KVO, but I looked in the NSUserDefaults
>reference, and didn't see any indication that it conforms to
>NSKeyValueObserving.

Nevertheless, what I suggested does work. Let me know if you need me to send
you a working code example.

>I still wish I understood why the default hadn't changed after the
>save and synchronize

Let's not go there. The "synchronize" was unnecessary and in any case you
didn't show any code so it's impossible to say what the problem was. In
future, if you do want help, show code. m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

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

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

This email sent to [EMAIL PROTECTED]


Need to enable automatic login

2008-07-16 Thread Eric Christiansen
I need to set automatic login to a particular user. If I know his  
password it needs it to happen without user interaction.


I saw a perl script on the web, but would prefer a more standard  
approach.


Thanks,
Eric


There are two ways of constructing a software design: one way is to  
make it so simple that there are obviously no deficiencies; the other  
is to make it so complicated that there are no obvious deficiencies.


-- C. A. R. Hoare



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Move window to second display

2008-07-16 Thread Scott Ribe
> So what's wrong with the code then?

I got nothing ;-( It actually looks correct to me.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSUserDefaultsController, when does value change?

2008-07-16 Thread chaitanya pandit


Try registering for the NSUserDefaultsDidChangeNotification

On 16-Jul-08, at 12:48 PM, Matt Neuburg wrote:

On Mon, 14 Jul 2008 19:36:29 -0700, "James W. Walker" <[EMAIL PROTECTED] 
>

said:


On Jul 14, 2008, at 9:34 AM, Matt Neuburg wrote:


On Sun, 13 Jul 2008 21:29:56 -0700, "James W. Walker" <[EMAIL PROTECTED]



said:

I have a preferences dialog that I'm using with an
NSUserDefaultsController instance, my first use of bindings, and it
works.  But I want to post a notification when a certain setting
changes.  In my method that shows the dialog, I record the old  
value
of the setting.  In my action method for the OK button, I send a  
save
message to the defaults controller  (the "applies immediately"  
option
is off), send a synchronize message to the NSUserDefaults, then  
check

the value of the setting and compare it to the old value.  But the
value has not changed!  It obviously gets changed at some point,
because the next time I bring up the dialog, the new value has is
there.  What am I missing?


What you're doing is unnecessarily complicated. Just use KVO to
observe the
desired value within the standardUserDefaults. You get a  
notification

contining the old value and the new value. Welcome to the world of
bindings.



I think I considered KVO, but I looked in the NSUserDefaults
reference, and didn't see any indication that it conforms to
NSKeyValueObserving.


Nevertheless, what I suggested does work. Let me know if you need me  
to send

you a working code example.


I still wish I understood why the default hadn't changed after the
save and synchronize


Let's not go there. The "synchronize" was unnecessary and in any  
case you
didn't show any code so it's impossible to say what the problem was.  
In

future, if you do want help, show code. m.

--
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [[NSDate alloc] initWithString] crashes with valid string

2008-07-16 Thread Matt Neuburg
On Tue, 15 Jul 2008 11:36:46 -0700, Markus Spoettl
<[EMAIL PROTECTED]> said:
>Hi List,
>
>   I've a problem I am failing to track down (let alone understand)
>for a couple of weeks now. My application imports XML files that
>contain - amongst other things - dates. Once in a while, the string to
>date conversion causes a crash (EXC_BAD_ACCESS):
>
>#0 0x90b1da14 in ures_getIntVector
>#1 0x90b20eb0 in icu::Calendar::setWeekCountData
>#2 0x90b1f463 in icu::GregorianCalendar::GregorianCalendar
>#3 0x90b1ee16 in icu::Calendar::createInstance
>#4 0x90b1c73e in ucal_open
>#5 0x940a097b in __CFCalendarCreateUCalendar
>#6 0x940a0a22 in __CFCalendarSetupCal
>#7 0x940a15d7 in _CFCalendarComposeAbsoluteTimeV
>#8 0x95428cbc in -[NSCFCalendar dateFromComponents:]
>#9 0x9542879b in -[NSDate(NSDate) initWithString:]
>
>This specific crash happened with the string: "2008-05-09 19:47:47
>+", which seems perfectly valid input for NSDate -initWithString:.

This is not really relevant, but I just wanted to mention that I have found
string-to-date conversion extraordinarily touchy. In 2003 I filed a bug
pointing out that given a string @"Thu, 3 Jul 2003 09:45:01 -0600 " (notice
the space after the 0600), NSDate dateWithNaturalLanguageString would crash
with an "internal error". Maybe there are stray spaces or nulls or some
other invisibles affecting your situation here. m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: NSButton alternate image problem - not redrawing

2008-07-16 Thread Gary L. Wade
If I'm reading you right (the action of a button click causes that same button 
to get a new alternate image), I would say that you should set the alternate 
image before the user clicks on the button.  Once a button is toggled, the 
current alternate image (or image, depending on state) is drawn.

>Mac OS X Tiger 10.4.11, Xcode 2.5, G4 867mhz
>I am making a Cocoa Application kids game using NSButtons.
>
>They are of behaviour Toggle and of type Square Button and the icon
>position is centred (i.e. no title) and each button has a unique tag
>and is enabled.
>
>The icon images are in the nib file and consist of
>(a) a coloured blank square and
>(b) a set of coloured squares with large letters in the centre.
>
>In the nib all buttons have the blank icon image as both image and
>alternate image. Connections are made in IB from each button to the
>Controller IBAction method. Likewise connections are made from
>the Controller IBOutlets to the respective buttons.
>
>When the game begins I successfully retrieve all the icon images from  
>the bundle
>and keep them as instance variables in my Controller.
>(e.g. IBOutlet NSButton * cell0; IBOutlet NSButton *cell1; etc)
>
>The game is played by clicking on a button and a message is sent to  
>an IBAction method
>in the Controller. It replaces the alternate image with one of the  
>(b) icons and disables that button.
>..
>[sender setAlternateImage:theXiconImage];
>[sender setEnabled:NO];
>..
>This all works exactly and desired.
>
>There is another NSButton to trigger a New Game and it sends a  
>message to an IBAction method
>in the Controller that re-initialises the buttons as follows:
>..
>[cell0 setAlternateImage:theBlankImage]; // send messages via IBOutlet
>[cell0 setEnabled:YES];
>[cell1 setAlternateImage:theBlankImage];
>[cell1 setEnabled:YES];
>[cell2 setAlternateImage:theBlankImage];
>[cell2 setEnabled:YES];
>etc
>..
>(Of course the Model is also reinitialised)
>
>   My Problem is this
>The View gets redrawn OK.
>But now when clicking on a button there is no guarantee that the  
>alternate images will appear.
>Sometimes they do; sometimes they don't - just displaying the blank  
>icon.
>And yet the same action method is being called as in the first play  
>of the game.
>
>Why do you think this is not redrawing correctly after the  
>reinitialisation?
>
>TIA for your suggestions.
>
>
>___
>
>Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
>Please do not post admin requests or moderator comments to the list.
>Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>Help/Unsubscribe/Update your Subscription:
>http://lists.apple.com/mailman/options/cocoa-dev/garywade%40desisoftsystems.com
>
>
>This email sent to [EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Handling key equivalents in a controller class?

2008-07-16 Thread Jens Alfke
I've run into this problem a few times now: I have an  
NSWindowController subclass that manages a window. I want to handle  
certain hot-keys in this window, for example Esc to exit full-screen  
mode, or maybe use letter keys to switch tools as in Photoshop. Where  
do I put the handler for this?


When this happened in the past I added a -performKeyEquivalent: method  
to a custom view in the window. However, this only makes sense  
architecturally if the action is related to that view; and if the view  
is a standard class (like NSTableView) then I have to subclass it just  
to add that one method. (AppKit doesn't send -performKeyEquivalent up  
the responder chain to the window's delegate, only to the views in the  
window.) This seems contrary to Cocoa's usual philosophy of delegation.


Am I missing something?

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

UITextView for the iphone that will auto-detect URLs

2008-07-16 Thread Andrew Arrow
I need a UITextView for the iphone that will auto-detect URLs and make
them blue and clickable (clicks that will open the page in safari).
The UIWebView seems to only open the links within the same view.  I
need the same functionality the iphone mail program has.  Any email
message it displays has blue links that will open in safari when
clicked.  Does this view exist somewhere?

I'm thinking about writing it myself if it doesn't as a custom view.
I'll open source it if anyone else would be interested.  Thanks.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: UITextView for the iphone that will auto-detect URLs

2008-07-16 Thread Sherm Pendley
On Wed, Jul 16, 2008 at 1:43 PM, Andrew Arrow <[EMAIL PROTECTED]> wrote:
> I need a UITextView for the iphone

Xcode 3.1 is public now, but only for Mac OS X development - the NDA
on the iPhone SDK still applies.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Move window to second display

2008-07-16 Thread Gary L. Wade
Try breaking out the call path to examine each succeeding value when assigning 
a value to display.  One thing that jumps out at me:  are you running this in 
64-bit mode?  The size of an int in 64-bit mode is 32 bits but a 
CGDirectDisplayID may have 64 significant bits as it's technically a pointer.  
I'm not sure how many bits are significant in a CGDirectDisplayID when run in 
64-bit mode; at least, if I were Apple, I'd just leave 32 bits significant for 
cases like this, but I'd still check that.

>Hi,
>
>I only have one monitor, so I'm having a bit of a problem figuring this out.
>
>I have a (borderless) window that should be displayed on any display
>chosen by the user. I figured the code below would do the trick, but
>apparently it's a no go (I use setFrameFromString: when the app is
>launched; this is when settings are changed during runtime):
>
>NSRect screenRect = [[NSScreen mainScreen] frame];
>NSArray *screens = [NSScreen screens];
>int preferredDisplay =  [[[NSUserDefaults  standardUserDefaults]
>objectForKey:@"PreferredDisplayID"] intValue];
>
>for (id screen in screens ) {
>   CGDirectDisplayID display = (CGDirectDisplayID) [[[screen
>deviceDescription] valueForKey:@"NSScreenNumber"] unsignedIntValue];
>   if ( preferredDisplay == display ) {
>   screenRect = [screen frame];
>   break;
>   }
>}
>
>[win setFrame:screenRect display:YES];
>
>
>Please advice.
>
>Thanks
>F.
>___
>
>Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
>Please do not post admin requests or moderator comments to the list.
>Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>Help/Unsubscribe/Update your Subscription:
>http://lists.apple.com/mailman/options/cocoa-dev/garywade%40desisoftsystems.com
>
>
>This email sent to [EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Handling key equivalents in a controller class?

2008-07-16 Thread Jeff Johnson

On Jul 16, 2008, at 12:05 PM, Jens Alfke wrote:

I've run into this problem a few times now: I have an  
NSWindowController subclass that manages a window. I want to handle  
certain hot-keys in this window, for example Esc to exit full- 
screen mode, or maybe use letter keys to switch tools as in  
Photoshop. Where do I put the handler for this?


When this happened in the past I added a -performKeyEquivalent:  
method to a custom view in the window. However, this only makes  
sense architecturally if the action is related to that view; and if  
the view is a standard class (like NSTableView) then I have to  
subclass it just to add that one method. (AppKit doesn't send - 
performKeyEquivalent up the responder chain to the window's  
delegate, only to the views in the window.) This seems contrary to  
Cocoa's usual philosophy of delegation.


Am I missing something?

—Jens___



Jens,

NSWindow is an NSResponder, so you could create an NSWindow subclass  
and override performKeyEquivalent: or keyDown: there. Your window  
subclass can then ask its controller or delegate to handle it, if you  
like.


NSWindow does pass keyDown: to its NSWindowController if it doesn't  
handle the key itself.


-Jeff

___

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

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

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

This email sent to [EMAIL PROTECTED]


Memory Allocation

2008-07-16 Thread Alexandre Badez
Hy,

I'm an early beginner in Objectiv-C and Cocoa, and for learning I'm
actualy reading "Cocoa Programming for Mac OS X" (Third Edition).

In chapter 5, I've made the challenge (a dialog box that count the
lenght of the text field and display the result).

For curiosity purpose, I launched my app with the "object allocations"
tool (Run -> Start with Performance tools -> Object Allocations). When
my app is running, I press many time on the button for counting the
lengh of the string. And here, in the allocation tool, I can see that
the overall process is increasing in memory (I think).
So I must have omit some "release" method I suppose; but I can't see where.

Here is my source code:

# AppController.h #
#import 


@interface AppController : NSObject {
IBOutlet NSTextField *inTextField;
IBOutlet NSTextField *outTextField;
}

-(IBAction) countChar: (id)sender;
-(void) setOutString: (NSString*)outString;

@end

# AppController.m ##
#import "AppController.h"


@implementation AppController

-(id)init
{
if (![super init])
return nil;

NSLog(@"init %@", [self className]);

return self;
}

-(IBAction)countChar:(id)sender
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString *userString;

NSLog(@"Counting char");

userString = [inTextField stringValue];

[self setOutString:
 [NSString stringWithFormat: @"'%@' lenght: %d",
  userString,
  [userString length]]];

[pool drain];
}

-(void) setOutString: (NSString *) outString
{
NSLog(@"Set textfiled with: '%@'", outString);
[outTextField setStringValue: outString];
}

@end
## END ###

If you need, I can send you the project

Thanks.

-- 
Alex
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: UITextView for the iphone that will auto-detect URLs

2008-07-16 Thread Mike Abdullah
Well I know nothing of this phone of which you speak, but with a  
WebView object, I would use one of its many delegate methods to  
intercept the NSURLRequest from the user clicking a link and instead  
redirect it to open in the user's browser.


Mike.

On 16 Jul 2008, at 18:43, Andrew Arrow wrote:


I need a UITextView for the iphone that will auto-detect URLs and make
them blue and clickable (clicks that will open the page in safari).
The UIWebView seems to only open the links within the same view.  I
need the same functionality the iphone mail program has.  Any email
message it displays has blue links that will open in safari when
clicked.  Does this view exist somewhere?

I'm thinking about writing it myself if it doesn't as a custom view.
I'll open source it if anyone else would be interested.  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/cocoadev%40mikeabdullah.net

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


CALayer glitch: move one sublayer, add/remove another

2008-07-16 Thread Dave Hayden
Just wanted to see if this is expected behavior, and if there's a  
workaround. When I add or remove one sublayer and change another's  
position in the same transaction, the moved layer leaves a "ghost"  
image that fades away at the start position. If I wrap the two actions  
in CATransaction begin/commit, it works as expected (no ghost image)  
if I do the position change first, then the add/remove. If I do the  
add/remove first, I get the ghost image.


I've tried delaying all my addSublayer/removeFromSuperlayer calls in  
my app until after the position changes, but no luck--there's a lot  
more stuff going on there, I'm sure. If I disable actions in the add/ 
remove transaction, it doesn't ghost the position changes. (But I do  
want the add/remove animation..)


Any idears before I send this to radar?

-Dave
Panic, Inc.


@interface TestView : NSView
{
CALayer* layerOne;
CALayer* layerTwo;
}

@end

@implementation TestView

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

layerOne = [[CALayer layer] retain];
layerOne.backgroundColor = CGColorCreateGenericRGB(1.0, 0.0, 0.0, 1.0);
layerOne.bounds = CGRectMake(0, 0, 100, 100);
layerOne.position = CGPointMake(200, 200);
[[self layer] addSublayer:layerOne];

layerTwo = [[CALayer layer] retain];
layerTwo.backgroundColor = CGColorCreateGenericRGB(0.0, 0.0, 1.0, 1.0);
layerTwo.bounds = CGRectMake(0, 0, 100, 100);
layerTwo.position = CGPointMake(300, 200);
[[self layer] addSublayer:layerTwo];
}

- (void)mouseDown:(NSEvent*)event
{
[CATransaction begin];
	[CATransaction setValue:[NSNumber numberWithInt:2]  
forKey:kCATransactionAnimationDuration];


if ( [layerTwo superlayer] != nil )
[layerTwo removeFromSuperlayer];
else
[[self layer] addSublayer:layerTwo];

[CATransaction commit];

[CATransaction begin];
	[CATransaction setValue:[NSNumber numberWithInt:2]  
forKey:kCATransactionAnimationDuration];


	layerOne.position = CGPointMake(rand() % (int)NSWidth([self frame]),  
rand() % (int)NSHeight([self frame]));


[CATransaction commit];
}

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


Re: Memory Allocation

2008-07-16 Thread Kyle Sluder
On Wed, Jul 16, 2008 at 2:02 PM, Alexandre Badez
<[EMAIL PROTECTED]> wrote:
> -(id)init
> {
>if (![super init])
>return nil;

You must always assign self to the result of [super init].  If anyone
(*cough* Wil Shipley *cough*) tells you otherwise, they may
inadvertently set you up for some seriously subtle errors.

So the code would be:

- (id)init
{
  if(self = [super init])  // single = is intentional
NSLog(@"-[%@ init]", [self className]);

  return self;
}

Anyway, your problem is here:

>NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

Why are you doing this?  AppKit creates an autorelease pool for you.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Handling key equivalents in a controller class?

2008-07-16 Thread Kyle Sluder
On Wed, Jul 16, 2008 at 2:00 PM, Jeff Johnson
<[EMAIL PROTECTED]> wrote:
> NSWindow is an NSResponder, so you could create an NSWindow subclass and
> override performKeyEquivalent: or keyDown: there.

Except what happens if a field editor is key?  Then the editor
swallows all keys, including Esc.  Or if it doesn't do this by
default, Esc is one of the keys that it can swallow because NSTextView
uses it as the "autocomplete" hotkey.

Didn't this question come up a while ago, and the solution was to
override the event dispatching mechanism before it even reached the
responder chain?

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: KVO notifications and threads

2008-07-16 Thread Hamish Allan
On Tue, Jul 15, 2008 at 7:45 PM, Jerry Isdale <[EMAIL PROTECTED]> wrote:

> Means we have at least three copies of the data shuffling around memory, but
> hey thats why we buy machines with 2-4 Gb of ram.

If you've got such a large amount of data, it seems unlikely you'd
want to be updating it all during calculations using getters and
setters. Instead, you'd be presenting some sort of aggregate view of
it in your UI; so you'd have one copy of the data and one copy of the
aggregation. They'd both live in the same model, but the code which
performs the aggregation would write its results using
performSelectorOnMainThread:...

1) network receiver captures packets, updates TheModel, possibly
invoking calculation action
2) calculation function does its stuff, updating TheModel
3) aggregation function (in controller) does its stuff, calling
performSelectorOnMainThread:... to update TheModel
4) main thread executes update selector
5) updates trigger KVO of View objects

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Setting Core Data attribute values to related entity attribute values

2008-07-16 Thread Hamish Allan
On Wed, Jul 16, 2008 at 5:12 PM, Jamie Phelps
<[EMAIL PROTECTED]> wrote:

> I have a Core Data entity in a Master-Detail view. In the detail view, I
> have a button that is bound to the createFoo: method of the selected object
> where Foo is the class name of the related entity. What I want to do is use
> this button to create a Foo and set its relationship programmatically.

That sort of code belongs in a controller -- the model knows nothing
about the selection.

>  In my awakeFromInsert: method for the Foo class, I want to set attribute
> values based on the related entity. If it's null, I have some defaults, but
> if the relationship is present, I want to set some values equal to the
> corresponding attribute in the related entity as defaults.

Do you really have to duplicate the information? It'll make your life
harder if any of it changes...

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Handling key equivalents in a controller class?

2008-07-16 Thread Jeff Johnson

On Jul 16, 2008, at 1:43 PM, Kyle Sluder wrote:


On Wed, Jul 16, 2008 at 2:00 PM, Jeff Johnson
<[EMAIL PROTECTED]> wrote:
NSWindow is an NSResponder, so you could create an NSWindow  
subclass and

override performKeyEquivalent: or keyDown: there.


Except what happens if a field editor is key?  Then the editor
swallows all keys, including Esc.  Or if it doesn't do this by
default, Esc is one of the keys that it can swallow because NSTextView
uses it as the "autocomplete" hotkey.

Didn't this question come up a while ago, and the solution was to
override the event dispatching mechanism before it even reached the
responder chain?

--Kyle Sluder


Actually, the reverse happens: the Esc key gets sent to the window,  
which can swallow it and prevent autocompletion. Try it. :-)


In any case, though, it certainly depends on what you want to do with  
keys that are normally handled by a view in the window.


-Jeff

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how to measure an attributedString or string with attributes

2008-07-16 Thread Nick Zitzmann


On Jul 16, 2008, at 6:18 AM, norio wrote:

I think QuickTime API had an api for measuring the width and the  
height of an attributed string.
If width was passed as an argument, the height was returned. And if  
height, returned its width.


Is there any ways to get such information?



For some reason, I was never able to get the built-in sizing methods  
to work correctly. What worked for me, though, was to use  
NSLayoutManager, NSTextContainer, NSTextStorage, and the - 
usedRectForTextContainer: method after setting the container size and  
forcing layout. If you search around, you might find some sample code.


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


CGWindowListCreateImage - Offscreen?

2008-07-16 Thread Seth Willits


Does CGWindowListCreateImage not work on offscreen windows? I can't  
seem to get an image of my window without putting it onscreen.



--
Seth Willits




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Relaunch Finder (without AppleScript)

2008-07-16 Thread Piero Avola
Maybe I shoul explain why I don't want to use NSAppleScript. Everytime  
I use an initializer of the class, my app crashs!


Debugger:
=shlibs-removed,shlib-info=[num="100",name="EyeTV MPEG  
Support",kind="-",dyld-addr="0xcf7b000",reason="dyld",requested- 
state="E",state="E",path="/Library/QuickTime/EyeTV MPEG  
Support.component/Contents/MacOS/EyeTV MPEG Support",description="/ 
Library/QuickTime/EyeTV MPEG Support.component/Contents/MacOS/EyeTV  
MPEG Support",loaded_addr="0xcf7b000",slide="0xcf7b000",prefix=""]
=shlibs-removed,shlib-info=[num="100",name="EyeTV MPEG  
Support",kind="-",dyld-addr="0xcf7b000",reason="dyld",requested- 
state="E",state="E",path="/Library/QuickTime/EyeTV MPEG  
Support.component/Contents/MacOS/EyeTV MPEG Support",description="/ 
Library/QuickTime/EyeTV MPEG Support.component/Contents/MacOS/EyeTV  
MPEG Support",loaded_addr="0xcf7b000",slide="0xcf7b000",prefix=""]

kill
quit

I don't know why this happens, two days ago it didn'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 [EMAIL PROTECTED]


Re: Mystery Thread - how to debug

2008-07-16 Thread Ken Thomases

On Jul 15, 2008, at 3:28 PM, James Bucanek wrote:

I've got another thread -- which I'll refer to as the "mystery  
thread" -- that is stuck in a spinlock. The sample looks like this:


7464 Thread_2a03
  7464 thread_start
7464 _pthread_start
  7464 __NSThread__main__
7464 -[NSThread main]
  7464 __spin_lock
7464 __spin_lock

I'm *assuming* that this is the worker thread exiting. But since  
there's no symbolic information associated with my application I  
can't figure out what thread this belongs to, what selector it will/ 
did execute, or why the heck it's stuck on a spinlock.


Any ideas?


In Leopard, you can assign names to threads using -[NSThread  
setName:].  If you name all of your threads, then when you get a hang  
like this you can inspect the name to get a hint.  Once your  
application has gotten stuck, attach to it with the debugger.  Select  
that thread, select the frame in -[NSThread main], and examine  
"self".  If this isn't a debug build of your app, and you're on x86,  
you can use a command like this to obtain self from the stack frame:


p *(id*)($ebp + 8)
po $1   < where $1 is the result from the previous command
po [$1 name]


Another approach to try is the Object Allocations instrument.  In  
theory, the NSThread instance must have been allocated at the point  
in your code where the thread was spun off.  Object Allocations can  
show you what NSThread objects are still "live" (allocated but not  
yet deallocated) and can show you the backtrace of the allocation.


Good luck,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Memory Allocation

2008-07-16 Thread Alexandre Badez
On Wed, Jul 16, 2008 at 20:38, Kyle Sluder
<[EMAIL PROTECTED]> wrote:
> On Wed, Jul 16, 2008 at 2:02 PM, Alexandre Badez
> <[EMAIL PROTECTED]> wrote:
>> -(id)init
>> {
>>if (![super init])
>>return nil;
>
> You must always assign self to the result of [super init].  If anyone
> (*cough* Wil Shipley *cough*) tells you otherwise, they may
> inadvertently set you up for some seriously subtle errors.
>
> So the code would be:
>
> - (id)init
> {
>  if(self = [super init])  // single = is intentional
>NSLog(@"-[%@ init]", [self className]);
>
>  return self;
> }

Thanks for this tips !


> Anyway, your problem is here:
>
>>NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>
> Why are you doing this?  AppKit creates an autorelease pool for you.

Well actually, I did not put this autorelease pool in my first
attempt. But when I've that the prog was growing in ObjectAlloc, I
though that I should create a pool to drain autorelease NSString
returned by stringWithFormat:.
The fact is that even with this pool, the memory is still growing...

Any idea about that ? Is it my fault ?

-- 
Alex
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Relaunch Finder (without AppleScript)

2008-07-16 Thread Nick Zitzmann


On Jul 16, 2008, at 1:25 PM, Piero Avola wrote:

Maybe I shoul explain why I don't want to use NSAppleScript.  
Everytime I use an initializer of the class, my app crashs!



What's the stack trace?

Are you using GC? I believe NSAppleScript at one point caused crashes  
under GC; I don't know if that bug was ever fixed or not.


Are you using Guard Malloc? I think someone in here was just having  
problems with NSAppleScript apparently corrupting memory in their  
program, and GM was catching it and crashing.


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: IBPlugin cannot load

2008-07-16 Thread Anders Lassen

Hi Kevin,

The answers to your questions are:

1) Principals Class name is: "MyControls". That is also the name of  
the IBPlugin class.


2) I only have one class description file, that is  
"MyControlsView.classdescription". Note that I have only one custom  
object, so I guess this is ok.


3) Product Name is "MyControls".


Anders Lassen


On Jul 16, 2008, at 9:01 PM, Kevin Cathey wrote:


Anders,

A few things to check here:

1. What is the principal class you have set for the plugin (Get info  
on the plugin target, then go to the "Properties" tab)

2. Do you have a class description file for each one of your classes.
3. What is the Product Name of the plugin (Get info on the plugin  
target, then go to the "Build" tab and search for Product Name)


Hopefully that will get us started in the right direction.

Kevin

--
Kevin Cathey

On Jul 16, 2008, at 11:37 AM, Anders Lassen wrote:


Hi,

I am pretty new to Xcode, and I hoped that I could create some  
custom controls using the Interface Builders Plug-In facility.


But after completing all step in the "Quick Start" chapter in  
"Interface Builder Plug-In Programming Guide", I cannot load the  
Plug-In. I get a error dialog saying:


"The bundle "MyButton" could not be loaded because is is damaged or  
missing necessary resources."


This is very weird, since I followed the "Plug-In Quick Start" tour  
very carefully.


Steps to Reproduce:

1) Follow Chapter 2, or just build a Plug-In using the Xcode template
2) Load the Plug-In from Interface Builders Preference dialog

I hope that anyone can help on this. I have used a lot of time  
trying figure out what is wrong.

___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/cathey%40apple.com

This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Memory Allocation

2008-07-16 Thread Gary L. Wade
You mentioned you launched your application with ObjectAlloc; launch it instead 
with MallocDebug and do your testings with the Leaks option to check for memory 
leaks.  It will show you an execution path so you can determine where the 
allocation originated that is leaking.

>On Wed, Jul 16, 2008 at 20:38, Kyle Sluder
><[EMAIL PROTECTED]> wrote:
>> On Wed, Jul 16, 2008 at 2:02 PM, Alexandre Badez
>> <[EMAIL PROTECTED]> wrote:
>>> -(id)init
>>> {
>>>if (![super init])
>>>return nil;
>>
>> You must always assign self to the result of [super init].  If anyone
>> (*cough* Wil Shipley *cough*) tells you otherwise, they may
>> inadvertently set you up for some seriously subtle errors.
>>
>> So the code would be:
>>
>> - (id)init
>> {
>>  if(self = [super init])  // single = is intentional
>>NSLog(@"-[%@ init]", [self className]);
>>
>>  return self;
>> }
>
>Thanks for this tips !
>
>
>> Anyway, your problem is here:
>>
>>>NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>>
>> Why are you doing this?  AppKit creates an autorelease pool for you.
>
>Well actually, I did not put this autorelease pool in my first
>attempt. But when I've that the prog was growing in ObjectAlloc, I
>though that I should create a pool to drain autorelease NSString
>returned by stringWithFormat:.
>The fact is that even with this pool, the memory is still growing...
>
>Any idea about that ? Is it my fault ?
>
>-- 
>Alex
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: IBPlugin cannot load

2008-07-16 Thread Ricky Sharp


On Jul 16, 2008, at 2:44 PM, Anders Lassen wrote:


The answers to your questions are:

1) Principals Class name is: "MyControls". That is also the name of  
the IBPlugin class.


2) I only have one class description file, that is  
"MyControlsView.classdescription". Note that I have only one custom  
object, so I guess this is ok.


3) Product Name is "MyControls".


Your .classdescription files need to be named according to your actual  
controls.  So for your MyButton control, you'd need to have a  
MyButton.classdescription


For another example plug-in that may be helpful during your development:



___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.com

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: IBPlugin cannot load

2008-07-16 Thread Anders Lassen

Hi,

The answers to the questions are:

1) In the ibplugin folder under Contents/MacOS folder there is one  
file "MyControls" (no extension)


2) i386

3) i386 ppc ppc64 ppc7400 ppc970 x86_64 (Valid Architectures)




On Jul 16, 2008, at 9:14 PM, Kevin Cathey wrote:


Hey Anders,

A few more things to check:

1. In the built plugin on disc, make sure there is a Contents/MacOS  
folder in your *.ibplugin folder, and that there is an executable in  
there.
2. Run "lipo -info EXECUTABLE" and see what the supported  
architectures are.
3. In Xcode, under the plugin's build settings, what are the  
architectures?


Kevin

--
Kevin Cathey


On Jul 16, 2008, at 11:37 AM, Anders Lassen wrote:


Hi,

I am pretty new to Xcode, and I hoped that I could create some  
custom controls using the Interface Builders Plug-In facility.


But after completing all step in the "Quick Start" chapter in  
"Interface Builder Plug-In Programming Guide", I cannot load the  
Plug-In. I get a error dialog saying:


"The bundle "MyButton" could not be loaded because is is damaged or  
missing necessary resources."


This is very weird, since I followed the "Plug-In Quick Start" tour  
very carefully.


Steps to Reproduce:

1) Follow Chapter 2, or just build a Plug-In using the Xcode template
2) Load the Plug-In from Interface Builders Preference dialog

I hope that anyone can help on this. I have used a lot of time  
trying figure out what is wrong.

___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/cathey%40apple.com

This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


[MEET] : LA CocoaHeads : 7/17/08 7:30pm

2008-07-16 Thread Rob Ross

Howdy LA CocoaHeads!

We will be meeting this Thursday, 7/17/08 at 7:30pm.

Kolja Wawrowsky will be giving a presentation on the research and  
software development he is doing. The title of his presentation is:


"Where art meets science. Visualization software for the life sciences."

We'll also be discussing the possibility of starting a study of  
Hillegass' book, "Cocoa Programming for Mac OS X, 3rd Edition".



 


We meet on Thursday at the offices of E! Entertainment at 7:30pm.

Our meeting location is

5750 Wilshire Blvd
Los Angeles, CA 90036.

Here's a google map of the location:

http://www.google.com/maps?f=q&hl=en&q=5750+Wilshire+Blvd,+Los+Angeles 
+CA+90036&ie=UTF8&z=15&om=1&iwloc=addr


Free street parking is available. I'd suggest trying Masselin Ave,  
which is one block East of Courtyard Place.


We meet near the lobby of the West building at 5750 Wilshire Blvd, on  
the West side of Courtyard Place. There are picknick tables in front  
of the lobby and we'll gather there starting at 7:20pm. From there we  
go inside and up to conference room 3A at around 7:45pm .


If you arrive late, please ask the building security personnel in the  
lobby to direct you to the E! Security office, and they will be able  
to contact the group in conference room 3A and send someone down to  
meet you.


If you have any questions, please email Rob Ross at rross at  
comcastnetsdhotcom




Rob Ross, Lead Software Engineer
E! Networks

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Attributed string to an Image without window

2008-07-16 Thread Nethan Aryan
Hello All,
Need your help...

I have to write a command line utility which will create an image from another 
source image by adding some attributed text onto the source image.

Can you suggest how to do it?

If I had to write same application with UI, then I think I would have used a 
view on a window to write the attributed text using drawAtPoint and then 
getting the TIFFRepresentation of the image.  This way I have got Image of the 
attributed string.

Now since I have two images I would have generated the final Image by using 
compositeToPoint...

But again since I don't want to have any window in my command based application 
I don't know how to proceed? 
Please suggest

Thanks in advance
Nethan


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Attributed string to an Image without window

2008-07-16 Thread j o a r


On Jul 16, 2008, at 9:59 AM, Nethan Aryan wrote:

I have to write a command line utility which will create an image  
from another source image by adding some attributed text onto the  
source image.



Before thinking about how you would implement this, you should read  
about the concept of "daemon-safe frameworks":


	


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSButton setKeyEquivalent doesn't seem to work

2008-07-16 Thread Brian Hughes

I want the default button to reflect where the user has decided to enter 
information.  I have a sign up / log in page.  If the user is new and is 
signing up I want the signUp button to be the default but if the user is 
already signed up and elects to use the log in field I want the logIn button to 
be default.  

I have assigned the signIn Button to be the default in Interface Builder by 
designating the key equivalent to be the return key.  When the user elects to 
log in I want the default button to become the logIn Button.  Here is my code:


- (void )controlTextDidBeginEditing: (NSNotification *) aNotification
{
if ([logInNameField isEqual: [aNotification object]])
{
[logInButtonOutlet setKeyEquivalent: @"/r"];
[signUpButtonOutlet setKeyEquivalent: @""];

NSLog (@"The key equivalent for log in Field is: %@", 
[logInButtonOutlet keyEquivalent]);
NSLog (@"The key equivalent for log in Field is: %@", 
[signUpButtonOutlet keyEquivalent]);
}

}

The log shows that the key equivalent for the logIn Button is now /r, the login 
Button highlights blue and the key equivalent for signUpButton is "" but the 
logIn Button's  action is not invoked if the return button is pressed.

Any help would be appreciated.

Thanks in advance,

Brian
_
Stay in touch when you're away with Windows Live Messenger.
http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_messenger2_072008___

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

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

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

This email sent to [EMAIL PROTECTED]


[Q] Do subclasses implementing same Protocol as super class also need to include it in declaration?

2008-07-16 Thread Rick Mann
I have a class D that derives from class S. S derives from  
NSObject. Do I need to declare D as:


@interface D : S

or can I leave off the  for the derived classes, and still  
get appropriate warnings?


TIA,
--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


MobileMe upload file to iDisk

2008-07-16 Thread Alexander Cohen

Is there an API that can be used to transfer files to a MobileMe iDisk?

thx

AC
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] Do subclasses implementing same Protocol as super class also need to include it in declaration?

2008-07-16 Thread Rick Mann


On Jul 16, 2008, at 14:15:45, Rick Mann wrote:

I have a class D that derives from class S. S derives from  
NSObject. Do I need to declare D as:


@interface D : S

or can I leave off the  for the derived classes, and still  
get appropriate warnings?


I think I answered my own question: you *should* specify the Protocol  
at all levels of the inheritance graph where you want the Protocol  
enforced.


--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Memory Allocation

2008-07-16 Thread Michael Ash
On Wed, Jul 16, 2008 at 2:38 PM, Kyle Sluder
<[EMAIL PROTECTED]> wrote:
> On Wed, Jul 16, 2008 at 2:02 PM, Alexandre Badez
> <[EMAIL PROTECTED]> wrote:
>> -(id)init
>> {
>>if (![super init])
>>return nil;
>
> You must always assign self to the result of [super init].  If anyone
> (*cough* Wil Shipley *cough*) tells you otherwise, they may
> inadvertently set you up for some seriously subtle errors.

Can you explain this, in particular how the "standard" initializer
sets you up for fewer seriously subtle errors than this one?

It seems to me that the possible return values from the [super init]
call can be broken into three categories:

A) self
B) nil
C) Something Else

A is obviously the common case, and B is the standard way to signal a
failure. Both the standard initializer and this one handle A and B
just fine, so they aren't all that interesting. That leaves us with C.

In the case of C, this initializer crashes and burns. If [super init]
returns another object, then it will free self, and then you'll be
accessing self after it's freed. Obviously this is bad.

However, the standard initializer *also* crashes and burns in the case
of C. The Something Else could be anything. It may not even be an
instance of your class, in which case you're accessing ivars that
aren't there, and you'll fail horribly.If it is an instance of your
class then it's virtually guaranteed to already be initialized, in
which case you're initializing twice, which could lead to anything
from a memory leak to a crash to data corruption.

If I've overlooked anything, I'd appreciate hearing about it. I do use
the standard if((self = [super init])) technique, but just out of
habit and conformity, as I have not been able to detect any actual
benefit from it.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: MobileMe upload file to iDisk

2008-07-16 Thread glenn andreas


On Jul 16, 2008, at 4:16 PM, Alexander Cohen wrote:

Is there an API that can be used to transfer files to a MobileMe  
iDisk?


thx



There use to be - the "dot Mac" SDK provided that sort of thing.   
There is even a mailing list about it (though it's all but dead now-a- 
days)


There is yet to be any public comment about any update to support  
mobileMe features, or what exactly the future of the dot Mac SDK is  
(it doesn't even support 64 bits in its current form)



Glenn Andreas  [EMAIL PROTECTED]
  wicked fun!
quadrium | flame : flame fractals & strange attractors : build,  
mutate, evolve, animate




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSButton setKeyEquivalent doesn't seem to work

2008-07-16 Thread Randall Meadows

On Jul 16, 2008, at 3:12 PM, Brian Hughes wrote:

I want the default button to reflect where the user has decided to  
enter information.  I have a sign up / log in page.  If the user is  
new and is signing up I want the signUp button to be the default but  
if the user is already signed up and elects to use the log in field  
I want the logIn button to be default.


I have assigned the signIn Button to be the default in Interface  
Builder by designating the key equivalent to be the return key.   
When the user elects to log in I want the default button to become  
the logIn Button.  Here is my code:



- (void )controlTextDidBeginEditing: (NSNotification *) aNotification
{
if ([logInNameField isEqual: [aNotification object]])
{
[logInButtonOutlet setKeyEquivalent: @"/r"];


You probably want "\r" there.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSButton alternate image problem - not redrawing

2008-07-16 Thread P Teeson

On 16-Jul-08, at 1:03 PM, Gary L. Wade wrote:


Mac OS X Tiger 10.4.11, Xcode 2.5, G4 867mhz
I am making a Cocoa Application kids game using NSButtons.

They are of behaviour Toggle and of type Square Button and the icon
position is centred (i.e. no title) and each button has a unique tag
and is enabled.

The icon images are in the nib file and consist of
(a) a coloured blank square and
(b) a set of coloured squares with large letters in the centre.

In the nib all buttons have the blank icon image as both image and
alternate image. Connections are made in IB from each button to the
Controller IBAction method. Likewise connections are made from
the Controller IBOutlets to the respective buttons.

When the game begins I successfully retrieve all the icon images from
the bundle and keep them as instance variables in my Controller.
(e.g. IBOutlet NSButton * cell0; IBOutlet NSButton *cell1; etc)

The game is played by clicking on a button and a message is sent to
an IBAction method in the Controller. It replaces the alternate image
with one of the (b) icons and disables that button.
..
[sender setAlternateImage:theXiconImage];
[sender setEnabled:NO];
..
This all works exactly and desired.

There is another NSButton to trigger a New Game and it sends a
message to an IBAction method in the Controller that re-initialises
the buttons as follows:
..
[cell0 setAlternateImage:theBlankImage]; // send messages via  
IBOutlet

[cell0 setEnabled:YES];
[cell1 setAlternateImage:theBlankImage];
[cell1 setEnabled:YES];
[cell2 setAlternateImage:theBlankImage];
[cell2 setEnabled:YES];
etc
..
(Of course the Model is also reinitialised)

My Problem is this
The View gets redrawn OK.
But now when clicking on a button there is no guarantee that the
alternate images will appear.
Sometimes they do; sometimes they don't - just displaying the  
blank icon.

And yet the same action method is being called as in the first play
of the game.

Why do you think this is not redrawing correctly after the  
reinitialisation?


TIA for your suggestions.
If I'm reading you right (the action of a button click causes that  
same button to get a new alternate image),
I would say that you should set the alternate image before the user  
clicks on the button.
Once a button is toggled, the current alternate image (or image,  
depending on state) is drawn


Thanks for your thought but I don't see why that is so. Initially the  
button has blank icons for both images.
User clicks on button, action method is called, in that method a  
different alternate image is set,
   the button is disabled, the action method is exited, and  
button is redrawn showing the new image.
This all works perfectly for the first play of the game; i.e. when  
the View is loaded from the .nib.
So dynamically changing the alternate image in the action method  
actually works.


However when that game is over the user clicks on the "New Game"  
button which invokes an
action method to restore the game to it's inital values, including  
the images and enablement of the buttons.

(see the above code snippet)

Now when the user plays the second, and subsequent, games it's a crap  
shoot as to whether or not the
alternate image actually displays or whether it's just the blank icon  
that shows up. I don't understand
why it wouldn't work as before. Maybe there is some hidden caching  
going on.


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


Re: IBPlugin cannot load

2008-07-16 Thread Anders Lassen

Hi Ricky,

Thanks for the link to the sample code.

My classdescription file is named correct. My custom class is  
MyControlsView.


After having downloaded and compiled the sample project, I experience  
the same problems  when using my own plugin - "sigh".


The problem is that I cannot figure out, how to use the plugin from a  
client.


I have tried to add the framework to my client. But when I start the  
Interface Builder the custom controls does not appear in the IB- 
library. According to the documentation this is to be expected:


"How you deploy your Interface Builder plug-in to clients depends  
heavily on how you deploy your custom controls to those same clients.  
Apple recommends that you deploy custom controls using a custom  
framework. A custom framework makes plug-in integration almost trivial  
for yourself and for the clients of your framework. If you are unable  
to use a custom framework, however, users can load your plug-in  
manually into the Interface Builder environment."


If I try to load the plugin manually from IB's Preference Plug-In  
dialog I get an error dialog.



According to the documentation all this should be trivial, but ...



On Jul 16, 2008, at 10:10 PM, Ricky Sharp wrote:



On Jul 16, 2008, at 2:44 PM, Anders Lassen wrote:


The answers to your questions are:

1) Principals Class name is: "MyControls". That is also the name of  
the IBPlugin class.


2) I only have one class description file, that is  
"MyControlsView.classdescription". Note that I have only one custom  
object, so I guess this is ok.


3) Product Name is "MyControls".


Your .classdescription files need to be named according to your  
actual controls.  So for your MyButton control, you'd need to have a  
MyButton.classdescription


For another example plug-in that may be helpful during your  
development:




___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.com



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Handling key equivalents in a controller class?

2008-07-16 Thread Matt Neuburg
On Wed, 16 Jul 2008 10:05:52 -0700, Jens Alfke <[EMAIL PROTECTED]> said:
>I've run into this problem a few times now: I have an
>NSWindowController subclass that manages a window. I want to handle
>certain hot-keys in this window, for example Esc to exit full-screen
>mode, or maybe use letter keys to switch tools as in Photoshop. Where
>do I put the handler for this?
>
>When this happened in the past I added a -performKeyEquivalent: method
>to a custom view in the window. However, this only makes sense
>architecturally if the action is related to that view; and if the view
>is a standard class (like NSTableView) then I have to subclass it just
>to add that one method. (AppKit doesn't send -performKeyEquivalent up
>the responder chain to the window's delegate, only to the views in the
>window.) This seems contrary to Cocoa's usual philosophy of delegation.
>
>Am I missing something?

Implement keyDown: in the NSWindowController? I'm not seeing a reason why
you need performKeyEquivalent to catch unmodified Esc and letter keys...
Actually I'm fond of sticking a singleton NSResponder into the chain after
the window and implementing keyDown: there. m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSButton setKeyEquivalent doesn't seem to work

2008-07-16 Thread Matt Neuburg
On Wed, 16 Jul 2008 17:12:31 -0400, Brian Hughes <[EMAIL PROTECTED]>
said:
>
>I want the default button to reflect where the user has decided to enter
information.  I have a sign up / log in page.  If the user is new and is signing
up I want the signUp button to be the default but if the user is already signed
up and elects to use the log in field I want the logIn button to be default.
>
>I have assigned the signIn Button to be the default in Interface Builder by
designating the key equivalent to be the return key.  When the user elects to
log in I want the default button to become the logIn Button.  Here is my code:
>
>
>- (void )controlTextDidBeginEditing: (NSNotification *) aNotification
>{
> if ([logInNameField isEqual: [aNotification object]])
> {
>  [logInButtonOutlet setKeyEquivalent: @"/r"];
>  [signUpButtonOutlet setKeyEquivalent: @""];
>
>  NSLog (@"The key equivalent for log in Field is: %@", [logInButtonOutlet
keyEquivalent]);
>  NSLog (@"The key equivalent for log in Field is: %@", [signUpButtonOutlet
keyEquivalent]);
> }
>
>}
>
>The log shows that the key equivalent for the logIn Button is now /r, the login
Button highlights blue and the key equivalent for signUpButton is "" but the
logIn Button's  action is not invoked if the return button is pressed.
>
>Any help would be appreciated.

One thing that instantly comes to mind is that a forward slash is not a
backward slash. m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Memory Allocation

2008-07-16 Thread Quincey Morris

On Jul 16, 2008, at 14:19, Michael Ash wrote:


Can you explain this, in particular how the "standard" initializer
sets you up for fewer seriously subtle errors than this one?

It seems to me that the possible return values from the [super init]
call can be broken into three categories:

A) self
B) nil
C) Something Else



This has been discussed on this list fairly recently. The pattern:

self = [super init...];

is both correct and required. See [NSManagedObject  
initWithEntity:insertIntoManagedObjectContext:] for an example of when  
the returned object is generally a different object.


There may be a couple of other cases where it matters, too (class  
clusters are NOT currently one of those other cases), but you should  
always assume initialization could return a different object or nil.  
(And that was the official word from Apple.)



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: MobileMe upload file to iDisk

2008-07-16 Thread Alexander Cohen

Does it support WebDAV?

AC

On Jul 16, 2008, at 5:21 PM, glenn andreas wrote:



On Jul 16, 2008, at 4:16 PM, Alexander Cohen wrote:

Is there an API that can be used to transfer files to a MobileMe  
iDisk?


thx



There use to be - the "dot Mac" SDK provided that sort of thing.   
There is even a mailing list about it (though it's all but dead now- 
a-days)


There is yet to be any public comment about any update to support  
mobileMe features, or what exactly the future of the dot Mac SDK is  
(it doesn't even support 64 bits in its current form)



Glenn Andreas  [EMAIL PROTECTED]
 wicked fun!
quadrium | flame : flame fractals & strange attractors : build,  
mutate, evolve, animate




___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: MobileMe upload file to iDisk

2008-07-16 Thread Nick Zitzmann


On Jul 16, 2008, at 3:16 PM, Alexander Cohen wrote:

Is there an API that can be used to transfer files to a MobileMe  
iDisk?



Yes, but as others have mentioned, the DotMacKit framework hasn't been  
updated in years, is obsolete, and I will be surprised if it ever gets  
updated. You can still use it if you want, but then you can't use  
Leopard's GC or 64-bit features in your app (or, at least, in the 64- 
bit builds). Alternately, you can use a DAV library or framework, such  
as CURL or ConnectionKit, to upload to MobileMe.


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: MobileMe upload file to iDisk

2008-07-16 Thread Eric Crichlow
   Yes, a .Mac SDK exists that allows apps to integrate with .Mac, and I think 
the SDK is still compatible with the move to MobileMe.

Look here:

http://developer.apple.com/sdk/

Scroll down a bit. It hasn't been updated in a while.

...Eric...


This message is intended only for the use of the individual (s) or entity to 
which it is addressed and may contain information that is privileged, 
confidential, and/or proprietary to eInstruction and its affiliates. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution, forwarding or copying of this 
communication is prohibited without the express permission of the sender. If 
you have received this communication in error, please notify the sender 
immediately and delete the original message.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Memory Allocation

2008-07-16 Thread Shawn Erickson
On Wed, Jul 16, 2008 at 2:19 PM, Michael Ash <[EMAIL PROTECTED]> wrote:
> On Wed, Jul 16, 2008 at 2:38 PM, Kyle Sluder
> <[EMAIL PROTECTED]> wrote:
>> On Wed, Jul 16, 2008 at 2:02 PM, Alexandre Badez
>> <[EMAIL PROTECTED]> wrote:
>>> -(id)init
>>> {
>>>if (![super init])
>>>return nil;
>>
>> You must always assign self to the result of [super init].  If anyone
>> (*cough* Wil Shipley *cough*) tells you otherwise, they may
>> inadvertently set you up for some seriously subtle errors.
>
> Can you explain this, in particular how the "standard" initializer
> sets you up for fewer seriously subtle errors than this one?
>
> It seems to me that the possible return values from the [super init]
> call can be broken into three categories:
>
> A) self
> B) nil
> C) Something Else
>
> A is obviously the common case, and B is the standard way to signal a
> failure. Both the standard initializer and this one handle A and B
> just fine, so they aren't all that interesting. That leaves us with C.
>
> In the case of C, this initializer crashes and burns. If [super init]
> returns another object, then it will free self, and then you'll be
> accessing self after it's freed. Obviously this is bad.

That is why you set self to the return value of [super initXxx] and
check to ensure it isn't nil. Remember that "self" is a local var
that, while passed to the method via a hidden parameter, can still be
modified as needed while in the scope of the method.

> However, the standard initializer *also* crashes and burns in the case
> of C. The Something Else could be anything. It may not even be an
> instance of your class, in which case you're accessing ivars that
> aren't there, and you'll fail horribly.

It could be a dynamically generated subclass of your class that has
the ivars you expect.

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Mini Popup Window (Like iCal) SOLVED

2008-07-16 Thread Seth Willits

On Jul 10, 2008, at 3:39 PM, Markus Spoettl wrote:

Don't know but it appears a thin border is added to the content view  
automatically - at least that is what I see in my own version.



I was hoping that works for overlay windows as well, but I wasn't  
sure. I see now that it is.



On 10.5 this is probably done with an animation. The following is  
basically what I'm using in a custom window class (you can set  
startFrom to something suitable for your zoom start position):



That resizes a window rather than scales it. It's a different effect.


I figured it all out earlier today using the CGWindow API to get a  
window image and using an overlay window to do the scaling. Works  
great. And I don't even have to work about it breaking because of  
private APIs :)




--
Seth Willits




___

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

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

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

This email sent to [EMAIL PROTECTED]


NSOutlineView force expansion/refresh?

2008-07-16 Thread Michael Hanna
I'm using observeValueForKeyPath:ofObject:change:context: to detect
when a change occurs in my data model. When a non-leaf node gets
added, the outline view draws the new item, but in an unexpanded
state. I try this code:

[m_rulesOutlineView noteNumberOfRowsChanged];

//  expand all items in outline view
int c;
for (c = 0; c < [m_rulesOutlineView numberOfRows]; c++)
{
id item = [m_rulesOutlineView itemAtRow:c];
[m_rulesOutlineView expandItem:item];

[m_rulesOutlineView
setNeedsDisplayInRect:[m_rulesOutlineView rectOfRow:c]];
}

in order to expand the new item. The new item expands(i.e. the
triangle points downward) but the leaf nodes aren't actually drawn.
The user has to undisclose, then disclose the new triangle in order to
see the children.

I have tried calling this code in the next event loop by doing this:

[self performSelector:@selector(refreshRulesTreeView)
withObject:nil afterDelay:0.0];

to no avail. Also, calling -reloadData results in an assertion in
NSOutlineView.m ...

any help?
Michael
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Memory Allocation

2008-07-16 Thread Michael Ash
On Wed, Jul 16, 2008 at 6:21 PM, Shawn Erickson <[EMAIL PROTECTED]> wrote:
> On Wed, Jul 16, 2008 at 2:19 PM, Michael Ash <[EMAIL PROTECTED]> wrote:
>> On Wed, Jul 16, 2008 at 2:38 PM, Kyle Sluder
>> <[EMAIL PROTECTED]> wrote:
>>> On Wed, Jul 16, 2008 at 2:02 PM, Alexandre Badez
>>> <[EMAIL PROTECTED]> wrote:
 -(id)init
 {
if (![super init])
return nil;
>>>
>>> You must always assign self to the result of [super init].  If anyone
>>> (*cough* Wil Shipley *cough*) tells you otherwise, they may
>>> inadvertently set you up for some seriously subtle errors.
>>
>> Can you explain this, in particular how the "standard" initializer
>> sets you up for fewer seriously subtle errors than this one?
>>
>> It seems to me that the possible return values from the [super init]
>> call can be broken into three categories:
>>
>> A) self
>> B) nil
>> C) Something Else
>>
>> A is obviously the common case, and B is the standard way to signal a
>> failure. Both the standard initializer and this one handle A and B
>> just fine, so they aren't all that interesting. That leaves us with C.
>>
>> In the case of C, this initializer crashes and burns. If [super init]
>> returns another object, then it will free self, and then you'll be
>> accessing self after it's freed. Obviously this is bad.
>
> That is why you set self to the return value of [super initXxx] and
> check to ensure it isn't nil. Remember that "self" is a local var
> that, while passed to the method via a hidden parameter, can still be
> modified as needed while in the scope of the method.

I understand that, I was comparing the two cases.

>> However, the standard initializer *also* crashes and burns in the case
>> of C. The Something Else could be anything. It may not even be an
>> instance of your class, in which case you're accessing ivars that
>> aren't there, and you'll fail horribly.
>
> It could be a dynamically generated subclass of your class that has
> the ivars you expect.

This is indeed the key that I had overlooked.

A colleague pointed out this older post which describes it in more detail:

http://www.cocoabuilder.com/archive/message/cocoa/2008/2/11/198591

In short, [super init] can return an object which can be properly
initialized by your code but which contains more stuff than would be
possible by sticking with the original instance.

Thanks for pointing this out!

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


alternative to flash

2008-07-16 Thread Bob Sabiston

Hi,

  If there's no Flash on the iphone, is there a good replacement in  
terms of vector graphic animation?  Ideally the same file would play  
in a PC/Mac browser as well.  I'm just looking to go to a URL and an  
animation fills the screen and is playing, no quicktime control bar or  
anything and preferably vector graphics rather than video.  I tried an  
animated GIF but that doesn't fill the screen on the iphone, and worse  
it doesn't play.


That's not really a cocoa question, more of a iphone web-developer  
question I guess. But I didn't see an iphone-dev mailing list.  I'm  
asking here also because one alternative would be to write an iphone  
app which receives vector info and reproduces the animation with  
quartz or opengl graphics.  But that's like writing a whole flash- 
player type thing and maybe there's something like that already?


Thanks
Bob


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Attributed string to an Image without window

2008-07-16 Thread Brett Powley
You don't have to have a window or a view to draw:  you can draw  
directly to an image using [NSImage lockFocus].



On 17/07/2008, at 2:59 AM, Nethan Aryan wrote:


Hello All,
Need your help...

I have to write a command line utility which will create an image  
from another source image by adding some attributed text onto the  
source image.


Can you suggest how to do it?

If I had to write same application with UI, then I think I would  
have used a view on a window to write the attributed text using  
drawAtPoint and then getting the TIFFRepresentation of the image.   
This way I have got Image of the attributed string.


Now since I have two images I would have generated the final Image  
by using compositeToPoint...


But again since I don't want to have any window in my command based  
application I don't know how to proceed?

Please suggest

Thanks in advance
Nethan


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Redrawing CALayer subclass when super layer is scaled

2008-07-16 Thread David Duncan

On Jul 15, 2008, at 10:42 PM, Rick Mann wrote:

However, at the time that my drawing code is called, the  
CGContextRef that's handed to me is NOT scaled. So my drawing is  
done small, and then only scaled afterward by some blit operation.  
The result is very pixilated lines.


If you are dealing with CALayers, then the context covers the number  
of pixels defined by layer.bounds.size. If you are dealing with a  
CATiledLayer, then the context passed covers the number of pixels  
defined by layer.tileSize. The primary difference between a CALayer  
and a CATiledLayer is that the tiled layer has multiple  
representations for the same content, whereas a CALayer has only one  
representation (which is also why a CATiledLayer requires more  
resources than a CALayer).


This is also why when you scale up a CALayer its content its content  
looks interpolated - its the same number of pixels as before, just  
interpolated larger. If you exceed the maximum LOD of a tiled layer,  
you will see the same thing (which if you don't set a LOD bias means  
if you scale a tiled layer above 1.0 it will also have its content  
interpolated).


I've tried making my root layer a CATiledLayer, and I've tried  
making my individual sublayers CATiledLayers (and setting levels of  
detail for both). Nothing works.


I'm not certain why it would not, at least not with all your layers as  
tiled layers. If just your root layer is a tiled layer, then it would  
need to be transformed for its drawing code to be re-invoked, and it  
would not effect any of the sublayers directly.


I don't really want to have to set the scale on each sublayer; this  
seems to defeat the purpose of the drawing transform.


This wouldn't have the effect you would want anyway (both transforms  
would be concatenated, which would end up with an explosion of size  
unless you flattened your layer hierarchy)


The documentation says that any transform applied to a layer also  
applies to its sublayers, but this is not what I'm seeing; at least,  
not at draw time.



Can't really say what you are or are not seeing here, I'd probably  
have to see code. If this is critical, I'd recommend filing a DTS  
incident.

--
David Duncan
Apple DTS Animation and Printing
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Duplicate rows appearing in outlineview after creating new Entity in moc, why?

2008-07-16 Thread Sean McBride
Jon,

Thanks for your reply.  My fetch predicate was already "parent == nil".

I have narrowed this down to the fact that my treecontroller has its
'contentSet' binding set.  If I remove that binding, duplicates no
longer appear.

I have created a very simple test app to illustrate:


It's a master-detail interface.  The master is a tableview/
arraycontroller on the left, the detail is an outlineview/treecontroller
on the right.  The treecontroller's 'contentSet' binding is bound to
'arrayController.selection.someRelationship'.

If someone would care to try:
 - launch the app
 - click 'Add Family'
 - click 'New Folder'
 - expand the folder's disclosure triangle
 - (keep the folder selected)
 - click 'New Person'

The new person appears both in the folder and at the root of the
outlineview.  Remove the contentSet binding and the problem goes away.
It's only 50 lines of code.  I don't get it.

Cheers,

Sean


On 7/16/08 1:44 PM, Jonathan Dann said:

>The duplicate problem is likely fixed by giving the tee controller a
>fetch predicate in IB. Set the predicate to something like
>parent==nil. This will obviously depend on what you've called your
>'parent' property.
>
>I've blogged about doing this with drag and drop in core data and non-
>core data apps.
>
>http://espresso-served-here.com
>
>HTH
>
>Jon
>
>On 15 Jul 2008, at 22:59, "Sean McBride" <[EMAIL PROTECTED]>
>wrote:
>
>> Hi all,
>>
>> I have an outlineview populated by binding to a treecontroller.  It
>> displays CoreData entities of type "Person".  "Person" has 'parent'
>> and
>> 'children' relationships.  Displaying everything works fine.
>>
>> Now the outlineview must support drops.  In my windowcontroller, I
>> implement outlineView:acceptDrop:item:childIndex: and look for my
>> custom
>> pasteboard type.  If it's there, I need to create a new "Person"
>> entity.  How should I do this?
>>
>> I have tried:
>> a) [myTreeController add:nil];
>>
>> b) Person* person = [myTreeController newObject];
>>[person setParent:...];
>>
>> c) Person* person = [NSEntityDescription
>>  insertNewObjectForEntityForName:@"Person"
>>  inManagedObjectContext:moc];
>>[person setParent:...];
>>
>> In all cases, the outlineview shows 2 of the new person.  The
>> problem is
>> not on the model side, since if I close and reopen the window, only 1
>> new person is there.
>>
>> Thanks,
>>
>> --
>> 
>> Sean McBride, B. Eng [EMAIL PROTECTED]
>> Rogue Researchwww.rogue-research.com
>> Mac Software Developer  Montréal, Québec, Canada
>>
>>
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/j.p.dann%40gmail.com
>>
>> This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Type Select Causes Crash ...

2008-07-16 Thread I. Savant

List:

  I have a table view that uses the NSTableDataSource protocol (you  
*do* remember that, don't you? :-) ). I have the standard data source  
methods provided (count/obj value/set obj value) and all works well.


  All except one thing. I was trying out the whole type select thing,  
marveling at how I didn't have to supply delegate behavior for it to  
work on a standard column with a text cell. I'd get random crashes,  
however:


Program received signal:  “EXC_BAD_ACCESS”.

Backtrace:
#0  0x95cbc6ec in objc_msgSend ()
#1  0x9003cee4 in -[NSCell _setContents:] ()
#2  0x9005130a in -[NSCell setObjectValue:] ()
#3  0x90051203 in -[NSActionCell setObjectValue:] ()
#4  0x900f9174 in -[NSTableView preparedCellAtColumn:row:] ()
#5  0x905dfd40 in -[NSTableView _typeSelectStringForColumn:row:] ()
#6  0x903b7287 in -[NSTableView  
_nextTypeSelectMatchFromRow:toRow:forString:] ()

#7  0x903b6cfe in -[NSTableView _performTypeSelect:] ()
#8  0x902c99df in -[NSTableView keyDown:] ()
#9  0x901334c5 in -[NSWindow sendEvent:] ()
#10 0x900ff431 in -[NSApplication sendEvent:] ()
#11 0x9005ce27 in -[NSApplication run] ()
#...

  Ouch! I have a standard NSTableView with a vanilla setup, so I  
couldn't figure out what was going on. I then tried disabling type  
select (unchecking the box in IB). Same result.


  So I started noticing a pattern ... any time I'd press the *space  
bar*, it would crash the same way each time. No other keys cause it  
(that I could determine).


  Any ideas?

--
I.S.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: alternative to flash

2008-07-16 Thread Kyle Sluder
On Wed, Jul 16, 2008 at 7:13 PM, Bob Sabiston <[EMAIL PROTECTED]> wrote:
> But I didn't see an iphone-dev mailing list.

iPhone.  NDA.

Anyway, look into SVG for Flash-less animation.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: MobileMe upload file to iDisk

2008-07-16 Thread Alexander Cohen


On Jul 16, 2008, at 6:08 PM, Nick Zitzmann wrote:



On Jul 16, 2008, at 3:16 PM, Alexander Cohen wrote:

Is there an API that can be used to transfer files to a MobileMe  
iDisk?



Yes, but as others have mentioned, the DotMacKit framework hasn't  
been updated in years, is obsolete, and I will be surprised if it  
ever gets updated. You can still use it if you want, but then you  
can't use Leopard's GC or 64-bit features in your app (or, at least,  
in the 64-bit builds). Alternately, you can use a DAV library or  
framework, such as CURL or ConnectionKit, to upload to MobileMe.


Is it possible to use a DAV library to to get folder listings, upload  
and download files to my home (private) section of my MobileMe iDisk.  
Also, what URL would i use in the HTTP requests, would it be  
www.me.com/?


I know this is a bit off-topic, is there a better list for this?

thx

AC

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: MobileMe upload file to iDisk

2008-07-16 Thread Nick Zitzmann


On Jul 16, 2008, at 6:15 PM, Alexander Cohen wrote:

Is it possible to use a DAV library to to get folder listings,  
upload and download files to my home (private) section of my  
MobileMe iDisk.



Of course it's possible, but you'll have to use a framework to do  
everything except downloading, since Foundation doesn't do DAV.


Also, what URL would i use in the HTTP requests, would it  
bewww.me.com/?


It would be http://idisk.mac.com//.

Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Sorting a to-many relationship property

2008-07-16 Thread Rick Mann
I have a couple entities related by a to-many relationship. Entity Foo  
can have 0..N of Entity Bar. I have a relationship defined on Foo  
named "bars". In my code, I build a comma-delimited string of Bars by  
iterating over the NSArray* returned by Foo.bars.


But they come back in whatever order Core Data has for them. I'd  
really like for all requests for Foo.bars to come back sorted by a  
property of Bar. Is this possible? Or must I either create a new  
property that sorts them, or just sort them after I get them?


TIA,
--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


[Moderator] Re: alternative to flash

2008-07-16 Thread Scott Anguish

iPhone Development can't be discussed here. The NDA is still in effect.


On 16-Jul-08, at 7:13 PM, Bob Sabiston wrote:


Hi,

 If there's no Flash on the iphone, is there a good replacement in  
terms of vector graphic animation?  Ideally the same file would play  
in a PC/Mac browser as well.  I'm just looking to go to a URL and an  
animation fills the screen and is playing, no quicktime control bar  
or anything and preferably vector graphics rather than video.  I  
tried an animated GIF but that doesn't fill the screen on the  
iphone, and worse it doesn't play.


That's not really a cocoa question, more of a iphone web-developer  
question I guess. But I didn't see an iphone-dev mailing list.  I'm  
asking here also because one alternative would be to write an iphone  
app which receives vector info and reproduces the animation with  
quartz or opengl graphics.  But that's like writing a whole flash- 
player type thing and maybe there's something like that already?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Sorting a to-many relationship property

2008-07-16 Thread I. Savant
But they come back in whatever order Core Data has for them. I'd  
really like for all requests for Foo.bars to come back sorted by a  
property of Bar. Is this possible? Or must I either create a new  
property that sorts them, or just sort them after I get them?


  You'll need to sort them yourself after you get them if you're  
directly getting them via -valueForKeyPath: since there's no way to  
specify a sort descriptor at that time. NSArray conveniently has a  
method for exactly that purpose.


--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Redrawing CALayer subclass when super layer is scaled

2008-07-16 Thread Rick Mann


On Jul 16, 2008, at 16:23:23, David Duncan wrote:

Can't really say what you are or are not seeing here, I'd probably  
have to see code. If this is critical, I'd recommend filing a DTS  
incident.



I'm happy to send you my code. It's not critical, in that I can find  
other ways to do what I want (other than using Core Animation). This  
is a side project, and I can't afford DTS incidents.


I'm just disappointed that it doesn't seem possible to make Core  
Animation do what I want: redraw me at the destination resolution.


--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Sorting a to-many relationship property

2008-07-16 Thread Rick Mann


On Jul 16, 2008, at 17:51:30, I. Savant wrote:

 You'll need to sort them yourself after you get them if you're  
directly getting them via -valueForKeyPath: since there's no way to  
specify a sort descriptor at that time. NSArray conveniently has a  
method for exactly that purpose.



I realized I'm getting back an NSSet* from the property "bars". Since  
CoreData doesn't even think of the result set as an ordered  
collection, I see why there's no way to set the sort it should always  
apply.


I found a way to do it with NSSortDescriptors, but it's hardly  
convenient. I have to allocate 4 objects:



NSSortDescriptor* sortDesc = [[NSSortDescriptor alloc]	initWithKey:  
@"designator"

ascending: YES
selector: 
@selector(localizedCaseInsensitiveCompare:)];
NSArray* bars = [self.bars allObjects];
bars = [bars sortedArrayUsingDescriptors: [NSArray arrayWithObject:  
sortDesc]];



If I were better at KVO, I'm sure I could cache the sorted result, but  
I'm not sure how yet.


--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


notification when app is moved

2008-07-16 Thread Mitchell Livingston

Hello,

I have code that must know where a folder inside the Resources folder  
of the application is. This location must be updated whenever the app  
is moved to another location. Is there some sort of callback I can  
register to receive for this?


Thanks,
Mitchell Livingston
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSOutlineView force expansion/refresh?

2008-07-16 Thread Markus Spoettl

On Jul 16, 2008, at 3:22 PM, Michael Hanna wrote:

I'm using observeValueForKeyPath:ofObject:change:context: to detect
when a change occurs in my data model. When a non-leaf node gets
added, the outline view draws the new item, but in an unexpanded
state. I try this code:

   [m_rulesOutlineView noteNumberOfRowsChanged];

   //  expand all items in outline view
   int c;
   for (c = 0; c < [m_rulesOutlineView numberOfRows]; c++)
   {
   id item = [m_rulesOutlineView itemAtRow:c];
   [m_rulesOutlineView expandItem:item];

   [m_rulesOutlineView
setNeedsDisplayInRect:[m_rulesOutlineView rectOfRow:c]];
   }

in order to expand the new item. The new item expands(i.e. the
triangle points downward) but the leaf nodes aren't actually drawn.
The user has to undisclose, then disclose the new triangle in order to
see the children.



I don't know if that causes your problem but you should know that - 
numberOfRows: grows as you expand items. The most simple way to get  
around implications that are caused by this behaviour this is going  
through the items in reverse order like this:


for (c = [m_rulesOutlineView numberOfRows] - 1; c >=  ; c--)
{
   // expand items here
}

That way you will avoid looking at rows that have been created as a  
result of expanding an item.


Also, I don't think that you have to call -setNeedsDisplayInRect: on  
the items, that's something NSOutlineView should be managing.


Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: notification when app is moved

2008-07-16 Thread Brett Powley
I have code that must know where a folder inside the Resources  
folder of the application is. This location must be updated whenever  
the app is moved to another location. Is there some sort of callback  
I can register to receive for this?





[[NSBundle mainBundle] resourcePath]

will give you the location of the Resources directory for your  
application.  Why do you need to maintain this location separately?


Cheers,
Brett

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] Do subclasses implementing same Protocol as super class also need to include it in declaration?

2008-07-16 Thread Chris Hanson

On Jul 16, 2008, at 2:15 PM, Rick Mann wrote:

I have a class D that derives from class S. S derives from  
NSObject. Do I need to declare D as:


@interface D : S

or can I leave off the  for the derived classes, and still  
get appropriate warnings?


You can leave off the  for derived classes, but you won't  
get warnings because you've said the superclass fulfills the contract  
described by the protocol declaration.


Subclasses of NSView, for example, all conform to NSCoding because  
NSView itself does.  That's separate from whether subclasses of NSView  
that want to encode or decode their own unique state need to override  
NSView's implementation of the appropriate NSCoding methods.


  -- Chris

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: notification when app is moved

2008-07-16 Thread Omar Qazi


On Jul 16, 2008, at 6:08 PM, Mitchell Livingston wrote:

I have code that must know where a folder inside the Resources  
folder of the application is. This location must be updated whenever  
the app is moved to another location. Is there some sort of callback  
I can register to receive for this?


Huh? Where a folder inside the resources folder of an application is?  
I'm going to assume you mean the full path of something inside of an  
Application bundle.


You don't need to get a notification when the app is moved. Instead, I  
would recommend using NSBundle's pathForResource: ofType: in  
combination with NSWorkspace's fullPathForApplication:. So whenever  
you needed the path of that folder, you could do something like this:



NSString *pathToApp = [[NSWorkspace  
sharedWorkspace]fullPathForApplication:@"Whatever Application"];

NSBundle *appBundle = [[NSBundle alloc]initWithPath:pathToApp];
NSString *resourcePath = [appBundle  
pathForResource:@"WhateverResource" ofType:@"Whatever Type"];


Omar Qazi
Hello, Galaxy!
1.310.294.1593



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: alternative to flash

2008-07-16 Thread Chris Cooley

On Jul 16, 2008, at 6:54 PM, Kyle Sluder wrote:
On Wed, Jul 16, 2008 at 7:13 PM, Bob Sabiston <[EMAIL PROTECTED]>  
wrote:

But I didn't see an iphone-dev mailing list.


Apple said creating an NDA-covered discussion area was moot because  
the iPhone NDA would be ending July 11, 2008.



Anyway, look into SVG for Flash-less animation.


Though it's off-topic (not Cocoa), SVG is not supported on the  
iPhone's Safari.


--chris



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: notification when app is moved

2008-07-16 Thread Omar Qazi


On Jul 16, 2008, at 6:08 PM, Mitchell Livingston wrote:

I have code that must know where a folder inside the Resources  
folder of the application is. This location must be updated whenever  
the app is moved to another location. Is there some sort of callback  
I can register to receive for this?


Sorry I got confused about what you were trying to say, but if you  
want a resource in your OWN application's bundle you can just use


[[NSBundle mainBundle]pathForResource:@"File" ofType:@"txt"];

and skip that thing I said about NSWorkspace.

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

  1   2   >