Re: problem observing selectionIndex of an array controller

2009-03-08 Thread Ken Thomases

On Mar 8, 2009, at 1:52 AM, Stuart Malin wrote:

I'm trying to watch for changes in the selection of a tableView  
managed by an NSArrayController. I set up an observer:


[mArrayController addObserver:self
forKeyPath:@"selectionIndex"
options:NSKeyValueObservingOptionOld | 
NSKeyValueObservingOptionNew
context:NULL];

When the -observedValueForKeyPath:... method is invoked, the change  
dictionary has entries for the new and old value, but they are both  
NSNull.


According to the NSArrayController docs, the selectionIndex is an  
observable property. Why might I not be getting the index values?


Known bug.  Search for "(Missing) KVO notification old and new values"  
at this page: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html


You'll have to query the property for the new value and keep track of  
any old value yourself.


Regards,
Ken

___

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

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

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

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


Re: problem observing selectionIndex of an array controller

2009-03-08 Thread Stuart Malin


On Mar 7, 2009, at 10:10 PM, Ken Thomases wrote:


On Mar 8, 2009, at 1:52 AM, Stuart Malin wrote:

I'm trying to watch for changes in the selection of a tableView  
managed by an NSArrayController. I set up an observer:


[mArrayController addObserver:self
forKeyPath:@"selectionIndex"
options:NSKeyValueObservingOptionOld | 
NSKeyValueObservingOptionNew
context:NULL];

When the -observedValueForKeyPath:... method is invoked, the change  
dictionary has entries for the new and old value, but they are both  
NSNull.


According to the NSArrayController docs, the selectionIndex is an  
observable property. Why might I not be getting the index values?


Known bug.  Search for "(Missing) KVO notification old and new  
values" at this page: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html


"This bug will not be fixed in the forseeable future."

You'll have to query the property for the new value and keep track  
of any old value yourself.


Yes I will.


Regards,
Ken


Thanks for the quick reply.
___

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

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

2009-03-08 Thread Matthias Arndt
I'm still struggling with the problem to identify a color list / name  
after picking a color with NSColorPanel. It would be easy to solve if  
I could use color catalogs instead of color lists. In [1] the  
following is mentioned about NSColorList:


The color lists returned by the availableColorLists method include  
color catalogs, made up of colors defined in the NSNamedColorSpace  
color space. One example is the System color list, which appears in  
the Mac OS X color panel under the name “Developer.” Note, however,  
that not all named color lists are catalogs. In general, lists  
created at runtime with NSColor and NSColorList methods are not  
catalogs.


Fine, ... "in general" ..., but how to create a color list being a  
catalog? I googled a lot and searched the developer docs and didn't  
find any hint!


Frustrated, Mattes

[1] ___


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

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

2009-03-08 Thread Olivier Palliere



On Mar 8, 2009, at 5:38 AM, Michael Ash wrote:

On Sat, Mar 7, 2009 at 8:30 PM, Ken Thomases   
wrote:

On Mar 7, 2009, at 5:26 PM, Olivier Palliere wrote:

I am working on an application that once started, sets up some  
temporary
files and so. I didn't think of it at first, but I had the case  
where a
friend force quitted the application, and I was left with the app  
not
running, and still my temporary things hanging around. Ultimately,  
this is
ok, as a reboot will clear /tmp, but ideally, I'd like to clear it  
up as

soon as possible.


Do your temp files really need to remain listed in the file  
system?  You can

open/create them and then unlink them.  Your file descriptor (or
NSFileHandle) will remain valid and will be able to access and  
manipulate
the file data, but the file won't be listed in the file system.   
When your
process exits (cleanly or otherwise), the kernel will make sure all  
of your
file descriptors are closed.  In this case, because there are no  
more links
to the file, the closing of the last file descriptor to it will  
cause it to

be deleted.


