Re: Custom sheet question - which variable?

2010-01-10 Thread Jerry Krinock

On 2010 Jan 10, at 20:25, Jenny M wrote:

> What I'm trying to do is this. I have a main window with a button to say
> "Create New", and I have an NSWindowController class to handle the
> creation/check/storage of that new object.

Learning your way around the documentation takes awhile, but do it whenever you 
can.  In your Xcode documentation window, in the search field at the top right, 
type "Sheet Programming Topics".  You'll get a wonderful document which will 
explain many things you can't figure out by following sample code.

> I have a separate xib file to
> handle that window and object. But I want the main window to open the 'new
> object' window as a sheet (and in fact I need to have cascading sheets of
> different types).

One of the things you will find in that document is that cascading sheets are 
not supported or desirable.  We had a discussion on an alternative to this, 
presenting sheets serially, a few days ago.  Read the thread "wait for sheet 
result" on this page:

http://lists.apple.com/archives/cocoa-dev/2010/Jan/thrd4.html#00366

> Does this seem possible keeping everything in separate
> xibs with separate controllers?

Yes, you can load a window from any xib you want to, or even create one in 
code, and then attach it to a window as a sheet.

___

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

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

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

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


Need some help with custom views . . .

2010-01-10 Thread Michael A. Crawford
I'm trying to create come custom views with attributes exhibited in this screen 
shot snippet:

files.me.com/michaelacrawford/iy4bhj

I'm looking for suggestions on how I might accomplish some of these effects.  
Here are some ideas I've come up with on my own, some of which I have already 
tried and failed with.  I'd like feedback as to whether or not you think my 
approach will work.

First of all, I'm pretty sure I will need layer back views in order to get the 
clipping (or lack thereof) I want, as well as the shadow effect for the buttons.

For the rounded corners on the app window, I was thinking of creating a 
borderless window and then using cornerRadius property of the layer-backed 
content-view of my main window.

This will require me to provide a replacement for the traffic-light buttons 
that are usually in the upper-left corner along with their standard 
window-manager behaviors, since borderless windows do not sport these elements.

In experiments I've performed thus far, the custom bitmap that provides the 
hatch pattern along the bottom of the view obscures the little diagonal lines 
indicating that the window can be resized by click-dragging the lower-right 
corner.  I will have to draw those lines myself.

As for the hatch pattern, an alternative to using the bitmap image would be for 
me to draw the hatch pattern along with the colors myself.  This way, as the 
main window is resized, the pattern is redrawn as needed.  Currently, I'm using 
NSDrawThreePartImage to get the repeating patter to stretch when the main 
windows is resized.

My first experiment with the big round button has failed in that it is being 
clipped both on the top and the bottom.  On the bottom it is being clipped by 
the app window.  I wasn't too worried about that because I have not yet written 
the code for the borderless window.  The top of the button crosses over the 
upper border of the super-view and is being clipped.  This surprised me as I 
have layer backed views turned on for the button, its super-view, and the view 
containing the button and its super-view.

For the custom views involved I'm setting the masksToBounds property to NO.  
What else do I need to do in order to display clipping by the super-view's 
bounding rectangle?

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


Re: How to know whether property in Cocoa class is KVO-compliant?

2010-01-10 Thread mmalc Crawford

On Jan 10, 2010, at 8:18 pm, Dave Fernandes wrote:

> Look for "Cocoa Bindings Guide" in the docs. It would be nice if it were 
> cross-referenced in every class description. SelectedIndex should work for a 
> segmented control. Haven't tried it myself though.
> 
No; the Cocoa Bindings Reference doesn't catalogue KVO compliance, it lists 
bindings.
In general, controller objects observe model objects, and views observe 
controllers and models -- you typically don't bind to views. Thus you shouldn't 
generally expect views' properties to be observable.

mmalc

___

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

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

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

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


Re: Custom sheet question - which variable?

2010-01-10 Thread Jenny M
Ah! Duh, thanks. So my related question is, I have the NSWindow object is a
separate xib file, and that xib file's "File's Owner" is of a custom
NSWindowController class, so how would I link the window inside the
"NewObject" xib to the main application controller? The Apple documentation
indicates it is possible to have these in separate xib files, but I don't
see how to link them.

What I'm trying to do is this. I have a main window with a button to say
"Create New", and I have an NSWindowController class to handle the
creation/check/storage of that new object. I have a separate xib file to
handle that window and object. But I want the main window to open the 'new
object' window as a sheet (and in fact I need to have cascading sheets of
different types). Does this seem possible keeping everything in separate
xibs with separate controllers?

Thanks...


On Sun, Jan 10, 2010 at 10:26 AM, Hank Heijink (Mailinglists) <
hank.l...@runbox.com> wrote:

> That example assumes you have an instance variable called myCustomSheet in
> your class. You can tell from the method signature of the following method
> (called in the example you refer to) what type it should be:
>
> - (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow
> *)docWindowmodalDelegate:(id)modalDelegate
> didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo
>
> Thus, myCustomSheet is an instance of NSWindow.
>
> Cheers,
> Hank
>
> On Jan 9, 2010, at 9:40 PM, Jenny M wrote:
>
> > Hi, I have what may seem like a very stupid question about custom sheets.
> I
> > am following this Apple dev tutorial:
> >
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingCustomSheets.html
> >
> > and I'm looking at this piece of code here:
> >
> > if (!myCustomSheet)
> >//Check the myCustomSheet instance variable to make sure the custom
> > sheet does not already exist.
> >[NSBundle loadNibNamed: @"MyCustomSheet" owner: self];
> >
> > But, I have no idea what "myCustomSheet" is referring to. I know that
> > "MyCustomSheet" is the separate XIB file, but of what variable type is
> > "myCustomSheet"? Do I need to define and connect to it in the new XIB?
> >
> > 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/hank.list%40runbox.com
> >
> > This email sent to hank.l...@runbox.com
> >
>
>
___

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

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

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

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


Re: How to know whether property in Cocoa class is KVO-compliant?

2010-01-10 Thread Dave Fernandes
Look for "Cocoa Bindings Guide" in the docs. It would be nice if it were 
cross-referenced in every class description. SelectedIndex should work for a 
segmented control. Haven't tried it myself though.

Cheers,
Dave

On 2010-01-10, at 10:58 PM, Jerry Krinock wrote:

> After studying some about bindings during the last week, I decided that, just 
> for fun, I would bind an NSSegmentedControl to its window controller using a 
> binding instead of target/action.  I thought that selectedSegment might be a 
> KVO-compliant property of NSSegmentedControl because it has a 
> -selectedSegment and -setSelectedSegment: method.
> 
> So I exposed a binding named @"foo" in my window controller's +initialize, in 
> -awakeFromNib I added this:
> 
>  [windowController bind:@"foo"
>toObject:segmentedControl
> withKeyPath:@"selectedSegment"
>options:0] ;
> 
> and finally in a "windowWillClose" cleanup method I added an unbind:.
> 
> The above code compiled and ran without any bitchin' from out of the console, 
> and at any time in the program if I send -infoForBinding:@"foo" to 
> windowController, I log the expected result:
> 
> bindingInfo = {
>NSObservedKeyPath = selectedSegment;
>NSObservedObject = ;
>NSOptions = {
>NSMultipleValuesPlaceholder = ;
>NSNoSelectionPlaceholder = ;
>NSNotApplicablePlaceholder = ;
>NSNullPlaceholder = ;
>NSRaisesForNotApplicableKeys = 1;
>NSValueTransformer = ;
>NSValueTransformerName = ;
>};
> }
> 
> But it "just didn't work".  Flipping that segmented control in the user 
> interface never caused my window controller's -setFoo: to run.
> 
> Did I do anything wrong?
> 
> If not, I conclude that NSSegmentedControl's is not KVO-compliant for 
> property 'selectedSegment'.  That is, the class implementation probably 
> changes the view without invoking the setter.
> 
> I changed to target/action and it works fine.
> 
> So how does one know whether a property in Cocoa class is KVO-compliant?  I 
> can't find an answer in the Key-Value Observing Programming Guide.  I thought 
> maybe there's a little point system:
> 
> 1.  Property has a setter and getter; i.e. -bar and -setBar:.  Add 2 points.
> 2.  I remember seeing, every now and then, in newer API documentation, a 
> notation that this "property is observeable", or something like that.  Add 8 
> points.
> 3.  Add 1 point for each Mac OS X dot release that the class first appeared 
> in.  0 points for 10.0, 1 point for 10.1, etc.
> 4.  If the class is a "view layer" class, subtract 2 points.  Most people 
> don't usually bind to view classes.
> 5.  Test it and see if it works.  Add 5 points.  What is the possibility that 
> it could stop working in a future Mac OS X release?
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/dave.fernandes%40utoronto.ca
> 
> This email sent to dave.fernan...@utoronto.ca

___

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

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

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

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


How to know whether property in Cocoa class is KVO-compliant?

2010-01-10 Thread Jerry Krinock
After studying some about bindings during the last week, I decided that, just 
for fun, I would bind an NSSegmentedControl to its window controller using a 
binding instead of target/action.  I thought that selectedSegment might be a 
KVO-compliant property of NSSegmentedControl because it has a -selectedSegment 
and -setSelectedSegment: method.

