Send Cocoa-dev mailing list submissions to
email@hidden
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.apple.com/mailman/listinfo/cocoa-dev
or, via email, send a message with subject or body 'help' to
email@hidden
You can reach the person managing the list at
email@hidden
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Cocoa-dev digest..."
Today's Topics:
1. Re: Crash Reporter for Cocoa Application (Scott Ribe)
2. Re: Crash Reporter for Cocoa Application (John Stiles)
3. Re: How to archive structs like NSRect (Gordon Apple)
4. Re: Adding subviews to a PDFView (Antonio Nunes)
5. Re: Notification when switching Spaces? (Christopher Hickman)
6. Re: Notification when switching Spaces? (Thomas Davie)
7. Re: How to implement an open dialog in a sheet and process
its output? (Nathaniel Gottlieb-Graham)
8. NSCoder blues (was Re: How to archive structs like NSRect)
(David Spooner)
----------------------------------------------------------------------
Message: 1
Date: Mon, 12 Nov 2007 11:03:34 -0700
From: Scott Ribe <email@hidden>
Subject: Re: Crash Reporter for Cocoa Application
To: John Stiles <email@hidden>
Cc: email@hidden
Message-ID: <C35DE386.857E1%email@hidden>
Content-Type: text/plain; charset="US-ASCII"
There's no trick here. Just use Launch Services or NSWorkspace -
openFile: to launch the helper app, and it will be a child of the
window server. This has always been the right way to launch GUI app.
Fork/exec leave the app as a child of your app, causing lots of minor
issues.
I didn't know Launch Services would do that. I suppose it should
have been
obvious, but...
Anyway, I used NSTask. Until (around 10.4.10) it stopped working
with a
mysterious error message on some Macs but not others. I switched to
vfork/exec. But I only to launch a script which calls launchctl and
then
returns--so there is no process left as a child of my app.
I'll look at the other options next time I update anything about this.
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice
------------------------------
Message: 2
Date: Mon, 12 Nov 2007 10:07:23 -0800
From: John Stiles <email@hidden>
Subject: Re: Crash Reporter for Cocoa Application
To: Scott Ribe <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Yeah, you are going the long way around here. NSWorkspace -openFile:
is a one liner and will get rid of a lot of extra hassle for you.
On Nov 12, 2007, at 10:03 AM, Scott Ribe wrote:
There's no trick here. Just use Launch Services or NSWorkspace -
openFile: to launch the helper app, and it will be a child of the
window server. This has always been the right way to launch GUI app.
Fork/exec leave the app as a child of your app, causing lots of
minor
issues.
I didn't know Launch Services would do that. I suppose it should
have been
obvious, but...
Anyway, I used NSTask. Until (around 10.4.10) it stopped working
with a
mysterious error message on some Macs but not others. I switched to
vfork/exec. But I only to launch a script which calls launchctl and
then
returns--so there is no process left as a child of my app.
I'll look at the other options next time I update anything about
this.
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice
------------------------------
Message: 3
Date: Mon, 12 Nov 2007 12:16:25 -0600
From: Gordon Apple <email@hidden>
Subject: Re: How to archive structs like NSRect
To: <email@hidden>
Message-ID: <C35DF499.7AD15%email@hidden>
Content-Type: text/plain; charset="US-ASCII"
That doesn't work. NSKeyedArchiver chokes on it. That's
currently high
on my gripe list. I resorted to class-testing and wrapping NSValues
in
NSData, although I may change to the string approach for rects. I am
thankful that you can now at least archive NSColor with a keyed
archiver. I
wish they would include NSValues. IMHO, if you can put it into an
array or
a dictionary, you should be able to archive it.
BTW, if you take my approach of class-testing be sure and use
"isKindOf", not "isMemberOf", because NSValue is not just a class --
it is a
class cluster. (Found this out the hard way).
Message: 3
Date: Mon, 12 Nov 2007 09:27:33 -0500
From: Hank Heijink <email@hidden>
Subject: Re: How to archive structs like NSRect
To: Andrew Ebling <email@hidden>
Cc: "email@hidden" <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
You can wrap an NSRect in an NSValue, but I just use NSRectToString
and NSStringToRect to make it an object.
Hope that helps,
Hank
On Nov 12, 2007, at 9:12 AM, Andrew Ebling wrote:
------------------------------
Message: 4
Date: Mon, 12 Nov 2007 18:21:39 +0000
From: Antonio Nunes <email@hidden>
Subject: Re: Adding subviews to a PDFView
To: Joel Norvell <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=WINDOWS-1252; format=flowed;
delsp=yes
On 12 Nov 2007, at 17:46, Joel Norvell wrote:
There is a (10.5) sample program called PDFView Subclasser that
shows you how
to subclass PDFView in order to overlay content relative to the PDF
content.
It uses a new 10.5 PDFView method drawPagePost.
That may help you do what you need to do.
<embarrassed-blush-on-cheeks>Duh, I know that example. What was I
thinking?! At any rate I was not remembering to look for anything in
the example project. I'll play around with this. Should get me
there.</
embarrassed-blush-on-cheeks>
Thanks,
Antonio
--------------------------------------------------------
Today you are You, that is truer than true.
There is no one alive who is Youer than You.
Today I am Me, and I am freer than free.
There is no one alive who is Me-er than Me.
I am the BEST I can possibly be.
--Dr. Seuss
--------------------------------------------------------
------------------------------
Message: 5
Date: Mon, 12 Nov 2007 13:27:18 -0500
From: Christopher Hickman <email@hidden>
Subject: Re: Notification when switching Spaces?
Cc: Cocoa-Dev Mail <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
On Nov 11, 2007, at 2:01 AM, Eric Schlegel wrote:
In general, we prefer to use data-driven approaches, where you tell
us in advance what you want to do when a space switch happens
("move this window to the active space", for example), and we take
care of doing it for you. That allows us to keep the space switch
animation fast and fluid, and also allows us to change the space
switch behavior in future releases while still keeping
compatibility with what your app requested.
Okay, so that explains why there is no notification. Now can you
explain why there is no API to actually switch spaces?
------------------------------
Message: 6
Date: Mon, 12 Nov 2007 18:32:23 +0000
From: Thomas Davie <email@hidden>
Subject: Re: Notification when switching Spaces?
To: Christopher Hickman <email@hidden>
Cc: Cocoa-Dev Mail <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
On 12 Nov 2007, at 18:27, Christopher Hickman wrote:
On Nov 11, 2007, at 2:01 AM, Eric Schlegel wrote:
In general, we prefer to use data-driven approaches, where you tell
us in advance what you want to do when a space switch happens
("move this window to the active space", for example), and we take
care of doing it for you. That allows us to keep the space switch
animation fast and fluid, and also allows us to change the space
switch behavior in future releases while still keeping
compatibility with what your app requested.
Okay, so that explains why there is no notification. Now can you
explain why there is no API to actually switch spaces?
Probably a case of applications switching spaces for users would get
incredibly annoying when they started doing things the user didn't
want to happen.
Bob
------------------------------
Message: 7
Date: Mon, 12 Nov 2007 14:30:24 -0500
From: Nathaniel Gottlieb-Graham <email@hidden>
Subject: Re: How to implement an open dialog in a sheet and process
its output?
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Thanks Ron, that was a great help. I now have the following code in
the .m file, but nothing happens when the button I've wired up to this
is clicked on. I know the method is getting called, but the sheet
never appears.
- (IBAction)askForQuickTimeMovieSheet:(id)sender {
NSOpenPanel *panel = [NSOpenPanel openPanel];
NSArray *fileTypes = [NSArray arrayWithObjects:@"mov", @"mp4",
@"avi", nil];
[panel beginSheetForDirectory:@"~Movies/"
file:nil
types:fileTypes
modalForWindow:[welcomeWindow window]
modalDelegate:self
didEndSelector:@selector(filePanelDidEnd:
returnCode:
contextInfo:)
contextInfo:nil];
}
-(void)filePanelDidEnd:(NSOpenPanel*)sheet
returnCode:(int)returnCode
contextInfo:(void*)contextInfo {
// Do stuff here as soon as the sheet displays properly
}
Thanks again,
Nathaniel
Hi Nathaniel,
you're right, it is easy.
First step, look at the documentation for NSOpenPanel. You'll see
the instance method
beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
:. Because it's an instance method, you first create an instance of
NSOpenPanel using the class method + (NSOpenPanel *)openPanel,
which, as the documentation states, creates and returns an
NSOpenPanel instance. For example,
NSOpenPanel *myOpenPanel = [NSOpenPanel openPanel];
So now configure your open panel however you like. Look at the
documentation to find out how.
Then, note the instance method -filenames. Using what you get in
the filenames NSArray, feed your QTMovieView with whatever it needs
to play the movie.
If you need more of an explanation, read the topics referenced at
the top of the NSOpenPanel Class reference document, namely,
"Application File Management" and "Sheet Programming Topics for
Cocoa". The second one is probably what you want to read.
Hope this helps,
Ron
PS. If you don't already have it, I'd recommend Aaron Hillegass'
excellent "Cocoa Programming For Mac OS X" book.
---------------------------------
Nathaniel Gottlieb-Graham
Mac specialist
email@hidden
techpaladin.com
------------------------------
Message: 8
Date: Mon, 12 Nov 2007 12:55:02 -0700
From: David Spooner <email@hidden>
Subject: NSCoder blues (was Re: How to archive structs like NSRect)
To: "Cocoa-Dev (Apple)" <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
I would like to take this opportunity to (respectfully) express my
concerns about the apparent rift in the NSCoder classes.
It would seem that NSArchiver is being deprecated since newer classes
such as NSIndexPath do not implement non-keyed coding and (as Doug
Knowles pointed out) NSPredicate no longer supports non-keyed coding
in 10.5. I think NSKeyedArchiver was a significant step forward in
dealing with legacy coding issues, but there are two significant
problems :
1) NSPortCoder does not support keyed coding
2) NSKeyedArchiver does not provide the same level of support for
non-object types as NSArchiver does
I suspect the problem which Gordon has observed with NSValue is a
consequence of 2, since presumably NSValue's -encodeWithCoder: uses -
encodeValueOfObjCType:at:.
As another example of why 2 is a problem, suppose I have a triangle
mesh object with vertices represented as a c-array of struct {float x,
y, z;}. With an NSArchiver I could encode the vertex array using
either -encodeArrayOfObjCType:count:at: or -
encodeValueOfObjCType:at:. An NSKeyedArchiver throws an exception
when using the non-keyed methods in this situation (although it does
work for simpler c-types such as an array of floats).
I realize that I could encode the vertices as NSData, but in order to
be architecture independent I would have to first use NSArchiver to
create the NSData and then encode the data using -encodeObject:forKey:
-- an arguably unnecessary copy. It would be far preferable to have
a
keyed-coding method -encodeValueOfObjCType:forKey:at: which provides
the functionality which I have come to expect from NSArchiver.
I have filed an enhancement request (5163604) to this effect...
Cheers,
dave
On 12-Nov-07, at 11:16 AM, Gordon Apple wrote:
That doesn't work. NSKeyedArchiver chokes on it. That's
currently high
on my gripe list. I resorted to class-testing and wrapping NSValues
in
NSData, although I may change to the string approach for rects. I am
thankful that you can now at least archive NSColor with a keyed
archiver. I
wish they would include NSValues. IMHO, if you can put it into an
array or
a dictionary, you should be able to archive it.
BTW, if you take my approach of class-testing be sure and use
"isKindOf", not "isMemberOf", because NSValue is not just a class --
it is a
class cluster. (Found this out the hard way).
Message: 3
Date: Mon, 12 Nov 2007 09:27:33 -0500
From: Hank Heijink <email@hidden>
Subject: Re: How to archive structs like NSRect
To: Andrew Ebling <email@hidden>
Cc: "email@hidden" <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
You can wrap an NSRect in an NSValue, but I just use NSRectToString
and NSStringToRect to make it an object.
Hope that helps,
Hank
On Nov 12, 2007, at 9:12 AM, Andrew Ebling wrote:
------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins (at) lists.apple.com
http://lists.apple.com/mailman/listinfo/cocoa-dev
End of Cocoa-dev Digest, Vol 4, Issue 1157
******************************************