And if they *really* do need to have a directory entry, your best bet
is probably to spawn a little subprocess when you create the files
that just sits and waits for its parent to die. Once the parent
disappears for any reason, it can delete the files.


Thanks a lot for your insight (both of you)!

This is basically what I did, except that currently my subprocess is  
not daemon capable, as I initially wanted to get that code handled by  
launchd which states *very* clearly that you should not fork or so.


Now it seems the requirements are shifting and I might have, over time  
(but not before another release), to also add a *deny* rule in ipfw  
when my code is running. In that case, if the app dies, then I have a  
bigger problem than just files hanging around ;-) but I'll think about  
this when the time comes.


Many thanks again for the help,
Olivier./.





Mike
___

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

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

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

This email sent to oliv...@sunprotectingfactory.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: NSDrawNinePartImage draws slowly in CALayer

2009-03-08 Thread Sebastian Morsch

Thank you Jean-Daniel for your thoughts on this!


Shark revealed that the most time was spend inside  
NSDrawNinePartImage, so I replaced that function by a self-made  
lightweight version. Here I discovered that most time was spend on  
drawing the center image, which is scaled along both the X and Y axis.  
Luckily I didn't need that for my bezel.


It didn't seem to be a specific problem of CA though. I tried the same  
with a "traditional" non-layer-backed NSView subclass and redrawing  
performance was even worse than with the CALayer.



I still wonder how resizable 9-parts are supposed to be implemented.  
The documentation of NSDrawNinePartImage state that


"you should prefer the use of this function over your own custom code  
for handling multi-part images whose size can change".


(I don't want to rant and rave, I'm just curious...)


Sebastian



Am 06.03.2009 um 20:59 schrieb Jean-Daniel Dupas:



Le 6 mars 09 à 20:42, Jean-Daniel Dupas a écrit :



Le 6 mars 09 à 20:33, Sebastian Morsch a écrit :


Hello,

I wrote a delegate that draws a bezel inside a CALayer using  
NSDrawNinePartImage. The drawing happens inside the  
drawLayer:inContext: method and it works well. The only problem is  
that it redraws really slow when the layers frame is resized by  
the user.


The layer is simply attached to a custom view for testing the  
whole thing. This view is the only view of a window, and when I  
resize that window, my layer is resized too. But it feels very  
clunky.


I was wondering if I'm doing something really stupid here... Does  
anybody know if there's a better way to tackle this?


Thank you!
Sebastian





If you want to know why your code is slow, use the Xcode Debug Menu  
> Launch Using Performance Tool > Shark.




To be exact, this is the Menu

Run > Start With Performance Tool > Shark


Shark will give you better and more accurate answer.

My guess is that you are creating the images at each call, which  
require to read them from disk, and decode them and is very slow.


Just an other details, instead of creating the color at each call,  
you can use CGContextSetRGBFillColor(ctx, 0, 0, 1, .2).


___

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

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

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

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


___

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

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

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

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


Re: NSObjectController selection - now you see it, now you don't

2009-03-08 Thread Keary Suska


On Mar 7, 2009, at 11:05 PM, Luke Evans wrote:

Well, what actually happens is that -selectedObjects almost always  
returns an empty array.  Sending -setContent: does not appear to  
result in this content being available as the selectedObject in the  
way described (or there's other magic to get this to happen?).



- (void)awakeFromNib {
[objController setContent:@"This is a nice string"];
NSArray *selectedObjects = [objController selectedObjects];
	id selectedObject = (selectedObjects && [selectedObjects count])?  
[selectedObjects objectAtIndex:0] : nil;
	NSLog(@"The selectedObjects were: %@,\n the selectedObject was:  
%@", selectedObjects, selectedObject);


[objController setContent:@"Another string"];
selectedObjects = [objController selectedObjects];
	selectedObject = (selectedObjects && [selectedObjects count])?  
[selectedObjects objectAtIndex:0] : nil;
	NSLog(@"The selectedObjects were: %@,\n the selectedObject was:  
%@", selectedObjects, selectedObject);

}


What happens when this is run is that the first time -setContent: is  
used, the -selectedObjects method returns the object (the string).


The second time however, has -selectedObjects return NO object (i.e.  
the empty array).


IIRC, NSObjectController, as a super class has some behavior that  
doesn't make sense to an NSObjectControlelr proper. Because of this it  
is possible that the selection change has been deferred to the run  
loop. You can manually run the run loop to see if this is the case.


It seems to me that there is no need for you to use -selectedObjects  
when there will always be a 1:1 relationship between the controller  
content and the selected object.


HTH,

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

___

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

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

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

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


Making a border-less window is not working

2009-03-08 Thread Gustavo Pizano

Hello,

I have created a custom NSWindow class, there I implemented the method
- (id)initWithContentRect:(NSRect)contentRect styleMask: 
(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType  
defer:(BOOL)deferCreation screen:(NSScreen *)screen

{

I set up the alpha value and the other parameters following the  
example "RoundTransparectWindow" which is in the developer connection.  
Now, in IB, I changed the window to be not a NSWindow but my custom  
window class.


I tried the app, but the window it's still with borders and it's not  
transparent.  I set up a a NSLog(@"intitalizing window") as the first  
code line in the initWithContentRect method, but the console shows  
nothing, so the method its never been called. I dunno what could I  
have missed in the process but I hand;t been able to get it work.


Any clues?


Thanks

Gus


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Making a border-less window is not working

2009-03-08 Thread Benjamin Dobson


On 8 Mar 2009, at 15:40:18, Gustavo Pizano wrote:


Hello,

I have created a custom NSWindow class, there I implemented the method
- (id)initWithContentRect:(NSRect)contentRect styleMask: 
(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType  
defer:(BOOL)deferCreation screen:(NSScreen *)screen

{

I set up the alpha value and the other parameters following the  
example "RoundTransparectWindow" which is in the developer  
connection. Now, in IB, I changed the window to be not a NSWindow  
but my custom window class.


I tried the app, but the window it's still with borders and it's not  
transparent.  I set up a a NSLog(@"intitalizing window") as the  
first code line in the initWithContentRect method, but the console  
shows nothing, so the method its never been called. I dunno what  
could I have missed in the process but I hand;t been able to get it  
work.


Any clues?


Get rid of the screen parameter. That'll fix 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


CoreData and NSObjectController

2009-03-08 Thread Michael Süssner
I have started to experiment with the core data framework and have run  
immediately into a problem.


I have modelled a data entity "Person" and setup a window in IB which  
displays all parameters of a single data record. Then I have added a  
button which calls the add: method of the PersonController Object, IB  
has created.


When I execute the program and click on the add button, the controller  
creates a new data record and I can enter the attributes. If I press  
again the button, the add method is called, but no new record is  
created.


I have subclassed the controller object and learned that the canAdd:  
method returns false after I press the button the second time.


What have I done wrong? Which action does the controller expect?

Any suggestions?
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: CoreData and NSObjectController

2009-03-08 Thread Quincey Morris

On Mar 8, 2009, at 10:14, Michael Süssner wrote:

I have started to experiment with the core data framework and have  
run immediately into a problem.


I have modelled a data entity "Person" and setup a window in IB  
which displays all parameters of a single data record. Then I have  
added a button which calls the add: method of the PersonController  
Object, IB has created.


When I execute the program and click on the add button, the  
controller creates a new data record and I can enter the attributes.  
If I press again the button, the add method is called, but no new  
record is created.


I have subclassed the controller object and learned that the canAdd:  
method returns false after I press the button the second time.


What have I done wrong? Which action does the controller expect?


If you're trying to create multiple Persons, you should be using a  
NSArrayController, not a NSObjectController.


The documentation sort of explains the behavior you're seeing for  
NSObjectController:


	http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/CntrlContent.html#/ 
/apple_ref/doc/uid/TP40002147-183285-BBCDFJHD


(in the second paragraph).___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Making a border-less window is not working

2009-03-08 Thread Gustavo Pizano

AHa ok thanks that fix it, unfortunately it doesn't looks good. :(:(

Gus

On 8.3.2009, at 18:13, Benjamin Dobson wrote:



On 8 Mar 2009, at 15:40:18, Gustavo Pizano wrote:


Hello,

I have created a custom NSWindow class, there I implemented the  
method
- (id)initWithContentRect:(NSRect)contentRect styleMask: 
(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType  
defer:(BOOL)deferCreation screen:(NSScreen *)screen

{

I set up the alpha value and the other parameters following the  
example "RoundTransparectWindow" which is in the developer  
connection. Now, in IB, I changed the window to be not a NSWindow  
but my custom window class.


I tried the app, but the window it's still with borders and it's  
not transparent.  I set up a a NSLog(@"intitalizing window") as the  
first code line in the initWithContentRect method, but the console  
shows nothing, so the method its never been called. I dunno what  
could I have missed in the process but I hand;t been able to get it  
work.


Any clues?


Get rid of the screen parameter. That'll fix 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/gustavxcodepicora%40gmail.com

This email sent to gustavxcodepic...@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: NSObjectController selection - now you see it, now you don't

2009-03-08 Thread Matt Neuburg
On Sat, 7 Mar 2009 22:05:24 -0800, Luke Evans  said:
>I'm a little bamboozled by a discovery I've just presently made.
>
>I was intending using an NSObjectController in one of my classes to
>keep a track of which visible object is selected.  There are reasons
>why I've chosen to have an object controller rather than just a
>"selectedObject" ivar, which aren't important here.

Actually I think those reasons might be quite important here. I could be
wrong, but on the face of it, it sounds like what you're describing is a
total misuse of NSObjectController. So you might need to explain why that
isn't the case. Or, putting it more broadly, it might be helpful if you
described what are these objects, what is meant by selection, and what is it
you're *really* trying to accomplish. 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


CoreData and NSObjectController

2009-03-08 Thread Michael Süssner
I have started to experiment with the core data framework and have run  
immediately into a problem.


I have modelled a data entity "Person" and setup a window in IB which  
displays all parameters of a single data record. Then I have added a  
button which calls the add: method of the PersonController Object, IB  
has created.


When I execute the program and click on the add button, the controller  
creates a new data record and I can enter the attributes. If I press  
again the button, the add method is called, but no new record is  
created.


I have subclassed the controller object and learned that the canAdd:  
method returns false after I press the button the second time.


What have I done wrong? Which action does the controller expect?

Any suggestions?
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: NSObjectController selection - now you see it, now you don't

2009-03-08 Thread Luke Evans

On 8-Mar-09, at 8:38 AM, Keary Suska wrote:

IIRC, NSObjectController, as a super class has some behavior that  
doesn't make sense to an NSObjectControlelr proper. Because of this  
it is possible that the selection change has been deferred to the  
run loop. You can manually run the run loop to see if this is the  
case.


It seems to me that there is no need for you to use -selectedObjects  
when there will always be a 1:1 relationship between the controller  
content and the selected object.



Yes, naturally if I change my selection code to just look at the  
content then indeed everything works fine.   However, see below...
I'm not sure about the run loop thing.  Although I haven't tried this  
in my test app yet, the behaviour in the main app seems to suggest  
that changing the content object never updates the selectedObjects  
array, except perhaps for the very first time.



On 8-Mar-09, at 10:55 AM, Matt Neuburg wrote:

Actually I think those reasons might be quite important here. I  
could be
wrong, but on the face of it, it sounds like what you're describing  
is a
total misuse of NSObjectController. So you might need to explain why  
that
isn't the case. Or, putting it more broadly, it might be helpful if  
you
described what are these objects, what is meant by selection, and  
what is it

you're *really* trying to accomplish. m.


OK, fair enough.  I have a range of controllers (mostly  
NSArrayController, but others too) that are managing the presence,  
ordering, selection of objects visible in various views across the  
app.  I'm now attempting to write a selection controller, "one ring to  
rule them all", that will ensure that there's only one selected object  
in the whole app - as a step toward an application inspector.  I would  
like all selection in the application therefore to be managed by a  
NSObjectController or a subclass, so that I can rely on KVO and a  
common API to obtain selected objects.  I had one view that was doing  
its own drawing of a data structure that didn't have such a controller  
and was therefore looking for the simplest controller that could  
become the local concept of selection there, and would be compatible  
with the uber selection controller.


Reading the docs, NSObjectController seemed to fit the bill here.   
It's the simplest of the concrete controllers, and the bit in the docs  
about it presenting its lone content object as its selection was a  
good fit.  I therefore made an NSObjectCotnroller and had the  
selection gestures do -setContent:, and the drawing code use - 
selectedObjects to determine which of the drawn objects was selected,  
for highlighting.


Anyway, I'm not exactly at an impasse.  I can think of a variety of  
approaches to having achieving what I want, but as usual when these  
things arise, I'm curious whether I'm ignorant (have missed reading  
some docs, unacquainted with some Cocoa 'lore'), if I'm barking  
completely up the wrong tree, or if there's a genuine oddity/defect in  
Cocoa's behaviour.


Failing anything better, I think my next step will be to subclass  
NSObjectController to achieve the behaviour I'm expecting.  I could  
also use NSArrayController, and actually have it connected to the data  
that is already driving the drawing of this view (without a controller  
currently), but that seems a bit heavyweight when all I want to do is  
have something track a single selected object references and present  
the same selectedObjects interface as all the other controllers.


Thanks for the replies so far!

-- lwe
 
___


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

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


CoreImage: bend frame with shadow

2009-03-08 Thread Houdah - ML Pierre Bernard

Hi!

I remember someone posting code to their blog / web site showing how  
to frame a slightly bend image and add a shadow to it: Much like a  
sticker peeling off.


I can't find the link anymore.

Best,
Pierre Bernard

- - -
Houdah Software s. à r. l.
http://www.houdah.com

HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSObjectController selection - now you see it, now you don't

2009-03-08 Thread Keary Suska


On Mar 8, 2009, at 2:20 PM, Luke Evans wrote:

IIRC, NSObjectController, as a super class has some behavior that  
doesn't make sense to an NSObjectControlelr proper. Because of this  
it is possible that the selection change has been deferred to the  
run loop. You can manually run the run loop to see if this is the  
case.


It seems to me that there is no need for you to use - 
selectedObjects when there will always be a 1:1 relationship  
between the controller content and the selected object.



Yes, naturally if I change my selection code to just look at the  
content then indeed everything works fine.   However, see below...
I'm not sure about the run loop thing.  Although I haven't tried  
this in my test app yet, the behaviour in the main app seems to  
suggest that changing the content object never updates the  
selectedObjects array, except perhaps for the very first time.



After setting the content, but before you check selectedObjects, run:

[[NSRunLoop currentRunLoop] runUntilDate:[NSDate date]];

If that works, then you have the runloop issue. Otherwise, it is  
probably a bug and I would file a radar.


Just know that there may be caveats to forcing the runloop like this,  
so caveat programmor.


HTH,

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

___

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

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

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

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


Re: [SOLVED] Trying to understand the cause of a "message sent to deallocated instance" error

2009-03-08 Thread Matt Crocker

Folks,

Thanks to everyone who replied. I always like to find a handy tool  
that I didn't know about before. I missed the arrival of Instruments  
with Leopard, but I'll be using in future...


It turns out that my problem was me being a bit slack with the  
starting and stopping of a QTCaptureSession, which meant that it could  
end up being released when it hadn't actually been started under  
certain circumstances. Seems stupid in hindsight...


Thanks

Matt
___

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

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

2009-03-08 Thread Stuart Malin
I'm building a Preferences window that has a toolbar, in the style of  
Mail. I need to know if the user clicks on a toolbar item to change  
the pane. If the current pane has pending changes, I display a sheet  
asking for action regarding the present changes. I need to do this  
BEFORE the selected toolbar item is changed. Which means I need to  
intercept that change. Alas, I haven't been able to zero in on how to  
do that. I don't see NSToolBar delegate methods that provide such  
intercept (e.g. -(BOOL)shouldChangeToolbarItem or something of the  
like), nor do I see anything useful that I could override if I  
subclass the Toolbar instance. So, I must be overlooking something. If  
anyone can tell me what, I'd be eternally grateful :-)  TIA.

___

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

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


Accessing other UI while keyboard is open

2009-03-08 Thread Miles
How do I still allow the UI to be accessed when the keyboard is open?
I have a textfield and and switch and I want to be able to touch either of
them while the keyboard is still open but it's currently being blocked.

Thanks!
___

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

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

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

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


Re: NSObjectController selection - now you see it, now you don't

2009-03-08 Thread Luke Evans

Hi Keary,

Thanks.  I can confirm that this isn't having any effect in this case.

For now, a simple subclass of NSObjectController that recovers the  
documented behaviour seems to be working satisfactorily for me.


There remains every chance that the documented behaviour I quoted  
isn't the whole story and that NSObjectController isn't meant to work  
the way I'm interpreting the statement about what is returned by - 
selectedObjects from concrete instances of NSObjectController.   
However, the docs look pretty straightforward to me, so I think that  
either they are wrong, or there is indeed a bug in  
NSObjectController.  I'll file with radar, but if someone still has  
any information that can put me right on this one I'd like to know!


-- lwe



On 8-Mar-09, at 2:21 PM, Keary Suska wrote:


After setting the content, but before you check selectedObjects, run:

[[NSRunLoop currentRunLoop] runUntilDate:[NSDate date]];

If that works, then you have the runloop issue. Otherwise, it is  
probably a bug and I would file a radar.


___

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

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


Why don't only these images don't show on the device?

2009-03-08 Thread James Cicenia

Hello -

All my images show except for these:

UIImageView *imageView = [[UIImageView alloc]initWithFrame:  
CGRectMake(30+(horizontalCount*92),15+currentYOffset,30,30)];
[imageView setImage: [UIImage imageNamed:[pName  
stringByAppendingString:@".i.png"]]];

[imageView setTag:100];
[scrollView addSubview:imageView];

However they do show on the simulator. Is there something obvious I am  
missing here?


James Cicenia




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Performance degrades dramatically in [NSManagedObjectContext executeFetchRequest:error:]

2009-03-08 Thread Ben Trumbull

Oleksiy,

NSManagedObjectContext tries to keep the fetch results in sync with  
the pending unsaved changes you've made.  So the more inserted,  
updated, and deleted objects you have that might match the entity  
you're fetching against, the longer it can take to filter unsaved  
changes.


You can issue the fetch against another, clean, MOC and pass the  
results back the the primary MOC via objectIDs, or you can save more  
frequently.


- Ben


Hello All!

(this is the same in plain text)

Summary: It looks like [NSManagedObjectContext  
executeFetchRequest:error:] starts to evaluate a predicate  
([NSPredicate evaluateWithObject:]) with objects that was not  
requested and was not fetched from

a database.

Our application makes prefetching of CoreData entities with  
relationships like


NSFetchRequest* requestRelatedTags = [[[NSFetchRequest alloc] init]  
autorelease];
[requestRelatedTags setEntity:[NSEntityDescription entityForName :  
kFSIValueElementA inManagedObjectContext : [md  
managedObjectContext ]] ];

[requestRelatedTags setFetchLimit: 100 ];
NSPredicate * predicate = [ NSPredicate predicateWithFormat: @"(self  
IN %@)",[items valueForKey: @"objectID"]];

[requestRelatedTags setPredicate:predicate];
[requestRelatedTags setRelationshipKeyPathsForPrefetching :  
[ NSArray arrayWithObjects: @"tags", nil]];

[requestRelatedTags setReturnsObjectsAsFaults: true];
items0_ = [[md managedObjectContext] executeFetchRequest :  
requestRelatedTags error: nil];


where "items" is an array of 100 NSManagedObjects, "tags" is to-many  
relationship of the kFSIValueElementA entity with inverse to-one  
relationship.


At start this code works quickly and takes fixed amount of time  
(0.03-0.04 sec) every time. But at some point it starts to work very  
slowly taking more and more time. Instruments shows that it fetches  
100 objects
every time from a database. But Shark shows that it uses  
[NSPredicate evaluateWithObject:] more and more times. To be  
precise, it invokes [NSPredicate evaluateWithObject:] 100 times more  
every time.
[NSPredicate evaluateWithObject:] is invoked every time from  
[NSManagedObjectContext executeFetchRequest: error:].


We added logging to [NSPredicate evaluateWithObject:] and we see  
that it is evaluated on objets that was not requested by the fetch  
request and was not fetched from the SQLite database. Thus this is a  
bug
in [NSManagedObjectContext executeFetchRequest:error:]. It should  
not filter objects that was not.


Does anybody have any ideas how to solve this problem?

___

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

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

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

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


Re: Why don't only these images don't show on the device?

2009-03-08 Thread James Cicenia

OK -

It seems as though my builds aren't bringing over all my images. How  
can I force the build to include all these images?


Thanks
James


On Mar 8, 2009, at 6:55 PM, James Cicenia wrote:


Hello -

All my images show except for these:

UIImageView *imageView = [[UIImageView alloc]initWithFrame:  
CGRectMake(30+(horizontalCount*92),15+currentYOffset,30,30)];
[imageView setImage: [UIImage imageNamed:[pName  
stringByAppendingString:@".i.png"]]];

[imageView setTag:100];
[scrollView addSubview:imageView];

However they do show on the simulator. Is there something obvious I  
am missing here?


James Cicenia






___

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

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

2009-03-08 Thread Michael Ash
On Sun, Mar 8, 2009 at 6:03 PM, Stuart Malin  wrote:
> I'm building a Preferences window that has a toolbar, in the style of Mail.
> I need to know if the user clicks on a toolbar item to change the pane. If
> the current pane has pending changes, I display a sheet asking for action
> regarding the present changes. I need to do this BEFORE the selected toolbar
> item is changed. Which means I need to intercept that change. Alas, I
> haven't been able to zero in on how to do that. I don't see NSToolBar
> delegate methods that provide such intercept (e.g.
> -(BOOL)shouldChangeToolbarItem or something of the like), nor do I see
> anything useful that I could override if I subclass the Toolbar instance.
> So, I must be overlooking something. If anyone can tell me what, I'd be
> eternally grateful :-)  TIA.

Could you simply reset the toolbar selection to whatever it was
before, then display your sheet and then manually set the selection to
the new one if the user agrees?

Mike
___

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

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

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

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


Method Sequence on Application Loads

2009-03-08 Thread Kenneth Ramey
I am looking for information on the sequence of method invocation as  
an application loads.  For instance, Apple's documentation says that  
awakeFrom Nib is called after the user interface loads but before any  
events have been handled.  I want to create an application that begins  
reading real-time data as soon as possible, without user  
intervention.  Once it gets started, users will be able to interact  
and modify behavior, but the basic functions should begin  
automatically as soon as feasible.


What method do I need to hook for this?

Thanks.
---
Ken Ramey
ramey@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