So I exposed a binding named @"foo" in my window controller's +initialize, in 
-awakeFromNib I added this:

  [windowController bind:@"foo"
toObject:segmentedControl
 withKeyPath:@"selectedSegment"
 options:0] ;

and finally in a "windowWillClose" cleanup method I added an unbind:.

The above code compiled and ran without any bitchin' from out of the console, 
and at any time in the program if I send -infoForBinding:@"foo" to 
windowController, I log the expected result:

bindingInfo = {
NSObservedKeyPath = selectedSegment;
NSObservedObject = ;
NSOptions = {
NSMultipleValuesPlaceholder = ;
NSNoSelectionPlaceholder = ;
NSNotApplicablePlaceholder = ;
NSNullPlaceholder = ;
NSRaisesForNotApplicableKeys = 1;
NSValueTransformer = ;
NSValueTransformerName = ;
};
}

But it "just didn't work".  Flipping that segmented control in the user 
interface never caused my window controller's -setFoo: to run.

Did I do anything wrong?

If not, I conclude that NSSegmentedControl's is not KVO-compliant for property 
'selectedSegment'.  That is, the class implementation probably changes the view 
without invoking the setter.

I changed to target/action and it works fine.

So how does one know whether a property in Cocoa class is KVO-compliant?  I 
can't find an answer in the Key-Value Observing Programming Guide.  I thought 
maybe there's a little point system:

1.  Property has a setter and getter; i.e. -bar and -setBar:.  Add 2 points.
2.  I remember seeing, every now and then, in newer API documentation, a 
notation that this "property is observeable", or something like that.  Add 8 
points.
3.  Add 1 point for each Mac OS X dot release that the class first appeared in. 
 0 points for 10.0, 1 point for 10.1, etc.
4.  If the class is a "view layer" class, subtract 2 points.  Most people don't 
usually bind to view classes.
5.  Test it and see if it works.  Add 5 points.  What is the possibility that 
it could stop working in a future Mac OS X release?


___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Scott Ribe
> Just a quick note: one problem with this is false positives; you don't
> necessarily control all the code that handles the object in question.

I think perhaps you didn't notice that he said "at -dealloc time". There is
no case in which an autorelease pool should have a reference to an object
when the object is being dealloc'd. At all other times of course, there may
be references in autorelease pools which were correctly put there by library
code after a retain.

-- 
Scott Ribe
scott_r...@killerbytes.com
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 arch...@mail-archive.com


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Alex Kac
B) is possible now. I used it a few months ago when debugging a ton of nested 
auto-release pools. I can’t remember the commands right now, but it required 
some stuff at the beginning to turn on auto-release debug support. Then I could 
walk through auto-release pools in the debugger or even NSLog them.

On Jan 10, 2010, at 7:17 PM, Graham Cox wrote:

> 
> On 11/01/2010, at 11:01 AM, Paul Sanders wrote:
> 
>> Have 
>> you got the energy to file an enhancement request Graham?
> 
> 
> Filed: #7528006
> 
> "It would be useful to have available the following two debugging functions:
> 
> a) A way to test whether a given object is referenced by any current 
> autorelease pool.
> b) A way to dump (log) the content of all current autorelease pools.
> 
> One problem with debugging over-release issues is when an object is 
> deallocated but a reference to it remains in an autorelease pool. The later 
> pop of the pool will crash, but information about what object caused the 
> problem is lost unless zombies is on, and even then that tells you very 
> little about where the real problem lies, the answer to which will often be 
> found in the calling stack for the prior release that called -dealloc. 
> 
> The ability to assert on an autorelease pool holding a reference to self at 
> -dealloc time would be a useful weapon in the fight against this sort of bug, 
> without the overhead of running Instruments which is often overkill for this 
> sort of problem, as well as causing performance issues that discourage its 
> use. "
> 
> 
> 
> Please file dupes to help get it noticed, if you think this would be useful.
> 
> --Graham
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net
> 
> This email sent to a...@webis.net

Alex Kac - President and Founder
Web Information Solutions, Inc.

"There will always be death and taxes; however, death doesn't get worse every 
year."
-- Anonymous




___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Chris Parker

On 10 Jan 2010, at 5:17 PM, Graham Cox wrote:

> On 11/01/2010, at 11:01 AM, Paul Sanders wrote:
> 
>> Have 
>> you got the energy to file an enhancement request Graham?
> 
> Filed: #7528006
> 
> "It would be useful to have available the following two debugging functions:
> 
> a) A way to test whether a given object is referenced by any current 
> autorelease pool.
> b) A way to dump (log) the content of all current autorelease pools.
> 
> One problem with debugging over-release issues is when an object is 
> deallocated but a reference to it remains in an autorelease pool. The later 
> pop of the pool will crash, but information about what object caused the 
> problem is lost unless zombies is on, and even then that tells you very 
> little about where the real problem lies, the answer to which will often be 
> found in the calling stack for the prior release that called -dealloc. 
> 
> The ability to assert on an autorelease pool holding a reference to self at 
> -dealloc time would be a useful weapon in the fight against this sort of bug, 
> without the overhead of running Instruments which is often overkill for this 
> sort of problem, as well as causing performance issues that discourage its 
> use. "

Just a quick note: one problem with this is false positives; you don't 
necessarily control all the code that handles the object in question.

You don't know if after handing an object to some other code (e.g. Foundation, 
the AppKit or some other third-party framework you've embedded) if that code 
did a retain/autorelease of its own, properly managing the lifetime for its 
purposes. At that point the object you're interested in is in the autorelease 
pool, but that's nothing to do with you (nor is it your problem). ...and you 
assert anyway.

If Instruments is chowing too much memory for even a mid-size target process, 
then that's worth a bug. Not everyone is running 8GB or more on their 
development machines. :) Bill's weblog post is also a good resource.

You can also write your own dtrace scripts to track messages to 
retain/release/autorelease to your own objects and that can help filter down 
the noise to only those objects of the class which are causing you problems.

.chris

-- 
Chris Parker
iPhone Frameworks
Apple Inc.

___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Graham Cox

On 11/01/2010, at 11:01 AM, Paul Sanders wrote:

>  Have 
> you got the energy to file an enhancement request Graham?


Filed: #7528006

"It would be useful to have available the following two debugging functions:

a) A way to test whether a given object is referenced by any current 
autorelease pool.
b) A way to dump (log) the content of all current autorelease pools.

One problem with debugging over-release issues is when an object is deallocated 
but a reference to it remains in an autorelease pool. The later pop of the pool 
will crash, but information about what object caused the problem is lost unless 
zombies is on, and even then that tells you very little about where the real 
problem lies, the answer to which will often be found in the calling stack for 
the prior release that called -dealloc. 

The ability to assert on an autorelease pool holding a reference to self at 
-dealloc time would be a useful weapon in the fight against this sort of bug, 
without the overhead of running Instruments which is often overkill for this 
sort of problem, as well as causing performance issues that discourage its use. 
"



Please file dupes to help get it noticed, if you think this would be useful.

--Graham


___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Bill Bumgarner
> On Jan 10, 2010, at 4:01 PM, Paul Sanders wrote:
>> It would be extremely simple for Apple to implement this 
>> suggestion and there's no question in my mind that it would 
>> rapidly nail a certain class of bug, so what's to lose?
> 
> Famous last words ;)

All snark aside, I wrote a weblog post detailing how to use tools other than 
Instruments to debug leaks and over-release bugs.

http://www.friday.com/bbum/2010/01/10/using-malloc-to-debug-memory-misuse-in-cocoa/

Some might find it useful.

b.bum
___

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

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

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

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


Re: Custom sheet question - which variable?

2010-01-10 Thread John Joyce

On Jan 10, 2010, at 2:01 PM, cocoa-dev-requ...@lists.apple.com wrote:

> From: Jenny M 
> Subject: Custom sheet question - which variable?
> To: cocoa-dev@lists.apple.com
> Message-ID:
>   
> Content-Type: text/plain; charset=ISO-8859-1
> 
> Hi, I have what may seem like a very stupid question about custom sheets. I
> am following this Apple dev tutorial:
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingCustomSheets.html
> 
> and I'm looking at this piece of code here:
> 
> if (!myCustomSheet)
>//Check the myCustomSheet instance variable to make sure the custom
> sheet does not already exist.
>[NSBundle loadNibNamed: @"MyCustomSheet" owner: self];
> 
> But, I have no idea what "myCustomSheet" is referring to. I know that
> "MyCustomSheet" is the separate XIB file, but of what variable type is
> "myCustomSheet"? Do I need to define and connect to it in the new XIB?
> 
> Thanks.

In this case the documentation is just putting in a quick simple check to 
verify that the sheet is not already displayed before trying to display it.
Since no variable for the sheet is passed to the method, this might seem a 
little strange... the docs here fail to remind you that you should declare 
mySheet (or whatever you want to call it) in your controller you use this in.

(the docs make an assumption that you know this here, but arguably they should 
not. You might consider filing a bug on the documentation to clarify 
it)___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Bill Bumgarner
On Jan 10, 2010, at 4:01 PM, Paul Sanders wrote:
> It would be extremely simple for Apple to implement this 
> suggestion and there's no question in my mind that it would 
> rapidly nail a certain class of bug, so what's to lose?

Famous last words ;)

b.bum
___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Paul Sanders
I think this is a great idea!  I personally find the fact that 
autorelease pools are totally opaque extremely unhelpful.  Have 
you got the energy to file an enhancement request Graham?  I'd 
like to see a method to dump out all the objects in the current 
chain of autoreleasepools, too.

I did read your comments joar.  My own view is that just about 
everybody has a niggly memory-management bug at some point and 
the more help there is available when that happens the better. 
It would be extremely simple for Apple to implement this 
suggestion and there's no question in my mind that it would 
rapidly nail a certain class of bug, so what's to lose?  I took 
a quick peek inside NSAutoreleasePool's iVar's to see if we can 
roll our own, but no obvious help there.  I don't care if any 
viable scheme is supported or not.  It's only for debugging.

On a more philosophical note, I think the current situation for 
many people is that they are scared of over-releasing things. 
Result: memory leaks, so anything that can be done to take some 
of the fear away can only be a good thing.  Of course, GC will 
fix everything...

Paul Sanders.

- Original Message - 
From: "Graham Cox" 
To: "Joar Wingfors" 
Cc: "Cocoa Dev" 
Sent: Sunday, January 10, 2010 11:26 PM
Subject: Re: if statement causing 32 Byte leak?

I think what would be useful is a debugging method that can 
check at dealloc time whether the object is also referenced 
within an autorelease pool. One of the hardest over-release bugs 
to find is when an autorelease pool pops and the object has 
already gone - it might be a long way past where the real 
problem is. Zombies definitely helps with this, but you still 
need a lot of detective work. If at dealloc time you could 
assert on a *future* autorelease crash, that would stop the 
program at the real point of failure.

If there were any way to walk the autorelease pools we could 
write our own, but there doesn't seem to be a supported way to 
do it.



___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Graham Cox

On 11/01/2010, at 10:35 AM, Joar Wingfors wrote:

> I don't really see what that would give you that you don't already have with 
> zombies + memory management history in Instruments? With that functionality 
> so readily available in Instruments, there's really very little detective 
> work left in the common case.


Well, maybe it's my low-end development environment, but I find Instruments 
very painful to use, because it requires so much memory. Most uses take many 
minutes to start up and if the problem is elusive, a great deal of time 
treacling through the app trying to trigger it. If Instruments hits the real 
memory limit, it gets even slower. Basically if you can't trigger the bug 
immediately it's practically useless - but for bugs I can trigger immediately I 
rarely need it to find the problem! Catch-22.

Knowing that the problem is an over-release due to a release + an auto-release, 
zombies can quickly tell me the class in question. Inserting a quick debug 
method into its dealloc method would then allow me to exercise the app in 
normal time until it triggered and the problem should then be immediately 
obvious.

I'm not knocking Instruments, but sometimes you just need a nutcracker, not a 
table-saw.

--Graham


___

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

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

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

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


Re: iCal-style NSTextFields

2010-01-10 Thread Seth Willits

On Jan 10, 2010, at 2:54 PM, Josh Abernathy wrote:

> If you're asking about the shadow, create a child window and move them to 
> that when they're editing.

Oops. My memory of them was foggy. :-)

Borderless child window it is. 


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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Joar Wingfors

On 10 jan 2010, at 15.26, Graham Cox wrote:

> One of the hardest over-release bugs to find is when an autorelease pool pops 
> and the object has already gone - it might be a long way past where the real 
> problem is. Zombies definitely helps with this, but you still need a lot of 
> detective work. If at dealloc time you could assert on a *future* autorelease 
> crash, that would stop the program at the real point of failure.


I don't really see what that would give you that you don't already have with 
zombies + memory management history in Instruments? With that functionality so 
readily available in Instruments, there's really very little detective work 
left in the common case.

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Graham Cox

On 11/01/2010, at 4:43 AM, Joar Wingfors wrote:

>> [pObj release];  // <-- This should assert in a debug context, since it 
>> is already in the current autorelease pool.
> 
> 
> There is nothing wrong with releasing objects that have been added to 
> autorelease pools per se, what could be considered incorrect in this line of 
> code is the ordering of the memory management method calls. They should 
> ideally be called and nested in a logical order where the sum of all current 
> and "future" calls to memory management methods never end up in the negative 
> (unless I forget some use case where that is needed?). At least in theory it 
> would probably be possible to assert that this holds true.


I think what would be useful is a debugging method that can check at dealloc 
time whether the object is also referenced within an autorelease pool. One of 
the hardest over-release bugs to find is when an autorelease pool pops and the 
object has already gone - it might be a long way past where the real problem 
is. Zombies definitely helps with this, but you still need a lot of detective 
work. If at dealloc time you could assert on a *future* autorelease crash, that 
would stop the program at the real point of failure.

If there were any way to walk the autorelease pools we could write our own, but 
there doesn't seem to be a supported way to do it.

--Graham


___

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

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

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

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


Re: iCal-style NSTextFields

2010-01-10 Thread Josh Abernathy
If you're asking about the shadow, create a child window and move them to that 
when they're editing.


On Jan 10, 2010, at 11:56 AM, Seth Willits wrote:

> On Jan 10, 2010, at 11:49 AM, Ulai Beekam wrote:
> 
>> Go into iCal (in Snow Leopard) and create a new event and and then click> 
>> outside that event. Then double-click on that event and hit the "Edit" 
>> button.
>> 
>> In the window you see, you have some neat looking text fields that show> 
>> only text when not in focus but show you a white background with a shadow> 
>> effect when in edit mode.
>> 
>> How can I make such text fields? Does anyone happen to have them ready-made?
> 
> They're just text fields. Change the background color, turn off the border, 
> and make them read-only when not in edit mode. 
> 
> 
> --
> 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/joshaber%40gmail.com
> 
> This email sent to josha...@gmail.com

___

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

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

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

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


Re: Differentiate FAT16 and FAT32

2010-01-10 Thread Matthias Arndt
Alastair,

Am 10.01.2010 um 21:34 schrieb Alastair Houghton:

>> In my app I have to differentiate between USB storage devices formatted with 
>> a MSDOS-FAT16 or with MSDOS-FAT32 file system.
> 
> Because?  Remember that the flavour of FAT in use is defined *entirely* by 
> the number of clusters on the volume... (i.e. it isn't something you can 
> straightforwardly choose).

Right, but when saving an embroidery file from my NSDocument-based app to a 
FAT32-formatted volume I want to present a warning dialog to the user as the 
stick / card may not be recognized by the embroidery machine.

> According to the sources for the FAT filesystem driver (which you can get 
> from ), you can look at f_fssubtype in the 
> statfs structure, which you can retrieve using statfs() or similar.  See man 
> 2 statfs.
> 
> This isn't exactly a Cocoa question, BTW...  you should probably have asked 
> on darwin-dev or one of the other lists.

Thanks for the hint, I will definitely look into statfs and its structure. When 
posting the question I wasn't aware that it's not related to Cocoa: I assumed 
that I may have missed the right framework / class / method ... Sorry!

Matthias ___

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

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

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

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


Re: Differentiate FAT16 and FAT32

2010-01-10 Thread Alastair Houghton
On 10 Jan 2010, at 20:04, Matthias Arndt wrote:

> In my app I have to differentiate between USB storage devices formatted with 
> a MSDOS-FAT16 or with MSDOS-FAT32 file system.

Because?  Remember that the flavour of FAT in use is defined *entirely* by the 
number of clusters on the volume... (i.e. it isn't something you can 
straightforwardly choose).

> Unfortunately both types are reported as "msdos". Is there any way to get the 
> entry size of the used file allocation table? In the Finder every info dialog 
> of a volume contains this information, so I was really surprised finding the 
> mentioned method not differentiating both of them ...

According to the sources for the FAT filesystem driver (which you can get from 
), you can look at f_fssubtype in the statfs 
structure, which you can retrieve using statfs() or similar.  See man 2 statfs.

This isn't exactly a Cocoa question, BTW...  you should probably have asked on 
darwin-dev or one of the other lists.

Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Paul Sanders
Try this, maybe it will help:

http://www.fromconcentratesoftware.com/2007/08/09/nszombieenabled-for-the-debugger-adverse/

I haven't tried this myself, but it looks like you will be able 
to inspect the object in gdb just before it gets zombified. 
Once you know something about the object (i.e. its class and 
instance variables), maybe you will be better equipped to 
investigate where it might be getting over-released.

Paul Sanders.

- Original Message - 
From: "Glenn L. Austin" 
To: "Cocoa Dev" 
Sent: Sunday, January 10, 2010 6:19 PM
Subject: Re: if statement causing 32 Byte leak?


Zombie told us nothing. The project just didn't crash any 
more -- it only told us that the autoreleased object was a 
zombie.  Gee, we already knew that...



___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Scott Ribe
> Actually, it would be nice to have *in a debugging context* since trying to
> track down a pointer that is in the autorelease pool the number of times it
> has been retained when you do a release would be very beneficial.  Yes, it
> would slow things down, but it would sure save a lot of time when trying to
> track down a spurious release!

I just override retain, release, autorelease and set breakpoints on them to
discover what's going on.

-- 
Scott Ribe
scott_r...@killerbytes.com
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 arch...@mail-archive.com


Re: How do I know when a new object is added to an NSArray or NSCollectionView?

2010-01-10 Thread Quincey Morris
On Jan 8, 2010, at 17:02, Brad Stone wrote:

> I'd like a viewController to be notified whenever an arrayController adds a 
> new object.  Here's why:

...

> 1) how do I get notified if a new object is added?


http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/KVOBasics.html

You can observe the "arrangedObjects" property of the array controller, or you 
can observe the same array property in your data model that your 
arrayController is bound to (its "contentArray").

> 2) how do I make the NSTextField in the view that just was added ready and 
> waiting to be typed in?


http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/makeFirstResponder:

All views know what window they're in ([view window]) so it's easy to do both 
#1 and #2 given just a pointer to the view controller and a pointer to the 
array controller.___

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

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

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

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


Differentiate FAT16 and FAT32

2010-01-10 Thread Matthias Arndt
Hi!

I currently stuck, maybe someone can point my into the right direction!

In my app I have to differentiate between USB storage devices formatted with a 
MSDOS-FAT16 or with MSDOS-FAT32 file system. At the moment I use [NSWorkspace 
getFileSystemInfoForPath] to get some information:

BOOL isRemovable;
BOOL isWriteable;
BOOL isUnmountable;
NSString *fileSystemDescription;
NSString *fileSystemType;

[[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:path 
isRemovable  :&isRemovable 
isWritable   :&isWriteable 
isUnmountable:&isUnmountable
description  :&fileSystemDescription
type :&fileSystemType];

Unfortunately both types are reported as "msdos". Is there any way to get the 
entry size of the used file allocation table? In the Finder every info dialog 
of a volume contains this information, so I was really surprised finding the 
mentioned method not differentiating both of them ...

Any hint is appreciated, Matthias


___

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

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

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

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


Re: iCal-style NSTextFields

2010-01-10 Thread Seth Willits
On Jan 10, 2010, at 11:49 AM, Ulai Beekam wrote:

> Go into iCal (in Snow Leopard) and create a new event and and then click> 
> outside that event. Then double-click on that event and hit the "Edit" button.
> 
> In the window you see, you have some neat looking text fields that show> only 
> text when not in focus but show you a white background with a shadow> effect 
> when in edit mode.
> 
> How can I make such text fields? Does anyone happen to have them ready-made?

They're just text fields. Change the background color, turn off the border, and 
make them read-only when not in edit mode. 


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


RE: iCal-style NSTextFields

2010-01-10 Thread Ulai Beekam

No ideas at all? Were my instructions on how to find the iCal text fields that 
I want unclear? Please let me know if that is the case.

> Go into iCal (in Snow Leopard) and create a new event and and then click> 
> outside that event. Then double-click on that event and hit the "Edit" button.
> 
> In the window you see, you have some neat looking text fields that show> only 
> text when not in focus but show you a white background with a shadow> effect 
> when in edit mode.
> 
> How can I make such text fields? Does anyone happen to have them ready-made?
  
_
Windows Live: Make it easier for your friends to see what you’re up to on 
Facebook.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009___

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

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

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

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


Re: [self frame].size.width reporting incorrectly

2010-01-10 Thread Paul Sanders
I don't know if this is relevant, and I have not been following 
this discussion, but an NSTextField is temporarily 'overlayed' 
with an NSTextView (the field editor) while it has keyview 
status.  This is all covered in the docs somewhere.  Maybe there 
is a clue there for you.

OK, I found a relevant link.  Here you go:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextArchitecture/Concepts/TextFieldsAndViews.html

Paul Sanders.

- Original Message - 
From: "PCWiz" 
To: "Joar Wingfors" 
Cc: 
Sent: Sunday, January 10, 2010 5:21 PM
Subject: Re: [self frame].size.width reporting incorrectly


Yep, its definitely the correct text field. Well there are many 
NSTextFields on the screen (each in a collection view item) and 
all of them resize in unison when the window is resized. It 
still is reporting 185 as the width. e.g.:



___

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

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

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

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


Re: Application defaults and toolbar items

2010-01-10 Thread Seth Willits
On Jan 10, 2010, at 10:46 AM, Martin Hewitson wrote:

> Is there a recommended way to handle this situation? Should I just tell the 
> user that they should edit the toolbar to add the new button? Can I do 
> something programatically to add the new button? Advice is very much welcome.


1) Do nothing and/or try to inform them somewhere
2) Delete their toolbar and force the new default on them.
3) Insert the new toolbar item somewhere into the toolbar.


#1 is likely most common.
#2 is asking for complaints.
#3 probably isn't a bad idea if you're certain the majority of users would want 
to use the new item.



(For 2 and 3, you need to save the version number of the app into preferences. 
That way you can compare the current and previous version to know if they've 
launched a new one, and then take some action.)

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


Application defaults and toolbar items

2010-01-10 Thread Martin Hewitson
Dear list,

I'm somewhat confused about the proper way to distribute application updates 
when it comes to the toolbar in the app. The app has a toolbar with is 
configurable, which (I believe) means that the configuration of the toolbar is 
stored in the user's application defaults under 
~/Library/Preferences/com.mystuff.myapp.plist. 

Now, if I issue a new version of the application with a new feature that comes 
with a new toolbar button, this button doesn't appear when the new version is 
launched. In some way this makes sense, but in another way it doesn't. 

Is there a recommended way to handle this situation? Should I just tell the 
user that they should edit the toolbar to add the new button? Can I do 
something programatically to add the new button? Advice is very much welcome.

Best wishes,

Martin


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Bill Bumgarner

On Jan 10, 2010, at 10:29 AM, Glenn L. Austin wrote:

> If Instruments didn't crash on launch of our app, it would have been very 
> helpful.  I use it for my own projects (which aren't quite as large), but it 
> wasn't available for this case.

malloc_history and MallocStackLoggingNoCompact would very likely have worked, 
though.

b.bum

___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Glenn L. Austin
On Jan 10, 2010, at 10:25 AM, Julien Jalon wrote:

> This is the purpose of the zombie instrument. Once you know what object is 
> overreleased, you click on the arrow and voilà, you get the list of 
> retain/release/autorelease so you can look where is the extra one.
> 
> Le 10 janv. 2010 à 19:19, "Glenn L. Austin"  a écrit :
> 
>> Zombie told us nothing. The project just didn't crash any more -- it only 
>> told us that the autoreleased object was a zombie.  Gee, we already knew 
>> that...

If Instruments didn't crash on launch of our app, it would have been very 
helpful.  I use it for my own projects (which aren't quite as large), but it 
wasn't available for this case.

-- 
Glenn L. Austin, Computer Wizard and Race Car Driver <><




___

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

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

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

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


Re: Custom sheet question - which variable?

2010-01-10 Thread Hank Heijink (Mailinglists)
That example assumes you have an instance variable called myCustomSheet in your 
class. You can tell from the method signature of the following method (called 
in the example you refer to) what type it should be:

- (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow 
*)docWindowmodalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector 
contextInfo:(void *)contextInfo

Thus, myCustomSheet is an instance of NSWindow.

Cheers,
Hank

On Jan 9, 2010, at 9:40 PM, Jenny M wrote:

> Hi, I have what may seem like a very stupid question about custom sheets. I
> am following this Apple dev tutorial:
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingCustomSheets.html
> 
> and I'm looking at this piece of code here:
> 
> if (!myCustomSheet)
>//Check the myCustomSheet instance variable to make sure the custom
> sheet does not already exist.
>[NSBundle loadNibNamed: @"MyCustomSheet" owner: self];
> 
> But, I have no idea what "myCustomSheet" is referring to. I know that
> "MyCustomSheet" is the separate XIB file, but of what variable type is
> "myCustomSheet"? Do I need to define and connect to it in the new XIB?
> 
> 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/hank.list%40runbox.com
> 
> This email sent to hank.l...@runbox.com
> 

___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Julien Jalon
This is the purpose of the zombie instrument. Once you know what  
object is overreleased, you click on the arrow and voilà, you get the  
list of retain/release/autorelease so you can look where is the extra  
one.


--
Julien from his iPhone

Le 10 janv. 2010 à 19:19, "Glenn L. Austin"  a  
écrit :


Zombie told us nothing. The project just didn't crash any more -- it  
only told us that the autoreleased object was a zombie.  Gee, we  
already knew that...

___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Glenn L. Austin
On Jan 10, 2010, at 9:25 AM, Julien Jalon wrote:

> You have Instruments for that (ObjectAlloc instrument or Zombie/leaks 
> templates). Also under certain conditions, you have the static analyzer.

There's not a lot of options when running your project causes Instruments (or 
ObjectAlloc) to crash (I'm working on some pretty large projects, and yes, the 
crashes have been reported as bugs).

Zombie told us nothing. The project just didn't crash any more -- it only told 
us that the autoreleased object was a zombie.  Gee, we already knew that...

As far as "the" autorelease pool, yes I know that we can nest them, but I 
really only care about the *current* autorelease pool at the time of the 
release.  Finding the offending release used nested autorelease pools -- the 
problem was something like five levels deep in our calling chain, and was quite 
separated from the "offending" autorelease pool drain in both time and code 
distance.

-- 
Glenn L. Austin, Computer Wizard and Race Car Driver <><




___

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

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

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

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


MFMailComposeViewController issue with not receiving taps

2010-01-10 Thread Brian Pink
Hey,

my goal is to send an email w/attachment from within my app. I have a view with 
a couple UIPickerViews and some buttons on screen. One button triggers this 
code ( as simplified as I can make it and still reproduce the issue )

// mailDialog is a MFMailComposeViewController class variable declared in the 
header

- (void)sendEmail:(id)sender
{
mailDialog = [[MFMailComposeViewController alloc] init];
mailDialog.mailComposeDelegate = self; 
[self presentModalViewController:mailDialog animated:YES];
[mailDialog release];
}

I call this code, the view slides in nicely. I set the Delegate so the Cancel 
button works as expected, and if I set a recipient programmatically it works to 
send the message. Adding content, subject, and even the attachment all work as 
desired. What doesn't happen, is the text fields being editable. You can not 
change the recipients, the subject, or the body. The views seem to be totally 
ignoring my taps.

I am calling this code in my main view controller, as per all the example code 
I could find on this. I think my next things to try are breaking the email 
stuff into a separate class, and then maybe hiding the existing view to see if 
somewhere the tap hierarchy is getting messed up. Any and all 
advice/experience/input is much appreciated.

- brian
___

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

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

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

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


Custom sheet question - which variable?

2010-01-10 Thread Jenny M
Hi, I have what may seem like a very stupid question about custom sheets. I
am following this Apple dev tutorial:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingCustomSheets.html

and I'm looking at this piece of code here:

if (!myCustomSheet)
//Check the myCustomSheet instance variable to make sure the custom
sheet does not already exist.
[NSBundle loadNibNamed: @"MyCustomSheet" owner: self];

But, I have no idea what "myCustomSheet" is referring to. I know that
"MyCustomSheet" is the separate XIB file, but of what variable type is
"myCustomSheet"? Do I need to define and connect to it in the new XIB?

Thanks.
___

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

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

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

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


Supported API for handling bad server certificates in NSURLConnection

2010-01-10 Thread Gordon Henriksen
[This is a faux follow-up to several year-old post in hopes of supplanting in 
Google the widespread information about using the private methods 
allowsAnyHTTPSCertificateForHost: and setAllowsAnyCertificate:forHost: and 
complete lack of information on the supported mechanism for accomplishing the 
same end.]

There is a supported API for ignoring bad certificates! Add something like this 
to your NSURLConnection delegate:

- (BOOL)connection:(NSURLConnection *)connection
canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace 
*)protectionSpace
{
  return [protectionSpace.authenticationMethod 
isEqualToString:NSURLAuthenticationMethodServerTrust];
}

- (void)connection:(NSURLConnection *)connection
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge 
*)challenge
{
  if ([challenge.protectionSpace.authenticationMethod 
isEqualToString:NSURLAuthenticationMethodServerTrust])
if ([trustedHosts containsObject:challenge.protectionSpace.host])
  [challenge.sender useCredential:[NSURLCredential 
credentialForTrust:challenge.protectionSpace.serverTrust]
   forAuthenticationChallenge:challenge];
  
  [challenge.sender 
continueWithoutCredentialForAuthenticationChallenge:challenge];
}

Note that connection:didReceiveAuthenticationChallenge: can send its message to 
challenge.sender (much) later, after presenting a dialog box to the user if 
necessary, etc.

-- 
Gordon Henriksen
Server Software Engineer
Carbonite Inc.
___

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

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

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

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


How do I know when a new object is added to an NSArray or NSCollectionView?

2010-01-10 Thread Brad Stone
I'd like a viewController to be notified whenever an arrayController adds a new 
object.  Here's why:

I have an NSTextField in a view that gets added in an NSCollectionView.  
There's also an array controller and when I fire the "add:" selector the new 
view shows up in the collection.  The view that gets added has an NSTextField 
in it and I want the cursor to be in there and ready so the user can just start 
typing.   So I guess this is a two-part question:
1) how do I get notified if a new object is added?
2) how do I make the NSTextField in the view that just was added ready and 
waiting to be typed in?

Thanks!___

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

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

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

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


Using a NSButtonCell with template image in a NSTableView, through Interface Builder

2010-01-10 Thread Eloy Duran
In Interface Builder, I have set the dataCell of one of the columns of  
my NSTableView instance to be NSButtonCell. This works as expected,  
however, trying to use a ‘template’ image doesn't yield the expected  
visual result when clicking the button.


How I configure the NSButtonCell:
• Image: NSRevealFreestandingTemplate
• Scaling: None
• Bezel: Bevel
• Type: Momentary Push In
• Bordered: false

Expected result when clicking the button:
• Since the image is a ‘template’, the button should render its ‘on’  
state.

• The background, ie the space surrounding the image, should not change.

Actual result when clicking the button:
• No difference in the ‘state’ of the rendered image.
• The background color changes to white.

I've also played with changing the highlightsBy mask of the cell, but  
that didn't yield the expected result either.


Is the approach of using template images in this way even supported?  
(I could not find hard evidence for or against it in the docs.) Or  
should I resort to subclassing and write my own drawing code?


Even-though I’ve tried my best to make the explanation of the problem  
as concise as possible, I’ve also made a simple screencast [1] to  
visually illustrate the problem. And uploaded the demo app [2].


Eloy

[1] http://superalloy.nl/ImageButtonInTableView/ImageButtonInTableView.mov
[2] 
http://superalloy.nl/ImageButtonInTableView/ImageButtonInTableView.zip___

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

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

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

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


Re: NSPopupButton menu not showing in custom view for NSMenuItem

2010-01-10 Thread Daniel Meachum
Thank you Mr. Cox and Mr. Schlegel for your help. I'm using the nsmenuitem view 
to be displayed when clicking a status item (from the menu bar). Would it be 
better to display the view another way? Maybe in a window attached at the point 
of the status item?

On Jan 8, 2010, at 9:21 AM, Graham Cox wrote:

> 
> On 08/01/2010, at 5:48 AM, Eric Schlegel wrote:
> 
>> 
>> On Jan 7, 2010, at 7:16 AM, Daniel Meachum wrote:
>> 
>>> I'm trying to use an NSPopupButton inside of a view nested in an NSMenuItem 
>>> (development for OS X 10.6 only). The menu is created but it refuses to 
>>> popup/out of the button. No Console messages are displayed or UI feedback. 
>>> I originally found the problem while programmatically creating the view but 
>>> also reproduced it in IB with the following steps:
>> 
>> So you're trying to display the menu attached to the NSPopupButton, while 
>> the menu containing the NSPopupButton is open? That won't work - the Menu 
>> Manager doesn't support recursive display of menus.
> 
> 
> Not to mention that this is a travesty of UI design. If you want a submenu of 
> a menu item, why not just use a - uhm, submenu?
> 
> --Graham
> 
> 



___

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

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

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

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


Objective-C class generator for XML Schema

2010-01-10 Thread Rick Lee
Does anyone know of any a good Objective-C class generator for an XML
schema?

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


Re: A password strength checker

2010-01-10 Thread Howard Siegel
Have a look at the source code for KeePass Password Safe (
http://keepass.info/).  It has a password generator and strength
computation. Version 1.x is written in C++ for MS Windows (using MFC).
Version 2.x is a rewrite in C# for .NET.

It has been ported as KeyPassX for Mac OS X and Linux.

- h

On Thu, Jan 7, 2010 at 11:51, Martin Hewitson wrote:

> Dear list,
>
> Is anybody aware of a reasonable algorithm or some code that can be used to
> test/check the strength of a password? I'd like to give a kind of score or a
> color (red,yellow,green). I've looked at cracklib, but that doesn't give a
> score, really.
>
> Best wishes,
>
> Martin
>
> 
> Martin Hewitson
> Albert-Einstein-Institut
> Max-Planck-Institut fuer
>Gravitationsphysik und Universitaet Hannover
> Callinstr. 38, 30167 Hannover, Germany
> Tel: +49-511-762-17121, Fax: +49-511-762-5861
> E-Mail: martin.hewit...@aei.mpg.de
> WWW: http://www.aei.mpg.de/~hewitson 
> 
>
>
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/hsiegel%40gmail.com
>
> This email sent to hsie...@gmail.com
>
___

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

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

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

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


Re: iPhone interruption with OpenAL?

2010-01-10 Thread Hank Heijink (Mailinglists)
Check the docs:

http://developer.apple.com/iphone/library/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/HandlingAudioInterruptions/HandlingAudioInterruptions.html

There's a section called "OpenAL and Audio Interruptions" that explains it.

Good luck,
Hank

On Jan 10, 2010, at 4:23 AM, Chunk 1978 wrote:

> i'm using an interruption listener callback with audiotoolbox to shut
> off music when a call (or something else) comes in to interrupt the
> app.  however, i'd simply like to remove all AVFoundation from the
> code and strictly rely on OpenAL for sound.  will OpenAL automatically
> pause like the rest of the app when a call comes in?  the reason i'm
> asking this simple question is because i don't have an iPhone for
> testing.
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/hank.list%40runbox.com
> 
> This email sent to hank.l...@runbox.com
> 

___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Dave Camp
On Jan 10, 2010, at 9:13 AM, Glenn L. Austin wrote:

> On Jan 10, 2010, at 8:01 AM, Scott Ribe wrote:
> 
>> Also, an isAutoReleased message would be worthless. At any point in time,
>> you have no idea how many times library routines that you've called might
>> have retained/released/autoreleased, nor should you care.
> 
> Actually, it would be nice to have *in a debugging context* since trying to 
> track down a pointer that is in the autorelease pool the number of times it 
> has been retained when you do a release would be very beneficial.  Yes, it 
> would slow things down, but it would sure save a lot of time when trying to 
> track down a spurious release!

"The" autorelease pool? Frequently they nest... and there could be multiple 
pools in each thread.

Dave___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Joar Wingfors

On 10 jan 2010, at 09.13, Glenn L. Austin wrote:

> [pObj release];   // <-- This should assert in a debug context, since it 
> is already in the current autorelease pool.


There is nothing wrong with releasing objects that have been added to 
autorelease pools per se, what could be considered incorrect in this line of 
code is the ordering of the memory management method calls. They should ideally 
be called and nested in a logical order where the sum of all current and 
"future" calls to memory management methods never end up in the negative 
(unless I forget some use case where that is needed?). At least in theory it 
would probably be possible to assert that this holds true.


> // [pObj autorelease] should also probably assert, since it is now in the 
> current autorelease pool twice...


Again, there's nothing wrong with calling autorelease more than once on an 
object before the pool is popped (as long as the calls to autorelease is 
eventually balanced by calls to retain). Like above, I'd still call it a bad 
idea to call these methods "out of order".


> What I ended up doing is progressively creating NSAutoreleasePools, running 
> the code from that routine, then draining that pool until I found the 
> culprit.  Oh the joys of working on a large project with programmers of 
> varying Cocoa skill levels.


I would have suggested that you use the Object Alloc tool in Instruments which 
can be configured to show every alloc, retain, autorelease, release and dealloc 
event for any object. While not as precise and direct as what you suggested, it 
is a very easy and powerful way to troubleshoot this kind of issue. You owe it 
to yourself to make sure you understand how to use Instruments in this way.


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


Re: Landscape view drawing as if in portrait mode

2010-01-10 Thread Ian was here
By releasing the view controller's view and replacing it with a new one, I was 
losing the landscape translate coordinates, causing them to reset to their 
default (portrait).

The solution is to setup the view controller with its default view at startup 
to landscape, then add the desired view as a subview, removing it when a new 
view needs to be added.

Thanks guys.




--- On Sun, 1/3/10, Matt Neuburg  wrote:

> From: Matt Neuburg 
> Subject: Re: Landscape view drawing as if in portrait mode
> To: "Ian was here" 
> Cc: cocoa-dev@lists.apple.com
> Date: Sunday, January 3, 2010, 12:09 PM
> On Thu, 31 Dec 2009 23:49:54 -0800
> (PST), Ian was here 
> said:
> >It works fine when I initially attach a view to the
> view controller, but when
> releasing it and attaching a new view, it screws up.
> 
> There may be some larger misconception at work here. You
> should not be
> "releasing" a view controller's view and "attaching a new
> view". One view
> controller, one view. Let each view controller manage its
> view; you manage
> the view controllers. For a new view, make a new view
> controller. Okay, I've
> said the same thing several different ways now. :)
> 
> Also, it might help to be aware of the discussion we
> (meaning I) just had
> here on the topic of iPhone apps that are autorotated at
> startup. The
> problem here is that loadView / viewDidLoad are too soon to
> do anything
> relating to the interface; you must wait until didRotate...
> arrives (and the
> docs fail to warn of this). m.
> 
> -- 
> matt neuburg, phd = m...@tidbits.com,
> 
> A fool + a tool + an autorelease pool = cool!
> AppleScript: the Definitive Guide - Second Edition!
> http://www.tidbits.com/matt/default.html#applescriptthings
> 
> 
> 
> 


  
___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Julien Jalon
You have Instruments for that (ObjectAlloc instrument or Zombie/leaks  
templates). Also under certain conditions, you have the static analyzer.


--
Julien from his iPhone

Le 10 janv. 2010 à 18:13, "Glenn L. Austin"  a  
écrit :



On Jan 10, 2010, at 8:01 AM, Scott Ribe wrote:

Also, an isAutoReleased message would be worthless. At any point in  
time,
you have no idea how many times library routines that you've called  
might

have retained/released/autoreleased, nor should you care.


Actually, it would be nice to have *in a debugging context* since  
trying to track down a pointer that is in the autorelease pool the  
number of times it has been retained when you do a release would be  
very beneficial.  Yes, it would slow things down, but it would sure  
save a lot of time when trying to track down a spurious release!


e.g.

id pObj = [[[ObjectType alloc] init] autorelease];

... do something here that doesn't retain the pObj, maybe return the  
value to a caller...


[pObj release];// <-- This should assert in a debug context,  
since it is already in the current autorelease pool.


// [pObj autorelease] should also probably assert, since it is now  
in the current autorelease pool twice...



What I ended up doing is progressively creating NSAutoreleasePools,  
running the code from that routine, then draining that pool until I  
found the culprit.  Oh the joys of working on a large project with  
programmers of varying Cocoa skill levels.


--
Glenn L. Austin, Computer Wizard and Race Car Driver <><




___

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

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

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

This email sent to jja...@gmail.com

___

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

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

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

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


Re: [self frame].size.width reporting incorrectly

2010-01-10 Thread PCWiz
Yep, its definitely the correct text field. Well there are many NSTextFields on 
the screen (each in a collection view item) and all of them resize in unison 
when the window is resized. It still is reporting 185 as the width. e.g.:

0x20046df80 Str: "“60 Unique 404 Error Pages” http://is.gd/5X43e (via 
@bluefaqs)", Frame: {{73, 12}, {185, 36}}

Pretty stumped here. The only workaround that works is just getting the size of 
the window, and approximating the size of the text field relative to the 
window, but that's hardly accurate.

Independent Cocoa Developer, Macatomy Software
http://macatomy.com


On 2010-01-09, at 11:09 PM, Joar Wingfors wrote:

> NSLog(@"%p Str: \"%...@\", Frame: %@", self, [self stringValue], 
> NSStringFromRect([self 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 arch...@mail-archive.com


Re: programatically updating UI for NSArrayContoller/NSTableView combo

2010-01-10 Thread mmalc Crawford

On Jan 10, 2010, at 4:57 am, Quincey Morris wrote:

> I'm not sure where to go next with this ...
> 
I would strongly recommend dispensing with bindings for the moment: it's not an 
entry-level technology; it depends on an understanding of the fundamentals of 
Cocoa development including object graph management, key-value coding, and 
key-value observing. I would suggest that it's more fruitful and less 
frustrating to continue to gain experience by building simpler applications 
that use the traditional target-action and delegate/datasource patterns, then 
to return to bindings once you've mastered those.

mmalc

___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Glenn L. Austin
On Jan 10, 2010, at 8:01 AM, Scott Ribe wrote:

> Also, an isAutoReleased message would be worthless. At any point in time,
> you have no idea how many times library routines that you've called might
> have retained/released/autoreleased, nor should you care.

Actually, it would be nice to have *in a debugging context* since trying to 
track down a pointer that is in the autorelease pool the number of times it has 
been retained when you do a release would be very beneficial.  Yes, it would 
slow things down, but it would sure save a lot of time when trying to track 
down a spurious release!

e.g.

id pObj = [[[ObjectType alloc] init] autorelease];

... do something here that doesn't retain the pObj, maybe return the value to a 
caller...

[pObj release]; // <-- This should assert in a debug context, since it is 
already in the current autorelease pool.

// [pObj autorelease] should also probably assert, since it is now in the 
current autorelease pool twice...


What I ended up doing is progressively creating NSAutoreleasePools, running the 
code from that routine, then draining that pool until I found the culprit.  Oh 
the joys of working on a large project with programmers of varying Cocoa skill 
levels.

-- 
Glenn L. Austin, Computer Wizard and Race Car Driver <><




___

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

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

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

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


[MEET] CocoaHeads-NYC this Thursday, 11/12

2010-01-10 Thread Andy Lee
Alex McAuley will give a talk entitled (ahem) "Bad Apple: Classes and Methods 
That Suck".

*NOTE* that we are back to our usual location at Tekserve.

As usual:

(1) Please feel free to bring questions, code, and works in progress.  We have 
a projector and we like to see code and try to help.
(2) We'll have burgers and beer afterwards.
(3) If there's a topic you'd like presented, let us know.
(4) If *you'd* like to give a talk, let me know.

Thursday, January 14
6:00- 8:00
Downstairs at Tekserve, on 23rd between 6th and 7th
 for directions and map
Everyone's welcome.  Just tell the person at the front you're there for 
CocoaHeads.

Hope to see you there!

--Andy

___

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

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

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

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


Re: Enabling NSZombieEnabled programatically

2010-01-10 Thread Ben Haller

On 10-Jan-10, at 8:41 AM, Dave Keck wrote:


After checking the CF sources for 10.5
(http://opensource.apple.com/source/CF/CF-476.19/CFRuntime.c), it
would appear that the check for the NSZombieEnabled environment
variable comes in a GCC constructor. Therefore setting the
NSZombieEnabled environment variable from within your app's image
would be impossible (since the constructors for frameworks you link to
are executed before your own). I suppose you could create a framework
or dynamic library (that doesn't link CF directly or indirectly)
expressly for the purpose of setting the NSZombieEnabled environment
variable, but that's a little crazy.

Furthermore, CF couldn't be checking the NSZombieEnabled global
variable since it's defined in the higher-level Foundation framework.
For this reason, zombies could never be enabled for CF objects by
setting the NSZombieEnabled global in NSDebug.h. Which probably isn't
what you want.

These two facts combined means to my knowledge, there's no better way
to enable zombies than to relaunching your app.

(It would appear that 10.6 introduced _CFEnableZombies(), though...)


  Some old code I have lying around does this:

int main(int argc, const char *argv[]) {
// Catch any autorelease activity
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSArray *arguments = [[NSProcessInfo processInfo] arguments];
NSDebugEnabled = [arguments containsObject:@"-debug"];
NSZombieEnabled = [arguments containsObject:@"-zombies"];
[pool release];
return NSApplicationMain(argc, argv);
}

instead of the standard main() code:

int main(int argc, const char *argv[])
{
return NSApplicationMain(argc, argv);
}

  This used to work (circa 10.4 era); it sounds from Dave's post  
above like it might not work on 10.6 though.  Haven't tried it myself  
any time recently.


Ben Haller
Stick Software


___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Scott Ribe
Also, an isAutoReleased message would be worthless. At any point in time,
you have no idea how many times library routines that you've called might
have retained/released/autoreleased, nor should you care.


-- 
Scott Ribe
scott_r...@killerbytes.com
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 arch...@mail-archive.com


Re: Enabling NSZombieEnabled programatically

2010-01-10 Thread Dave Keck
After checking the CF sources for 10.5
(http://opensource.apple.com/source/CF/CF-476.19/CFRuntime.c), it
would appear that the check for the NSZombieEnabled environment
variable comes in a GCC constructor. Therefore setting the
NSZombieEnabled environment variable from within your app's image
would be impossible (since the constructors for frameworks you link to
are executed before your own). I suppose you could create a framework
or dynamic library (that doesn't link CF directly or indirectly)
expressly for the purpose of setting the NSZombieEnabled environment
variable, but that's a little crazy.

Furthermore, CF couldn't be checking the NSZombieEnabled global
variable since it's defined in the higher-level Foundation framework.
For this reason, zombies could never be enabled for CF objects by
setting the NSZombieEnabled global in NSDebug.h. Which probably isn't
what you want.

These two facts combined means to my knowledge, there's no better way
to enable zombies than to relaunching your app.

(It would appear that 10.6 introduced _CFEnableZombies(), though...)
___

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

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

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

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


Re: programatically updating UI for NSArrayContoller/NSTableView combo

2010-01-10 Thread Quincey Morris
On Jan 10, 2010, at 02:54, Russell Gray wrote:

> As for the two arrays:
> subscriptions
> subscriptionsArray
> 
> subscriptions is the mutable array that subscriptionsArrayContoller is bound 
> to for its content.
> and subscriptionsArray is a mutable array that I use to read/write my plist 
> file. I did this because subscriptions would just return an array of 
> pointers, and not the actual dictionaries contained within the array.(and i 
> did not know of a way to get the dictionaries from the pointers to write to 
> my plist file.) (like I said, still learning here, so maybe not the best 
> approach)

I'm not entirely sure I understand what you're saying, but I suspect you're 
applying a C++ or Java understanding of objects to Objective-C, and that 
doesn't work.

What we *call* an array of Obj-C objects is *really* an array of pointers to 
objects (and a NSArray isn't even an array of pointers in the C sense -- it's a 
kind of array behavior, not an array data structure). In Objective-C, every 
object is a separate memory allocation, and so is always referred to via a 
pointer. The concept of "getting" an object from its pointer doesn't make any 
sense in Obj-C terms.

I'm not sure where to go next with this ...


___

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

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

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

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


Re: Enabling NSZombieEnabled programatically

2010-01-10 Thread Paul Sanders
You could try setting it in a C++ constructor (in a source file 
with extension .mm).  Constructors for statically allocated 
objects run before main.  Typed in mail:

-

class EnableZombies
{
public:

// Constructor
EnableZombies ()
{
setenv ("NSZombieEnabled", "YES", 1);
}
};

static EnableZombies ShaunOfTheDead;

-

Paul Sanders.

On Jan 9, 2010, at 16:54, Graham Cox wrote:

> I'm getting something odd though. If I set NSZombieEnabled 
> during app delegate -applicationDidFinishLaunching: method 
> from my preference, a later deliberate over-release still 
> causes a EXC_BAD_ACCESS. If I set it as an environment 
> variable (Xcode launch arguments for my app) I get the zombie 
> logged as expected. In either case I can see that 
> NSZombieEnabled is YES, but directly setting it doesn't appear 
> to work.
>
> Any idea what I'm doing wrong?



___

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

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

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

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


Re: NSTextView EXC_BAD_ACCESS in deferred layout (RESOLVED)

2010-01-10 Thread jonat...@mugginsoft.com

On 8 Jan 2010, at 11:35, jonat...@mugginsoft.com wrote:

> My GC app has two NSTextViews in two windows.
> Distinct attributed text can loaded into both NSTextView instances.
> 
> The problem test text data size  is 2MB.
> The problem does not manifest itself for smaller data sizes.
> 
> The 2MB test data can be loaded repeatedly into a single NSTextView instance 
> without issue.
> When the same test data is loaded into the second NSTextView instance the 
> crash occurs.
> 
> Obviously NSLayoutManager has initiated deferred layout.
> Do I have to be aware of any particular layout manager issues in this case?
> 
> I am not doing any manipulation of the NSTextView contents.
> The content is established using the following binding.
> 
> [_textView bind:NSAttributedStringBinding 
>  toObject:self 
>   withKeyPath:@"resultString" 
>   options:[NSDictionary dictionaryWithObjectsAndKeys: 
> [NSNumber numberWithBool:YES], NSConditionallySetsEditableBindingOption, 
> nil]];
> 
> 
This issue may be related to garbage collection.
I was initiating [[NSGarbageCollector defaultCollector]collectExhaustively] 
after the end of a particular operation.
Removing this greatly reduced but did not wholly eliminate the problem.

What did have a positive effect was to to configure the NSTextView instances as 
-setAllowsNonContiguousLayout:YES
Presumably this initiates a different code path.

As a precautionary measure I also turned off background layout. 
[[myText layoutManager] setBackgroundLayoutEnabled:NO];

> Crash details follow.
> 
> Thanks
> 
> Jonathan
> 
> Date/Time:   2010-01-08 11:11:32.074 +
> OS Version:  Mac OS X 10.6.2 (10C540)
> Report Version:  6
> 
> Exception Type:  EXC_BAD_ACCESS (SIGBUS)
> Exception Codes: KERN_PROTECTION_FAILURE at 0x017c
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Application Specific Information:
> objc[653]: garbage collection is ON
> 
> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
> 0   com.apple.AppKit  0x92eadd3e -[NSATSGlyphStorage 
> setAbsorbedCount:forIndex:] + 84
> 1   com.apple.CoreText0x95cbf9e3 
> TObjCGlyphStorage::SetAttachmentCount(long, long) + 51
> 2   com.apple.CoreText0x95cbf8b0 long 
> TRun::SetAttachmentsLeftToRight(long, long const*, long) + 402
> 3   com.apple.CoreText0x95cbf6a8 TRun::DeleteGlyphs(long, 
> long const*, long) + 60
> 4   com.apple.CoreText0x95cbf5c1 TLine::DeleteGlyphs(long, 
> long, long const*) + 243
> 5   com.apple.CoreText0x95cab05f 
> TShapingEngine::ShapeGlyphs(TLine&, TCharStream const&) + 647
> 6   com.apple.CoreText0x95cbba47 
> TTypesetterRunArray::TTypesetterRunArray(__CFArray const*, __CFString const*, 
> void const* (*)(__CTRun const*, __CFString const*, void*), void*) + 209
> 7   com.apple.CoreText0x95cbb962 
> CTTypesetterCreateWithRunArray + 90
> 8   com.apple.AppKit  0x92dae76f -[NSATSGlyphStorage 
> createCTTypesetter] + 1585
> 9   com.apple.AppKit  0x92daa8bc -[NSATSTypesetter 
> _ctTypesetter] + 323
> 10  com.apple.AppKit  0x92da994b -[NSATSLineFragment 
> layoutForStartingGlyphAtIndex:characterIndex:minPosition:maxPosition:lineFragmentRect:]
>  + 72
> 11  com.apple.AppKit  0x92da84a4 -[NSATSTypesetter 
> _layoutLineFragmentStartingWithGlyphAtIndex:characterIndex:atPoint:renderingContext:]
>  + 2760
> 12  com.apple.AppKit  0x92e1addf -[NSATSTypesetter 
> layoutParagraphAtPoint:] + 155
> 13  com.apple.AppKit  0x9331ecf0 -[NSTypesetter 
> _layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:maxCharacterIndex:nextGlyphIndex:nextCharacterIndex:]
>  + 2935
> 14  com.apple.AppKit  0x92e19fbe -[NSTypesetter 
> layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:] + 218
> 15  com.apple.AppKit  0x92e19ea2 -[NSATSTypesetter 
> layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:] + 1316
> 16  com.apple.AppKit  0x92e17eb4 -[NSLayoutManager(NSPrivate) 
> _fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] + 1020
> 17  com.apple.AppKit  0x92e8a509 -[NSLayoutManager(NSPrivate) 
> _fillLayoutHoleAtIndex:desiredNumberOfLines:] + 261
> 18  com.apple.AppKit  0x92e8cf9c +[NSLayoutManager(NSPrivate) 
> _doSomeBackgroundLayout] + 927
> 19  com.apple.AppKit  0x92e51af4 _NSPostBackgroundLayout + 562
> 20  com.apple.CoreFoundation  0x95f8b892 __CFRunLoopDoObservers + 1186
> 21  com.apple.CoreFoundation  0x95f483e2 __CFRunLoopRun + 1154
> 22  com.apple.CoreFoundation  0x95f47864 CFRunLoopRunSpecific + 452
> 23  com.apple.CoreFoundation  0x95f47691 CFRunLoopRunInMode + 97
> 24  com.apple.HIToolbox   0x96589f0c RunCurrentEventLoo

Re: Enabling NSZombieEnabled programatically

2010-01-10 Thread Quincey Morris
On Jan 9, 2010, at 16:54, Graham Cox wrote:

> I'm getting something odd though. If I set NSZombieEnabled during app 
> delegate -applicationDidFinishLaunching: method from my preference, a later 
> deliberate over-release still causes a EXC_BAD_ACCESS. If I set it as an 
> environment variable (Xcode launch arguments for my app) I get the zombie 
> logged as expected. In either case I can see that NSZombieEnabled is YES, but 
> directly setting it doesn't appear to work.
> 
> Any idea what I'm doing wrong?

You might be able to search the list archives on this. I have a vague 
recollection (but didn't pay attention at the time) that this question came up 
about 3 months ago, and someone like b.bum chimed in about needing to set the 
global variable early in main () or before main () or something.

Given the behavior you're reporting, the answer is probably in that past thread.


___

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

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

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

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


Re: programatically updating UI for NSArrayContoller/NSTableView combo

2010-01-10 Thread Russell Gray
I have tried modifying subscriptions (in the method openABPFeed:(NSURL*)feed), 
with the following:

[subscriptionsArrayController addObject: subscriptionInfo];
[[self mutableArrayValueForKey: @"subscriptions"] addObject: subscriptionInfo];
[[self mutableArrayValueForKey: @"subscriptions"] insertObject: 
subscriptionInfo atIndex: [subscriptions count]];
[subscriptionsArrayController insertObject: subscriptionInfo 
atArrangedObjectIndex: [[subscriptionsArrayController arrangedObjects] count]];

none of them worked?


you are correct about the following code:
>   int i = 0;
>   for (NSDictionary *child in subscriptionsArray)
>   {
>   NSDictionary* subscriptionsDictionary = 
> [subscriptionsArray objectAtIndex:i];
>   SubscriptionInfo* subscriptionInfo   = 
> [[[SubscriptionInfo alloc] initWithInfoDictionary: subscriptionsDictionary] 
> autorelease];
>   
>   [subscriptions addObject: subscriptionInfo];
>   i++;
>   }


I updated that. thanks. (Obj-C is my first programming language, so i am still 
getting my head around it)

As for the two arrays:
subscriptions
subscriptionsArray

subscriptions is the mutable array that subscriptionsArrayContoller is bound to 
for its content.
and subscriptionsArray is a mutable array that I use to read/write my plist 
file. I did this because subscriptions would just return an array of pointers, 
and not the actual dictionaries contained within the array.(and i did not know 
of a way to get the dictionaries from the pointers to write to my plist file.) 
(like I said, still learning here, so maybe not the best approach)


Russell


On 10/01/2010, at 9:29 AM, mmalc Crawford wrote:

> 
> On Jan 9, 2010, at 2:15 pm, Russell Gray wrote:
> 
>>  [subscriptionsArray addObject:output];
>> 
> You haven't shown where you're modifying 'subscriptions' (apart from in the 
> init method).
> Do you have two arrays that mirror each other, subscriptions and 
> subscriptionsArray?
> Otherwise, if this is a typo (and it's helpful to see the code you're 
> actually using...), then:
> 
> On Jan 9, 2010, at 3:29 am, Quincey Morris wrote:
>> There are two ways you can update the "subscriptions" property 
>> KVO-compliantly:
>> 
> 
> you (Russell) still don't seem to have followed this advice...
> 
> 
> 
> Some of the rest of the code seems somewhat confused.  For example:
> 
>   int i = 0;
>   for (NSDictionary *child in subscriptionsArray)
>   {
>   NSDictionary* subscriptionsDictionary = 
> [subscriptionsArray objectAtIndex:i];
>   SubscriptionInfo* subscriptionInfo   = 
> [[[SubscriptionInfo alloc] initWithInfoDictionary: subscriptionsDictionary] 
> autorelease];
>   
>   [subscriptions addObject: subscriptionInfo];
>   i++;
>   }
> 
> What is the point of the unused child iterator variable? Should your code not 
> look more like:
> 
>   for (NSDictionary *child in subscriptionsArray)
>   {
>   SubscriptionInfo* subscriptionInfo   = 
> [[SubscriptionInfo alloc] initWithInfoDictionary:child];
>   [subscriptions addObject: subscriptionInfo];
>   [subscriptionInfo release];
>   }
> 
> 
> 
> mmalc
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/sweetpproductions%40gmail.com
> 
> This email sent to sweetpproducti...@gmail.com

___

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

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

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

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


Re: Enabling NSZombieEnabled programatically

2010-01-10 Thread Graham Cox
I tried +load, and just before NSApplicationMain() (obviously that's within 
main, not before it), but got the same result.

My +load method was in my NSApplication subclass - maybe that's not the right 
place to put it? I'll peruse the documentation cited when I get a moment, but 
for now the relaunch is acceptable.

--Graham




On 10/01/2010, at 5:53 PM, Stephen J. Butler wrote:

> On Sun, Jan 10, 2010 at 12:36 AM, Ron Fleckner
>  wrote:
>> OK, thanks Dave and Stephen.  I think I'll have to find some documentation
>> which lists the order of function calls at app startup, though, because the
>> documentation for +load doesn't specifically say anything about app startup,
>> just class initialization, which I'm assuming is a different process.  In
>> fact, my uninformed guess is that class initialization would come more or
>> less last in the process of starting an application.  But, that's now my job
>> to find out if I can.
> 
> GCC documentation helps here. For functions with the constructor attribute:
> 
> 
> 
> ""The constructor attribute causes the function to be called
> automatically before execution enters main (). Similarly, the
> destructor attribute causes the function to be called automatically
> after main () has completed or exit () has been called. Functions with
> these attributes are useful for initializing data that will be used
> implicitly during the execution of the program.
> 
> These attributes are not currently implemented for Objective-C. ""
> 
> For Objective-C:
> 
> 
> 
> ""The GNU Objective-C runtime provides a way that allows you to
> execute code before the execution of the program enters the main
> function. The code is executed on a per-class and a per-category
> basis, through a special class method +load.""

___

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

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

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

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


iPhone interruption with OpenAL?

2010-01-10 Thread Chunk 1978
i'm using an interruption listener callback with audiotoolbox to shut
off music when a call (or something else) comes in to interrupt the
app.  however, i'd simply like to remove all AVFoundation from the
code and strictly rely on OpenAL for sound.  will OpenAL automatically
pause like the rest of the app when a call comes in?  the reason i'm
asking this simple question is because i don't have an iPhone for
testing.
___

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

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

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

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


Coloring a Row in a NSTableView.

2010-01-10 Thread Joshua Garnham
What I am looking to do is set the background color of the selected row in an 
NSTableView when a I button is clicked.
I've seen other cases where people have used 
tableView:willDisplayCell:forTableColumn:row: and setBackgroundColor: but I 
don't think that will work in my situation where I want it to happen when a 
button is clicked.

I know that I can find the selected row with NSTableView's selectedRow method 
and set the Background color for a cell with setBackgroundColor:, but what I 
don't know how to do is get from a NSInteger for the selected row to an NSCell 
to set the background color of.
Here's what I have so far:
- (void)tableView:(NSTableView *)aTableView 
  willDisplayCell:(id)aCell 
   forTableColumn:(NSTableColumn *)aTableColumn 
  row:(NSInteger)rowIndex {
NSLog(@"Coloring Method Begun");
int selectedRow = [outlineView selectedRow];
if (selectedRow == nil) {
}else {
if (clicked == YES) {
[aCell setBackgroundColor:[NSColor lightGrayColor]];
clicked = NO;
NSLog(@"Coloring Method Ended");
}else {
}
}
}

- (IBAction)colorize:(id)sender{
NSLog(@"Click Method Begun");
clicked = YES;
NSIndexSet *selectedRowSet = [outlineView selectedRowIndexes];
NSIndexSet *selectedColumnSet = [outlineView selectedColumnIndexes];
[outlineView reloadDataForRowIndexes:selectedRowSet 
columnIndexes:selectedColumnSet];
NSLog(@"Click Method Ended");
}

But it seems that the delegate method is never triggered. 




___

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

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

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

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