NSTrackingArea message lag

2008-06-26 Thread Markus Spoettl

Hello List,

 I have a custom NSView that draws a number of rectangles of  
different heights, overlapping 1 pixel on the left and right edge.  
Each rectangle gets its own tracking area


 NSTrackingAreaOptions opts = (NSTrackingMouseEnteredAndExited |
   NSTrackingActiveInKeyWindow);
 NSDictionary *dict = Dictionary with 2 entries;
 NSTrackingArea *ta = [[NSTrackingArea alloc] initWithRect:rect
   options:opts
 owner:self
  userInfo:dict];
 [self addTrackingArea:ta];

The -mouseEntered and -mouseExited messages are being fired, causing a  
redraw of the view. Everything works nicely with a low number of areas  
(10).


When the number of bars increases to more than 20, there is a visible  
lag between mouse movement and the location that is being redrawn. The  
more areas there are the greater the lag.


The result is that the view redraws an area (highlighting a bar) that  
the mouse passed long ago (up to 1 second and more, depending on the  
bar count).


I have double (quadruple actually) checked that the redrawing is not  
the problem, the view draws very quickly. When the mouse is being  
dragged over the view, the same series of redrawing events is  
completely instant up to a bar count of more than 200. I've even  
completely disabled redrawing as a result of tracking area events and  
the lag is still there. So the drawing is not causing the lag.


My suspicion is that only one (or a very small number) of tracking  
area events are being fired for a view in each run loop cycle (or some  
other limitation with respect to the number of tracking area events  
that can be delivered instantly). That would explain the visible lag  
with greater numbers of areas (thus events). This would explain why  
the events keep coming in in an asynchronous fashion.


I have two questions:

1) Is this a known problem/limitation or is it my fault?

2) Is there a way to cancel tracking area events? Some way to ask the  
system not to fire a tracking event when a new event has arrived prior  
to the delivery of an existing one?


Thanks!

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSString help!

2008-06-26 Thread Bill Bumgarner

On Jun 25, 2008, at 11:05 PM, Omar Qazi wrote:

On Jun 25, 2008, at 10:44 PM, Eric Lee wrote:

Okay, I've done this:

[labelField setstringValue:[textField StringValue]];

However, when I build it, and I type something in and then press  
the button,

the string doesn't show up on the labelField IBOutlet.

How can I resolve this?

Ok, Cocoa is case sensitive. What this means is that stringValue is  
not the same thing as StringValue.


All methods in Cocoa follow the naming convention of starting lower  
case and having each word after that uppercase


likeThis:

So basically, stringValue: and setStringValue: are the methods you  
need to use.


What Omar said.

Let me add one simple rule, though:

If the compiler generates a warning, you are doing it wrong.

The above expression would normally generate two warnings telling you  
that the methods -setstringValue: and StringValue do not exist.   Make  
the warnings go away properly and the problem would be resolved.


The compiler's error and warning messages are often a bit obtuse, but  
it really is trying to help by pointing out code that is very unlikely  
to work at runtime.


b.bum

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

[NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)

2008-06-26 Thread Stéphane Sudre
I'm beginning to wonder if it's possible to save and restore the  
current disclosure state of the hierarchy of a NSOutlineView.


- Iterating the hierarchy does not save the state of hidden children.

- the persistentObject API is not useful in my case as I have  
multiple instances of the same NSOutlineView through multiple  
documents and I don't need/want to keep this piece of information in  
the defaults.


- When asked about this, the NSOutlineView oracle suggested to use  
the notification methods:


- (void)outlineViewItemWillExpand:(NSNotification *)notification;
- (void)outlineViewItemDidExpand:(NSNotification *)notification;
- (void)outlineViewItemWillCollapse:(NSNotification *)notification;
- (void)outlineViewItemDidCollapse:(NSNotification *)notification;

   Unfortunately, this does not work as when you close a branch,  
every child of this branch receives the willCollapse and didCollapse  
notifications (Mac OS X 10.4.11).


Looking for other suggestions (if any left).



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTrackingArea message lag

2008-06-26 Thread Quincey Morris


On Jun 25, 2008, at 23:11, Markus Spoettl wrote:

I have double (quadruple actually) checked that the redrawing is not  
the problem, the view draws very quickly. When the mouse is being  
dragged over the view, the same series of redrawing events is  
completely instant up to a bar count of more than 200. I've even  
completely disabled redrawing as a result of tracking area events  
and the lag is still there. So the drawing is not causing the lag.


These statements are a bit puzzling. What does redrawing mean here?  
Are you talking about what you do inside drawRect:, or what you do to  
cause drawRect: to be invoked? Are you using setNeedsDisplay: or  
setNeedsDisplayInRect: to trigger drawing, or some other technique?


If you literally meant the mouse is being dragged, you weren't  
getting mouseEntered events (they're not sent during dragging unless  
you ask for them, and you didn't ask for them in your tracking area  
options) so what was causing drawing to be requested in that case?


If you really completely disabled redrawing, how were you detecting  
lag? The lag you started out with was between mouse moving and  
redrawing, but if nothing was redrawn ... ?


I'm wondering whether, even when you've suppressed the drawing of  
rectangles, you're still flooding the graphics system with  
setNeedsDisplay... updates, and *that's* what is slowing things down.


P.S. An alternative approach might be to use a single tracking area  
for your entire custom view, and do your own rectangle hit testing on  
mouseMoved events that occur inside 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 [EMAIL PROTECTED]


Re: NSTrackingArea message lag

2008-06-26 Thread Graham Cox
Why do you need to use tracking areas? I doubt that they are designed  
to handle hundreds of small regions. If you are dragging within the  
view, just hit-detect the rects yourself and mark them as needing  
update. If you need that to happen with just the mouse passing over  
the view (button not pressed) you can turn on mouseMoved: events and  
do the same thing.


Tracking events are awkward at the best of times, and are mostly  
intended for cursor management. I think you'd find a more conventional  
approach a lot more fruitful.


hth,

Graham


On 26 Jun 2008, at 4:11 pm, Markus Spoettl wrote:


Hello List,

I have a custom NSView that draws a number of rectangles of  
different heights, overlapping 1 pixel on the left and right edge.  
Each rectangle gets its own tracking area


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie question: error in creating a NSData object using handle (Resource Management)

2008-06-26 Thread Tran Kim Bach


  if((type2 =='PREC')([resID intValue]== 302))


There is a typo in the above code line:It should be:

if((resType1 =='PREC')([resID intValue]== 302))


Regards,
Bachtk
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTrackingArea message lag

2008-06-26 Thread Graham Cox
I'm not saying that's definitely the problem, but to find out for sure  
you'd need to try both and see how if profiles.


Tracking rects are not exactly the same task as testing the rects  
yourself, because the system has to determine when the mouse actually  
enters and exits those areas, package the result into an event and  
dispatch it. It might also be doing this in a way that is constrained  
by time, or only testing one rect per loop, for example (all of which  
would be acceptable ways to reduce the event bandwidth for cursor- 
tracking use). Hit-testing a list of rects within your view should be  
straightforward, fast and optimised to the task in hand.


You didn't say if you were doing this on a mouse drag or a mouse move.  
If on a drag there is no reason to do anything but your own hit- 
testing - it will always be much faster than using events.


Graham



On 26 Jun 2008, at 5:51 pm, Markus Spoettl wrote:


On Jun 26, 2008, at 12:19 AM, Graham Cox wrote:
Why do you need to use tracking areas? I doubt that they are  
designed to handle hundreds of small regions. If you are dragging  
within the view, just hit-detect the rects yourself and mark them  
as needing update. If you need that to happen with just the mouse  
passing over the view (button not pressed) you can turn on  
mouseMoved: events and do the same thing.


Tracking events are awkward at the best of times, and are mostly  
intended for cursor management. I think you'd find a more  
conventional approach a lot more fruitful.



Well, it certainly doesn't sound like that in the guide. There's no  
indication whatsoever that tracking areas are meant for cursor  
rectangle updates only, this is just one way to use them.


The documentation discourages using mouseMoved: events and  
encourages use of tracking areas. I can also see why. If I do it  
using mouseMoved: messages I basically have to do everything that  
tracking areas provide manually. There is no reason why the system's  
implementation should be any slower (it's exactly the same task).  
So, following the documentation, I was convinced that that's the way  
to go.


It appears I stand corrected.

Regards
Markus
--
__
Markus Spoettl



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)

2008-06-26 Thread Manfred Schwind
I'm beginning to wonder if it's possible to save and restore the  
current disclosure state of the hierarchy of a NSOutlineView.


I solved this a while ago. Here is what I am doing:

I am saving in my model if an item is expanded or collapsed. To keep  
the model up-to-date, I am doing the following:


- In outlineViewItemDidExpand: I am setting my expanded flag in the  
model to YES.
- In outlineViewItemWillCollapse: I am checking if the item is  
currently visible and only if it's visible, I set my expanded-flag  
to NO. To check if it is visible I am going up in the hierarchy and  
look if some of the parents is collapsed. If one is not expanded, I do  
not change the expanded flag. E.g. like so:


- (void)outlineViewItemWillCollapse:(NSNotification *)notification
{
ModelItem *item = [[notification userInfo]  
objectForKey:@NSObject];

BOOL visible = YES;
ModelItem *parent = [item parent];
while (parent  parent != root_ item) {
if (![parent getExpandedFlag]) {
visible = NO;
break;
}
parent = [parent parent];
}
if (visible) {
[item setExpandedFlag:NO];
}
}

Finally, to initialize the expansion state of the NSOutlineView items  
at startup, I am doing the following:


- Recursively walk through the hierarchy in the model.
- Get the expanded flag of the current item.
- Before getting down in the hierarchy, call expandItem: for the  
current item.
- Now go down recursively by calling this exansion initialization  
routine for each child.
- Finally (after returning from the recursion) call collapseItem: for  
the current item if its exanded flag (remembered in the second step)  
is set to NO.


Like so:

- (void) initExpansions:(ModelItem *)root
{
ModelItem *child;
BOOL expanded = [root getExpandedFlag];
if (root != root_item) {
[outlineView expandItem:root];
}
for(every child of root) {  // pseudo code!
[self initExpansions:child];// go down recursively
}
if (root != root_item  !expanded) {
[outlineView collapseItem:root];
}
}

Regards,
Mani
--
http://mani.de - friendly software
iVolume - listen to music freehand
LittleSecrets - the encrypted notepad

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTrackingArea message lag

2008-06-26 Thread Markus Spoettl

On Jun 25, 2008, at 11:57 PM, Quincey Morris wrote:
These statements are a bit puzzling. What does redrawing mean  
here? Are you talking about what you do inside drawRect:, or what  
you do to cause drawRect: to be invoked? Are you using  
setNeedsDisplay: or setNeedsDisplayInRect: to trigger drawing, or  
some other technique?


Redrawing means setting needsDisplay. I'm using

if (![self needsDisplay]) {
[self setNeedsDisplayInRect:rect];
}

I found the needsDisplay check to speed it up a little. rect is the  
tracking area.


If you literally meant the mouse is being dragged, you weren't  
getting mouseEntered events (they're not sent during dragging unless  
you ask for them, and you didn't ask for them in your tracking area  
options) so what was causing drawing to be requested in that case?


The drag starts with mouseDown: and ends with mouseUp:. In between you  
get mouseDragged: events. Every time such an event arrives, I update  
the internal selection structure and redraw the view accordingly. It's  
exactly the same drawing operation that happens when the tracking area  
messages fire. The same code is executed (using different colors).


If you really completely disabled redrawing, how were you  
detecting lag? The lag you started out with was between mouse moving  
and redrawing, but if nothing was redrawn ... ?


Instant logging to a NSTextField showing an increasing integer  
counter. As tracking areas events arrive at the view, the counter is  
increased and the field is updated. With a higher number (20+) of  
areas, the counter was not in synch with the mouse movement,  
increasing its value well after the mouse has stopped. That means that  
the mouse movement was not in synch with the tracking area event, so  
tracking area events are delayed for some reason.


I'm wondering whether, even when you've suppressed the drawing of  
rectangles, you're still flooding the graphics system with  
setNeedsDisplay... updates, and *that's* what is slowing things down.


Drawing was suppressed, no call to setNeedsDisplay was made in the  
test. There is no flooding the graphics system, so that's not the case.


P.S. An alternative approach might be to use a single tracking area  
for your entire custom view, and do your own rectangle hit testing  
on mouseMoved events that occur inside it.


As I explained in my reply to Graham Cox, the documentation suggests  
that tracking areas are the way to go. There's no apparent reason for  
me not to trust the documentation and per se no reason why the  
system's implementation should be any slower than my own. I'd just be  
implementing tracking areas myself, checking which rectangle the mouse  
is in at the moment and firing events accordingly.


It appears that I'll have to do this. It's not a problem of  
implementation, I was just wondering if there was a reason for it to  
be lagging.


Also using mouseMoved: events requires you to set  
setAcceptsMouseMovedEvents: on the hosting window. That means the  
window has to do something for all views on it when only this one view  
needs tracking. I thought that was a little overkill. Plus tracking  
areas are really elegant.


Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Issues with addressbook framework

2008-06-26 Thread Papa-Raboon
Aha, fixed it.
Basically if any of you get this same issue with loading a framework the way
I got around it was to delete the framework and the #import line in my code.
Save my file and then re-import the framework, save, re-add my #import
Addressbook/Addressbook.h line and all my addressbook elements of my code
sprung into life.

Schwet

Cheese
Paul

This Cocoa is great to learn once you stat to get the hang of it...



2008/6/26 Papa-Raboon [EMAIL PROTECTED]:

 Hi All,
 I am currently trying to work through a tutorial regarding creating a
 simple app that allows you to enter an address into Apple's Addressbook
 database.

 I added the addresbook framework just as the tutorial explained and saved
 my files and I can see AddressBook.framework there in the source file
 listings under other frameworks where the tutorial suggests I add it but
 whenever I type in anything that should reference this framework like
 ABMutableMultiValue etc it fails to auto complete and it's not recognised
 when I build.

 Has anyone else seen this issue before and how did you get around it?


 Cheers
 Paul



 Paul Randall

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTrackingArea message lag

2008-06-26 Thread Quincey Morris


On Jun 26, 2008, at 00:51, Markus Spoettl wrote:


On Jun 26, 2008, at 12:19 AM, Graham Cox wrote:
Why do you need to use tracking areas? I doubt that they are  
designed to handle hundreds of small regions. If you are dragging  
within the view, just hit-detect the rects yourself and mark them  
as needing update. If you need that to happen with just the mouse  
passing over the view (button not pressed) you can turn on  
mouseMoved: events and do the same thing.


Tracking events are awkward at the best of times, and are mostly  
intended for cursor management. I think you'd find a more  
conventional approach a lot more fruitful.



Well, it certainly doesn't sound like that in the guide. There's no  
indication whatsoever that tracking areas are meant for cursor  
rectangle updates only, this is just one way to use them.


The documentation discourages using mouseMoved: events and  
encourages use of tracking areas. I can also see why. If I do it  
using mouseMoved: messages I basically have to do everything that  
tracking areas provide manually. There is no reason why the system's  
implementation should be any slower (it's exactly the same task).  
So, following the documentation, I was convinced that that's the way  
to go.


Tracking rectangles were perhaps mostly used for dealing with cursors.  
Tracking areas (NSTrackingArea) are useful for more things.


The NSWindow documentation used to (and I suppose still does)  
discourages use of setAcceptMouseMovedEvents. The mouseMoved events  
generated by tracking areas (NSTrackingMouseMoved option) aren't  
discouraged, because they only occur upon movement inside the tracking  
area, and the mouseMoved message is sent directly to the tracking  
area's owner. You do *not* need to setAcceptMouseMovedEvents:YES to  
use these tracking area mouseMoved events. You don't even have to test  
if the event belongs to the view, since you know it does. You just  
have to do a simple rectangle check to find out which of your rects  
you hit (and with your original implementation, don't you still have a  
few lines of code to work out -- from the tracking area in the  
mouseEntered event -- which rectangle was hit?).


Maybe the best way to settle the original question is to profile the  
performance with Instruments, and find out what's really taking up the  
time.



___

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

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

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

This email sent to [EMAIL PROTECTED]


NSWindow setIgnoresMouseEvents and Spaces

2008-06-26 Thread Stefano Pigozzi

Hello,

I'm modding Apple's RoundTransparentWindow sample in order to draw a  
gradient overlay on all the screen (to fix the non uniform lighting on  
my iMac's screen).


The applicazion works quite nicely but when I'm switching to another  
space using the 3d effect method my application doesn't ignores clicks  
anymore. If I switch spaces using hotkeys everything works fine. From  
what I can tell probably the space's 3d effect takes place in the  
NSScreenSaverWindowLevel too, and breaks someway the behaviour of my  
application.


This is taken from my NSWindow:

- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned  
int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag {


NSRect screenRect = [[NSScreen mainScreen] frame];
	self-result = [super initWithContentRect:screenRect  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO];

[result setBackgroundColor: [NSColor clearColor]];
[result setLevel: NSScreenSaverWindowLevel];
[result setAlphaValue:1.0];
[result setOpaque:NO];
[result setHasShadow: NO];
[result setIgnoresMouseEvents: YES];
	[result  
setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];

return result;
}

This NSWindow contains only and NSView where I draw the gradient  
mentioned before.

Anyone can suggest a workaround to make this work?

regards
stefano
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSWindow setIgnoresMouseEvents and Spaces

2008-06-26 Thread Jean-Daniel Dupas


Le 26 juin 08 à 11:26, Stefano Pigozzi a écrit :


Hello,

I'm modding Apple's RoundTransparentWindow sample in order to draw a  
gradient overlay on all the screen (to fix the non uniform lighting  
on my iMac's screen).


The applicazion works quite nicely but when I'm switching to another  
space using the 3d effect method my application doesn't ignores  
clicks anymore. If I switch spaces using hotkeys everything works  
fine. From what I can tell probably the space's 3d effect takes  
place in the NSScreenSaverWindowLevel too, and breaks someway the  
behaviour of my application.


This is taken from my NSWindow:

- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned  
int)aStyle backing:(NSBackingStoreType)bufferingType defer: 
(BOOL)flag {


NSRect screenRect = [[NSScreen mainScreen] frame];
	self-result = [super initWithContentRect:screenRect  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO];

[result setBackgroundColor: [NSColor clearColor]];
[result setLevel: NSScreenSaverWindowLevel];
[result setAlphaValue:1.0];
[result setOpaque:NO];
[result setHasShadow: NO];
[result setIgnoresMouseEvents: YES];
	[result  
setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];

return result;
}

This NSWindow contains only and NSView where I draw the gradient  
mentioned before.

Anyone can suggest a workaround to make this work?

regards
stefano


You can try with an higher window level.

[result setLevel:CGWindowLevelForKey(kCGOverlayWindowLevelKey)];




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSWindow setIgnoresMouseEvents and Spaces

2008-06-26 Thread Stefano Pigozzi


Il giorno 26/giu/08, alle ore 11:56, Jean-Daniel Dupas ha scritto:



Le 26 juin 08 à 11:26, Stefano Pigozzi a écrit :


Hello,

I'm modding Apple's RoundTransparentWindow sample in order to draw  
a gradient overlay on all the screen (to fix the non uniform  
lighting on my iMac's screen).


The applicazion works quite nicely but when I'm switching to  
another space using the 3d effect method my application doesn't  
ignores clicks anymore. If I switch spaces using hotkeys everything  
works fine. From what I can tell probably the space's 3d effect  
takes place in the NSScreenSaverWindowLevel too, and breaks someway  
the behaviour of my application.


This is taken from my NSWindow:

- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned  
int)aStyle backing:(NSBackingStoreType)bufferingType defer: 
(BOOL)flag {


NSRect screenRect = [[NSScreen mainScreen] frame];
	self-result = [super initWithContentRect:screenRect  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO];

[result setBackgroundColor: [NSColor clearColor]];
[result setLevel: NSScreenSaverWindowLevel];
[result setAlphaValue:1.0];
[result setOpaque:NO];
[result setHasShadow: NO];
[result setIgnoresMouseEvents: YES];
	[result  
setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];

return result;
}

This NSWindow contains only and NSView where I draw the gradient  
mentioned before.

Anyone can suggest a workaround to make this work?

regards
stefano


You can try with an higher window level.

[result setLevel:CGWindowLevelForKey(kCGOverlayWindowLevelKey)];





Thanks for the tip, but it doesn't do the trick. I'm stating to think  
it might be a spaces bug. ___


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

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

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

This email sent to [EMAIL PROTECTED]


Can/should UIViewController work with multiple views?

2008-06-26 Thread Aleksandar Vacić


	I'm new to Cocoa and try to learn what are the good ways of developing. 
One thing I'm doubtful is this...


	In the iPhone Simulator, when you load Photos app, it's initially empty 
and displays an image + helpful message. In the app I'm buiding I want 
to do the same thing - if there is nothing to show, display such view, 
otherwise show TableView with existing data.


	I have UINavigationController which loads UIViewController which by 
default loads the table view.


Q is: Where to add the loading of that no-data-yet view?

	At first, I created new ViewController and .xib file with my view and 
on applicationDidFinishLaunching I simply push it to the navigation 
controller. However, this automatically adds the backButton to the root 
view controller. I don't want that - I need the root view controller to 
show either TableView or my simple UIView, depending on conditional check?
	If UIViewController can handle multiple views, can I then add my view 
into RootViewController NIB file and then switch views somewhere in the 
code? If yes, *where* would I do that switch?
	If no, is the path to follow this: do the push, then programmatically 
remove the Back button?


	The navigation controller will have + button at the top, and once new 
data is added, it will return to rootviewcontroller that will load the 
table view.


Thanks
___

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

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

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

This email sent to [EMAIL PROTECTED]


creating 2D graphs

2008-06-26 Thread ªtîf ÇhåµÐh®¥
Hello,
I want to include a graph in my iPhone application.
How should I create and display one similar to that shown in 'Stocks'
application of iPhone. Is there some API available or will I need to draw
those things by using openGL or Quartz?

Thanx,

ªtîƒ ÇhåµÐh(R)¥
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Can/should UIViewController work with multiple views?

2008-06-26 Thread Hamish Allan
On Thu, Jun 26, 2008 at 11:44 AM, Aleksandar Vacić [EMAIL PROTECTED] wrote:

In the iPhone Simulator, when you load Photos app,

iPhone simulator? I have heard tell of such a thing... but Photos app?
I'd imagine anyone with direct experience of anything like that would
be under NDA and therefore at legal risk if they were so much as to
mention it on a public mailing list. Especially one whose FAQ
explicitly states about the iPhone that anyone discussing issues under
non-disclosure will be reported to Apple WWDR.

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]

[MEET] CocoaHeads Aachen Tonight

2008-06-26 Thread Stefan Hafeneger

Hi,

Today is CocoaHeads Aachen meeting. Talks:

- Werner Lonsing, CoreImage: Digital Arts for Cocoa Developer
- Jonathan Diehl, iPhone and SQLight

Afterwards we will do public viewing Soccer EM 2008 semifinal Russia  
vs. Spain.


For more information please visit our website www.cocoaheads.de

With best wishes, Stefan

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Tiff Properties

2008-06-26 Thread Arvind Nayak
Greetings, 

I am working on multipage tiff file. I am writing raw data to NSBitmapImageRep. 
Then getting the TIFFRepresentations to write to a tiff file. 

When I open the file in preview I could see TIFF Properties in the get info 
pane. I would like to set custom properties to describe the image. This is done 
to increase the readability of the image file. I tried to  set the property 
using setProperty: method. But the properties that are set using this method is 
not shown in preview. I can read back the values properly using 
valueForProperty: method. 

How can I set the Tiff Property which can be visible in Get Info pane of 
preview application? Any help is highly appreciated. 

Thanks in advance 
Arvind.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: creating 2D graphs

2008-06-26 Thread Mike Abdullah
endlessly repeated messageThe iPhone SDK is under NDA; you cannot  
discuss it here/endlessly repeated message


On 26 Jun 2008, at 11:56, ªtîf ÇhåµÐh®¥ wrote:


Hello,
I want to include a graph in my iPhone application.
How should I create and display one similar to that shown in 'Stocks'
application of iPhone. Is there some API available or will I need to  
draw

those things by using openGL or Quartz?

Thanx,

ªtîƒ ÇhåµÐh(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/cocoadev%40mikeabdullah.net

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [MODERATOR] Re: sphere in openGL ES ++IRC

2008-06-26 Thread Paul Sargent
On Wed, Jun 25, 2008 at 11:20 PM, Scott Anguish [EMAIL PROTECTED] wrote:

 On Jun 25, 2008, at 4:47 PM, Simon Fleming wrote:

 Dear All,



 Can anyone help me create a sphere in openGL ES for the iphone?



 NO they can't.  The iPhone SDK is covered by a non-disclosure agreement.
  You can't talk about it here, or anywhere else.

Also, it's an OpenGL question that has nothing to do with Cocoa. Ask
questions on a list that relevant to your problem.

I'd suggest writing some OpenGL apps targeted at a normal computer
before worrying about it on the phone.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPredicateEditor

2008-06-26 Thread Kyle Sluder
On Wed, Jun 25, 2008 at 4:12 PM, Peter Ammon [EMAIL PROTECTED] wrote:
 If the holds down the option key and clicks a + button, it will insert
 another compound row, so the user can make arbitrarily complex predicates.

Well this is incredibly undiscoverable UI.  Bug report time!

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


__CGEvent structure

2008-06-26 Thread Stefan Hafeneger

Hi,

I would like to know how the __CGEvent (CGEventRef) struct is defined,  
so if there is any possibility to attach some more data to an low  
level event than through the functions defined CGEvent.h. Any ideas?


With best wishes, Stefan

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSWindow setIgnoresMouseEvents and Spaces

2008-06-26 Thread Gregory Weston

On Jun 26, 2008, at 6:44 AM, [EMAIL PROTECTED] wrote:




This NSWindow contains only and NSView where I draw the gradient
mentioned before.
Anyone can suggest a workaround to make this work?


You can try with an higher window level.

[result setLevel:CGWindowLevelForKey(kCGOverlayWindowLevelKey)];


Thanks for the tip, but it doesn't do the trick. I'm stating to think
it might be a spaces bug.


It is; one of several reproducible misbehaviors Spaces has with  
regard to windows that appear above the normal level. Worse is that  
I expect you'll find if you query the window via ignoresMouseEvents  
you'll find that it claims to still be ignoring the mouse. The only  
workaround I found was to periodically send a  
setIgnoresMouseEvents:YES to it. I *think* 10.5.3 improved the  
situation a little bit, but I haven't had a chance to verify yet.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Adding a new type of NSButton

2008-06-26 Thread I. Savant
 Still, the controller and (more-so) the model layers are
 more application-specific.

  Sorry, a correction - that's backwards. The controller layer tends
to be more application-specific (less-reusable) than the model layer.
I'm still drinking my morning coffee. ;-)

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: __CGEvent structure

2008-06-26 Thread Jean-Daniel Dupas


Le 26 juin 08 à 14:53, Stefan Hafeneger a écrit :


Hi,

I would like to know how the __CGEvent (CGEventRef) struct is  
defined, so if there is any possibility to attach some more data to  
an low level event than through the functions defined CGEvent.h. Any  
ideas?


With best wishes,  
Stefan___


An opaque struct mean… it is opaque. Struct layout is private, can  
change at any time and relying of such implementation details can  
result in executables that are binary incompatible with some OS  
versions. That's to prevent such compatibility issues that struct are  
opaque (and that ivar are all privates in classes).


If there is not accessor to add additional data, so there is no way to  
attach something to a CGEvent.






smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: creating 2D graphs

2008-06-26 Thread Dave DeLong
While the iPhone is under NDA, there are a couple frameworks out there  
for graphing.  Check out http://cocoaheads.byu.edu, where we've been  
collecting all the links we can find.  Search for graph to see what  
we've found.


HTH,

Dave

Sent from my iPod

On Jun 26, 2008, at 4:56 AM, ªtîf ÇhåµÐh®¥  
[EMAIL PROTECTED] wrote:



Hello,
I want to include a graph in my iPhone application.
How should I create and display one similar to that shown in 'Stocks'
application of iPhone. Is there some API available or will I need to  
draw

those things by using openGL or Quartz?

Thanx,

ªtîƒ ÇhåµÐh(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/davedelong% 
40gmail.com


This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Is it possible for several NSURLConnection instances to share one delegate?

2008-06-26 Thread an0
Thank you all. I am going to try what I've learnt from this thread:)

On Thu, Jun 26, 2008 at 12:01 AM, I. Savant [EMAIL PROTECTED] wrote:
 Just to mention, the natural approach would be a dictionary whose
 keys are connection objects with a value being a request, or maybe
 another dictionary with several pieces of info about a connection.
 The problem is that you can't use NSURLConnection objects as keys
 because they aren't copyable.  For that, I recommend using [NSValue
 valueWithNonretainedObject:aConnection] as the key.

  I like Jens' approach better than the on-the -spot solution I concocted. ;-)

 --
 I.S.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Prevent Asynchronous operation of beginSheetModalForWindow

2008-06-26 Thread John Love
Graham,

Still pouring over your thesis .. in process, so let me ask just one thing
at a time, rather than chew here on the whole thing.

(1) learning about anonymous type = (id) .. I make this call within FC:

[iboCalculateSheetCtrl showSheetOnParentWindow:itsWindow
   withDescription:nil
   delegate:self
   contextInfo:sCalculateSheetID];

The delegate here is FileController*, where the delegate received within
SC's showSheetOnParentWindow looks like:

- (void) showSheetOnParentWindow:(NSWindow*)parentWindow
 withDescription:(NSString*)theDescription
 delegate:(id)theTarget
 contextInfo:(void*)contextInfo {

mFileSheetDelegate = theTarget;

// etc.

}

and at the very top:

@implementation CalculateSheetController

id *mFileSheetDelegate;

Within the implementation of showSheetOnParentWindow, I get assignment from
incompatible pointer type with:

mFileSheetDelegate = theTarget;

and later on within this SC's implementation:

- (void) sheetDidEnd:(NSWindow*)sheet
 returnCode:(int)returnCode
 contextInfo:(void*)contextInfo {
[mFileSheetDelegate doSheetSelection:sheet returnCode:returnCode
contextInfo:contextInfo];
}

I get: warning:invalid receiver type 'id' and

no matching doSheetSelection:returnCode:contextInfo.

Based on the invalid .. warning, I understand no matching ...

By the way my FC has the formal doSheetSelection:returnCode:contextInfo
selector or method .. one final thing on this item, I do not really
understand informal protocols, so I have not yet tried to implement such.

John
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Adding a new type of NSButton

2008-06-26 Thread I. Savant
 (By the way, I'm glad Hamish mentioned those buttons on web pages that dim
 when you click them so you won't click them again.  Other than that, the
 only example I could think of for this kind of one-way button was a
 bubble-wrap game where every bubble is implemented as a button.)

  Bubble-wrap game, huh? I *finally* have an idea for an iPhone app!
;-) Too bad there doesn't appear* to be a mechanism to wring the
iPhone to 'pop' all the bubbles at once ...

 How would the central action decide what other action to call?  A switch
 statement?

  Well, yes ... am I a moron for not seeing a better way than that?
:-} You make me question myself!

  I'd put this in that category, and not in the
 category of, say, a skinnable figure-8-shaped 3D slider.

  Fascinating ... do you know of such a control? What is it intended
for? It makes the imagination work overtime and I find myself with a
solution looking for a problem. ;-)

--
I.S.

* Does this technically count as violation of NDA? Any iPhone owner
should know they can't twist / wring their phone without negative
consequences, after all ...
___

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

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

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

This email sent to [EMAIL PROTECTED]


[MODERATOR] Re: Can/should UIViewController work with multiple views?

2008-06-26 Thread Scott Anguish


On Jun 26, 2008, at 6:44 AM, Aleksandar Vacić wrote:



	I'm new to Cocoa and try to learn what are the good ways of  
developing. One thing I'm doubtful is this...


	In the iPhone Simulator, when you load Photos app, it's initially  
empty and displays an image + helpful message. In the app I'm  
buiding I want to do the same thing - if there is nothing to show,  
display such view, otherwise show TableView with existing data.



Discussing NDA Projects (Snow Leopard and iPhone OS) and Private API


This list is not an appropriate forum for the discussion of issues  
that are covered by non-disclosure. This includes Snow Leopard and  
iPhone OS 2.0. Doing so will violate your NDA and the message will be  
forwarded to WWDR.


The discussion of Private API is also not appropriate for this list.  
Using private API is strongly discouraged as it can (and often does)  
change in future software revisions. If you feel some private API  
should be made public contact WWDR directly or file a bug using  
bugreporter.apple.com. Please do not advocate for those changes here,  
it isn't effective.




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Adding a new type of NSButton

2008-06-26 Thread Kevin Elliott


On Jun 26, 2008, at 6:29 AM, I. Savant wrote:

 Sure - if you're using a button in this way in many apps or across
many controllers, there'd be an advantage (I suppose) of reducing it
to one line (to set the disables when on mode), but not much, I'd
argue. Again, this assumes no subclassing is needed for a special
custom appearance.

 I'm envisioning a scenario where, even if there are a dozen such
buttons, they probably all connect to an action in the same controller
(or if they don't, it's easy to make them do so, to funnel all this
special behavior through one action that maybe calls others as
necessary). Consider:

- (IBAction)engageLatch:(id)sender
{
   // Force on and disabled state
   // ...

   // Switch based on the sender and call any
   // necessary additional actions, or flush the toilet, whatever
   // ...
}


The core problem with what your describing is right there.  If you  
have 1 button, in 1 app it works great.  If you have 2 buttons it  
works in the same place it works ok.  If you have 2 buttons in 2  
different places or, even worse, 2 different apps it stinks.  The only  
way to get the code to both places is cut and paste.  Cut and Paste  
automatically moves this idea to the bottom.  Concerns about MVCism  
are completely swamped by having copies of code everywhere.


Even if his scenario matches your description, is a big switch  
statement really a good solution?  Your suggesting that he throw away  
the whole point of the IBAction methodology (sending events to the  
actual method that is going to process them) for what advantage?   
What's he's describing IS view behavior.  It's a type of button.  It's  
not the same type of button as Apple already implements, but it's most  
certainly a button.


You can argue that he should implement his button logic in IBAction  
for pragmatic reasons that he shouldn't go to the trouble of  
subclassing for a control he's only going to use once, but on pure MVC  
ground I don't think you can argue that this isn't part of the view.


-Kevin Elliott
[EMAIL PROTECTED]
DTS Engineer, CoreOS/HW

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Prevent Asynchronous operation of beginSheetModalForWindow

2008-06-26 Thread Nathan Kinsinger


On Jun 26, 2008, at 8:19 AM, John Love wrote:



@implementation CalculateSheetController

id *mFileSheetDelegate;


id is already typed as a pointer, no need to add another level of  
indirection here.


--Nathan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Adding a new type of NSButton

2008-06-26 Thread I. Savant
 Even if his scenario matches your description, is a big switch statement
 really a good solution?  Your suggesting that he throw away the whole point
 of the IBAction methodology (sending events to the actual method that is
 going to process them) for what advantage?  What's he's describing IS view
 behavior.  It's a type of button.  It's not the same type of button as Apple
 already implements, but it's most certainly a button.

  The point is well made - I was discussing this off-list with another
list member and yes, a switch statement in the case of a distinct
action for each button is ridiculous. I am thinking of a situation
where the buttons more or less do the same thing but there is some
small difference. I believe that's why action methods take an id
sender and senders have tags, no?

  Here's what I said:

  Well obviously if you have many distinct actions, that solution
 isn't very attractive. If you have several buttons that do one thing
 and several that do another (totaling two actions), that'd be far
 better, IMO.

  Now if you do have one distinct action for each button, reverse the approach:

 - (void)lockButton:(id)button
 {
// Lock it down, make a crushed glass sound,
// cause vapor to rise from it and liquid to drip,
// make elements beneath it bubble and singe, etc.
 }

 - (IBAction)actionOne:(id)sender
 {
[self lockButton:sender];
[self doSomethingTotallyAwesome];
 }

 - (IBAction)actionTwo:(id)sender
 {
[self lockButton:sender];
[self doSomethingEvenMoreAwesome];
 }

  ...

 You can argue that he should implement his button logic in IBAction for
 pragmatic reasons that he shouldn't go to the trouble of subclassing for a
 control he's only going to use once, but on pure MVC ground I don't think
 you can argue that this isn't part of the view.

  ... 'til I'm blue in the face, I most certainly can. :-) The thing
is, I think like anything turned into a religion, I don't believe
individual interpretations will ever completely agree, but I've made
my point in previous posts and I stand by it (ie, the button already
allows this behavior). Of *course* this is just my opinion
(interpretation) but I stand by it. :-)

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTrackingArea message lag

2008-06-26 Thread Markus Spoettl

On Jun 26, 2008, at 2:01 AM, Quincey Morris wrote:
Tracking rectangles were perhaps mostly used for dealing with  
cursors. Tracking areas (NSTrackingArea) are useful for more things.


The NSWindow documentation used to (and I suppose still does)  
discourages use of setAcceptMouseMovedEvents. The mouseMoved events  
generated by tracking areas (NSTrackingMouseMoved option) aren't  
discouraged, because they only occur upon movement inside the  
tracking area, and the mouseMoved message is sent directly to the  
tracking area's owner. You do *not* need to  
setAcceptMouseMovedEvents:YES to use these tracking area mouseMoved  
events. You don't even have to test if the event belongs to the  
view, since you know it does. You just have to do a simple rectangle  
check to find out which of your rects you hit (and with your  
original implementation, don't you still have a few lines of code to  
work out -- from the tracking area in the mouseEntered event --  
which rectangle was hit?).



I must have overlooked the -mouseMoved: feature of tracking areas.  
I've now changed from multiple tracking areas to one big area covering  
the entire view. Doing the rectangle checks myself the view is as  
responsive as expected. Thanks for pointing me in the right direction!


Regards
Markus
--
__
Markus Spoettl

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSSpeechSynthesizer and empty strings

2008-06-26 Thread David Brennan
Hi,

I have a cocoa app that is using NSSpeechSynthesizer to speak the
contains of a NSString to a file. My problem is when it is passed an
empty string, - (BOOL)isSpeaking returns true. So I don't know when it
is finished.

If NSSpeechSynthesizer has nothing to say, I want to create an audio
file with 1 second of silence.

Any help with this would be great.

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


Re: NSSpeechSynthesizer and empty strings

2008-06-26 Thread I. Savant
 If NSSpeechSynthesizer has nothing to say, I want to create an audio
 file with 1 second of silence.

  Maybe I'm misunderstanding the problem, but how about ...

  if ([myString isEqualToString:@])
  {
// Record silence into file ...
  } else {
// Send string to speech synthesizer
  }

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Moderator] List Guidelines - Must Read

2008-06-26 Thread Hamish Allan
On Thu, Jun 26, 2008 at 4:51 PM, Scott Anguish [EMAIL PROTECTED] wrote:

 Discussing NDA Projects (Snow Leopard and iPhone OS) and Private API
 

 This list is not an appropriate forum for the discussion of issues that are
 covered by non-disclosure. This includes Snow Leopard and iPhone OS 2.0.
 Doing so will violate your NDA and the message will be forwarded to WWDR.

Making these general posts repeatedly seems to me to be pretty futile.
Those who post iPhone questions here are presumably those who have
signed up five minutes beforehand for the purpose. The fact that they
post without reading the FAQ or performing even a cursory search of
the archives indicates, to my mind, that they are unlikely to read the
above before posting, even if they have received it. I think the only
people who end up reading it are those who already know the rules
(someone correct me if I'm wrong!)

What we really need is for the cocoa-dev list admin page to require
new subscribers to type in the phrase I will not make posts about the
iPhone or Snow Leopard :)

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSpeechSynthesizer and empty strings

2008-06-26 Thread David Brennan
Hi,

I have just come up with solution. I add a silence to the start of the
string. Therefore NSSpeechSynthesizer will always have something to
say.

NSString *tempString = @[[inpt PHON]]%[[inpt TEXT]];
tempString = [tempString stringByAppendingString:[inputText string]];

Regards,
Dave.

2008/6/26 I. Savant [EMAIL PROTECTED]:
 If NSSpeechSynthesizer has nothing to say, I want to create an audio
 file with 1 second of silence.

  Maybe I'm misunderstanding the problem, but how about ...

  if ([myString isEqualToString:@])
  {
// Record silence into file ...
  } else {
// Send string to speech synthesizer
  }

 --
 I.S.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: PDFKit guidance

2008-06-26 Thread Torsten Curdt

OK, guys thanks for the help so far. I've played a bit.

The subclassing of PDFDocument and PDFPage was quite straight forward.  
(Although unexpected as usually everyone tells you usually you don't  
subclass in Cocoa land) Just out of curiosity I've just compiled it  
with the 10.4 SDK and it compiled just fine. So I guess it will just  
not work on 10.4 although it has compiled successfully?


(I am on Leopard still targeting Tiger. That's why)

Well, in a very crude fashion you can still accomplish what it is I  
think you;re trying to accomplish.  You're subclassed PDFPage's  
could, on Tiger, render a regular PDFPage.  It's gross but what I'm  
describing is basically having two parallel PDFDocuments — one  
created from a file or data ([PDFDocument initWithURL:] or  
[PDFDocument initWithData:]) and the other empty PDFDocument you  
create with -[init].  For each page in the former document you  
create a new PDFPageSubclass object and add it to the empty  
document.  Your subclass does the various scaling/filtering in it's  
draw method and calls it's doppleganger PDFPage to render.


So I said it was gross


Hm ...indeed

So should rather look into the CGPDFDocumentRefs (/Developer/Examples/ 
Quartz/PDF/CGPDFViewer) way of doing it?


cheers
--
Torsten___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Good mouse tracking design for dynamic view?

2008-06-26 Thread Douglas Davidson


On Jun 26, 2008, at 11:20 AM, Nathan Vander Wilt wrote:

So it seems I need to do more bookwork myself, but I'm wondering  
which direction others would recommend:
a) Set up a single tracking area for the whole view, and perform all  
my own hit testing every time the mouse moves.
b) Keep the per-item tracking areas, but perform my own testing in  
the edge cases when active (mouse has entered but not exited)  
tracking areas are getting reset.


Even though it seems like I'd be reimplementing something Cocoa  
already offers, I'm leaning towards option A: I'm not sure if I'll  
be able to foresee all the edge cases, and I'd be reinventing half  
the hit testing code there anyway.
Does it sound reasonable from a maintenance and performance  
perspective to handle the mouse on my own inside my view? It seems  
like the tracking Cocoa provides is designed for more static  
content, or am I just missing the intended Option C recipe for my  
scenario?


If your hit testing is not too time-consuming, it is quite possible to  
do it on every mouse move.  Individual tracking areas are convenient  
if you don't have your own hit-testing mechanism set up, but if you  
are able to do it efficiently yourself, you certainly may do so.


Douglas Davidson

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: PDFKit guidance

2008-06-26 Thread Douglas Davidson


On Jun 26, 2008, at 11:54 AM, Torsten Curdt wrote:

The subclassing of PDFDocument and PDFPage was quite straight  
forward. (Although unexpected as usually everyone tells you usually  
you don't subclass in Cocoa land)


I think what we usually say is:  don't make subclassing your first  
resort.  Try configuration, composition, delegation, or notification  
before subclassing; but if those don't cover your particular  
situation, as often happens, most Cocoa classes are designed with  
subclassing in mind.  Subclassing is more powerful and more dangerous  
than those other mechanisms, and often more work, so it should be  
reserved for those cases where it is necessary, but it should be  
available to you when you need it.


Douglas Davidson
___

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

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

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

This email sent to [EMAIL PROTECTED]


Outline View and Bindings

2008-06-26 Thread Gabriel Shahbazian
I have some bindings set up that work perfect well with a Table View  
(3 column) but when I try and use the Outline View it fails to display  
the data. Is there something different you need to do with the  
bindings or does it simply not work with Outline View?


Thanks
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSSpeechSynthesizer and a speech dictionary

2008-06-26 Thread David Brennan
Hi

How do I create a speech dictionary for NSSpeechSynthesizer. I would
like to be able to save the speech dictionary to file, and then load
it into my NSSpeechSynthesizer object using -
(void)addSpeechDictionary:(NSDictionary *)speechDictionary.

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


Re: Good mouse tracking design for dynamic view?

2008-06-26 Thread Greg Titus


On Jun 26, 2008, at 11:56 AM, Douglas Davidson wrote:



On Jun 26, 2008, at 11:20 AM, Nathan Vander Wilt wrote:

So it seems I need to do more bookwork myself, but I'm wondering  
which direction others would recommend:
a) Set up a single tracking area for the whole view, and perform  
all my own hit testing every time the mouse moves.
b) Keep the per-item tracking areas, but perform my own testing in  
the edge cases when active (mouse has entered but not exited)  
tracking areas are getting reset.


Even though it seems like I'd be reimplementing something Cocoa  
already offers, I'm leaning towards option A: I'm not sure if I'll  
be able to foresee all the edge cases, and I'd be reinventing half  
the hit testing code there anyway.
Does it sound reasonable from a maintenance and performance  
perspective to handle the mouse on my own inside my view? It seems  
like the tracking Cocoa provides is designed for more static  
content, or am I just missing the intended Option C recipe for my  
scenario?


If your hit testing is not too time-consuming, it is quite possible  
to do it on every mouse move.  Individual tracking areas are  
convenient if you don't have your own hit-testing mechanism set up,  
but if you are able to do it efficiently yourself, you certainly may  
do so.


What we tend to do when we do hit-testing via mouse move is to also  
calculate and cache the rect within which the current state is valid.  
So then at the very top of your hit testing you can do a quick test:  
is the mouse still within the same area it was before? If so, don't  
need to do anything and return quickly. This can make hit testing a  
lot more efficient if you have complicated content.


- Greg
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Good mouse tracking design for dynamic view?

2008-06-26 Thread Quincey Morris


On Jun 26, 2008, at 11:20, Nathan Vander Wilt wrote:

Even though it seems like I'd be reimplementing something Cocoa  
already offers, I'm leaning towards option A: I'm not sure if I'll  
be able to foresee all the edge cases, and I'd be reinventing half  
the hit testing code there anyway.
Does it sound reasonable from a maintenance and performance  
perspective to handle the mouse on my own inside my view? It seems  
like the tracking Cocoa provides is designed for more static  
content, or am I just missing the intended Option C recipe for my  
scenario?


There's a subtlety (or there was, and I haven't retested this in  
10.5.2 or 10.5.3) that makes tracking areas annoying if you have to  
keep recreating them.


When you create a tracking area there's no event to tell you where the  
mouse is relative to the tracking area. If you *don't* specify the  
[misleadingly-named] assume inside option, there's no mouseEntered  
event until the mouse enters the area (meaning that if it's inside  
when you create the area you have to move out and in before you see an  
event). If you *do* specify the assume inside option, there's no  
mouseEntered event until the mouse moves.


IOW, when you create a tracking area you have to the hit testing work  
manually -- if it matters to your application -- until at least the  
mouse moves. If you go that far, you may as well do the work all the  
time and make the tracking area static and view-sized as an aid to  
filtering out mouse movement that doesn't belong the view.


(That's a point of view, not a dogged assertion.)


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Outline View and Bindings

2008-06-26 Thread Quincey Morris


On Jun 26, 2008, at 12:03, Gabriel Shahbazian wrote:

I have some bindings set up that work perfect well with a Table View  
(3 column) but when I try and use the Outline View it fails to  
display the data. Is there something different you need to do with  
the bindings or does it simply not work with Outline View?


(a) Check that you have specified at least a suitable children  
property for the outline view in the first tab of the IB inspector.


(b) Check your console log for error messages about something being  
misconfigured.



___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTextFieldCell subclass template image inversion

2008-06-26 Thread [EMAIL PROTECTED]

Hello list

My NSTextFieldCell subclass is based on ImageAndTextCell.m from the  
SourceView sample.

This displays text and images in a single cell.

My difficult is in getting system media template images to invert when  
the cell is highlighted.

The documentation for NSImage - setTemplate states:

You can mark an image as a “template image” to notify clients who care  
that the image contains only black and clear content.


Yes, I detect that an image is a template, but how do I initiate  
caring.


My feeble attempts at getting my client to care have firstly been to  
try and invert the NSImageRep of the template, but this fails as the  
image rep is the undocumented NSCoreUIImageRep and not a  
NSBitmapImageRep.


My second attempt was along the following lines:

[cell setHighlighted:YES];
[cell setState:NSOnState];
NSImage *image = [cell preparedImage];

A modified - duller - image is returned, but not an inverted one.
I think that this is more along the right track. But something's  
missing (brains probably).


Any enlightenment would be welcome.

Jonathan



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie question: error in creating a NSData object using handle (Resource Management)

2008-06-26 Thread Ken Thomases

On Jun 25, 2008, at 9:49 PM, Tran Kim Bach wrote:

On Wed, Jun 25, 2008 at 3:36 PM, Ken Thomases [EMAIL PROTECTED]  
wrote



Also, in the pseudo-code you provide, the NSData objects will  
accumulate in
the autorelease pool until some point after your for loop.  You  
can try
using an autorelease pool inside the loop so that the NSData  
objects are
released after each iteration.  You may just be exhausting memory.   
For the
case where you're not using NSData, the memory exhaustion might not  
happen
since you're not storing the data twice in memory (once in the  
handle, once

in the NSData), but would if there were twice as many resources.


Thanks Ken. I'm confusing that as the memory management rules say, I  
myself
did not take the ownership of the NSData objects. So, I'm not  
responsible

for relinquishing ownership of them?


It is correct that you are not responsible for sending -release to the  
NSData object.  However, you do need to understand the nature of  
autoreleased objects, the lifetime of autorelease pools, the fact that  
autoreleased objects accumulate in autorelease pools if you don't give  
the pools the opportunity to drain, and how to address that if it  
becomes a problem.  The overview of the NSAutoreleasePool class  
reference says this:


If your application creates a lot of temporary autoreleased objects  
within the event loop, it may be beneficial to create local  
autorelease pools to help to minimize the peak memory footprint. You  
create an NSAutoreleasePool object with the usual alloc and init  
messages and dispose of it with release or drain (to understand the  
difference, see “Garbage Collection”). You should always drain an  
autorelease pool in the same context (invocation of a method or  
function, or body of a loop) that it was created. See Autorelease  
Pools http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/AutoreleasePools.html 
 for more details and several code samples using autorelease pools.






I hope you can show me the way to get out of this problem. I'm  
totally new

to Programming in Mac OS.

   OSStatus error = noErr;

unsigned short pmResFile = 0;

NSString *resFile;

NSURL *url;

FSRef fsRef;

resFile = [textField stringValue]; // get resfile from a textField  
(for

example)

url = [NSURL fileURLWithPath:resFile];


CFURLGetFSRef( (CFURLRef)url, fsRef);

(void)FSOpenResourceFile( fsRef, 0, NULL, (SInt8)fsRdPerm,  
pmResFile);


short saveRes = CurResFile();

if (pmResFile  0)

{

int i = 0;

int count = 0;

ResType resType;

   NSString *typestr = [comboBox stringValue];

memcpy((char *)resType, (char *)[typestr cStringUsingEncoding:
NSUTF8StringEncoding], 4);


The above is only correct for big-endian systems (PPC).  Also, if the  
string is shorter than 3 characters, you'll access past then end of  
the character array.





UseResFile(pmResFile);

count = Count1Resources( resType );

for (i = 1; i = count; i++)

{

long sizeLong;

short resIDShort;

NSString *name;

NSNumber *resID;

ResType resType1;

Str255 nameStr;

NSString *type;

Handle dataHandle;

NSData *data;

dataHandle = Get1IndResource( resType, i);

error = ResError();

if(error!=noErr)

{

NSLog(@Reading resource error);

UseResFile(saveRes);

return;

}

GetResInfo(dataHandle, resIDShort,  resType1, nameStr);

sizeLong = GetResourceSizeOnDisk(dataHandle);


You've been told to use GetHandleSize instead.




HLockHi( dataHandle );

name = [NSString stringWithCString:nameStr[1] length:nameStr[0] ];

type = [NSString stringWithCString:(char *)  resType1 length:4];


Same endianness issue, in reverse.




data = [NSData dataWithBytes:*dataHandle length:sizeLong ];

   resID = [NSNumber numberWithShort:resIDShort];

if((type2 =='PREC')([resID intValue]== 302))

{

   struct PGControlRes pgControlRes;

memcpy(pgControlRes,[data bytes], [data length]);


Have you tested that the resource size is the same as the structure  
size?





// more codes

}

HUnlock(dataHandle);

ReleaseResource(dataHandle);

}

UseResFile(saveRes);

}

CloseResFile(pmResFile);



Are you still getting an error?  If so, what error and where?

-Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Good mouse tracking design for dynamic view?

2008-06-26 Thread Michael Ash
On Thu, Jun 26, 2008 at 2:20 PM, Nathan Vander Wilt
[EMAIL PROTECTED] wrote:
 I have a view that displays and allows interaction with a lot (hundreds,
 even thousands) of small items. I am having trouble nailing down a good
 design for event handling, and just as I was ready to plead for help I see
 some other NSTrackingArea discussion that perhaps sheds a little light, but
 still inconclusive.

 It seems tidy to clear and reset all my tracking areas as the view gets
 redrawn, but that leads to situations like where an item moves relative to
 the mouse instead of vice versa, and since tracking areas can't be moved,
 the mouseEntered-mouseExited transaction gets killed halfway through with
 the old tracking area.

 My problem is that the displayed items can get updated (moved, deleted,
 etc.) in situations like this:
 1. The user mouses over an item, its tracking area fires, and some status
 text elsewhere gets set to reflect what's under the mouse.
 2. Before the mouse moves away from the item, the item moves and its
 previous tracking area is deleted. So now I never get that mouse exited
 event, even though the status text should be cleared.

 So it seems I need to do more bookwork myself, but I'm wondering which
 direction others would recommend:
 a) Set up a single tracking area for the whole view, and perform all my own
 hit testing every time the mouse moves.
 b) Keep the per-item tracking areas, but perform my own testing in the edge
 cases when active (mouse has entered but not exited) tracking areas are
 getting reset.

I vote for option A.

Efficiency should not be a concern. Unless your hit testing is
completely ridiculous, it will execute orders of magnitude faster than
the user can move his mouse. I have an app which sets the cursor based
on hit testing against a potentially large collection of NSBezierPaths
and have never heard of any performance difficulties in hit testing.
Drawing, yes, but not the cursor management (which is what I use it
for). If you can currently use tracking areas then your areas ought to
be plain rectangles, which are vastly faster than NSBezierPath to hit
test against.

Reinventing hit testing shouldn't be much of a concern either,
especially if your areas really are rectangles. Testing whether a
point is inside a rectangle is a one-liner using NSMouseInRect, and
you can basically just stick a loop around that and be done.

Done properly, you can factor the update-status-text code into a
separate method, then call it every time the mouse moves or anything
else changes. Just remember to take into account clipping if your view
is scrollable, you don't want your status text changing because the
user mouses over where something *would* be if it weren't off the edge
of your view.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTextFieldCell subclass template image inversion

2008-06-26 Thread Quincey Morris


On Jun 26, 2008, at 13:18, [EMAIL PROTECTED] wrote:

My difficult is in getting system media template images to invert  
when the cell is highlighted.

The documentation for NSImage - setTemplate states:

You can mark an image as a “template image” to notify clients who  
care that the image contains only black and clear content.


Yes, I detect that an image is a template, but how do I initiate  
caring.


My feeble attempts at getting my client to care have firstly been to  
try and invert the NSImageRep of the template, but this fails as the  
image rep is the undocumented NSCoreUIImageRep and not a  
NSBitmapImageRep.


My second attempt was along the following lines:

[cell setHighlighted:YES];
[cell setState:NSOnState];
NSImage *image = [cell preparedImage];

A modified - duller - image is returned, but not an inverted one.
I think that this is more along the right track. But something's  
missing (brains probably).


AFAIK, the caring client part refers to use of the templates in  
certain button styles as masks, e.g. for glowing and/or incised  
inscriptions (like the buttons at the bottom of the iCal window). This  
is documented in the Leopard developer release notes, though I don't  
know if it's reached the mainstream documentation yet.


If you can figure out what it says, you might be able to use such  
effects instead of inverting. If you must have inverting, the path of  
least resistance might be to create your own images.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)

2008-06-26 Thread Stéphane Sudre


On Jun 26, 2008, at 10:30 AM, Manfred Schwind wrote:


I'm beginning to wonder if it's possible to save and restore the  
current disclosure state of the hierarchy of a NSOutlineView.


I solved this a while ago. Here is what I am doing:

I am saving in my model if an item is expanded or collapsed. To  
keep the model up-to-date, I am doing the following:


- In outlineViewItemDidExpand: I am setting my expanded flag in the  
model to YES.
- In outlineViewItemWillCollapse: I am checking if the item is  
currently visible and only if it's visible, I set my expanded- 
flag to NO. To check if it is visible I am going up in the  
hierarchy and look if some of the parents is collapsed. If one is  
not expanded, I do not change the expanded flag. E.g. like so:


[...]


Looks like a good solution. I will try that.

Thanks.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leak in NSSavePanel

2008-06-26 Thread Jelle Vandebeeck

Hi Corbin,

You should check out this link: 
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSavePanel_Class/Reference/Reference.html

The word singleton is used :-)

But I thought [NSSavePanel savePanel] returned an autoreleased object,  
so I presumed no leaks could occur...


-- Jelle

On 25 Jun 2008, at 19:32, Corbin Dunn wrote:


On Jun 24, 2008, at 3:55 PM, Jelle Vandebeeck wrote:
When I try to call the NSSavePanel, I always receive some memory  
leaks on it. I have no idea if they are bad or not so bad... I just  
can't find a decent tutorial on the Instruments tool.


Have you tried using the leaks tool in instruments? It is easy to  
use. Keep the ref count, and look at the stack traces. Related, but  
not what you want, is:


http://www.corbinstreehouse.com/blog/index.php/2007/10/instruments-on-leopard-how-to-debug-those-random-crashes-in-your-cocoa-app/

Walking through that tutorial will help you.




This is the code that generates the memory leak from time to time:

NSSavePanel *savePanel = [NSSavePanel savePanel];
[savePanel setRequiredFileType:extention];
[savePanel setMessage:title];
[savePanel setExtensionHidden:YES];

It's the [NSSavePanel savePanel that gets the leak...


What do you mean by that?

Exactly what is leaking?

How are you determining it to leak?


I know the NSSavePanel is a singleton


No, it is not a singleton! Did you read this somewhere? If so, let  
me know, so we can correct our documentation.


NOTE: Some things are cached.

, so it should always use the same instance. Is that the problem  
when I try to call it multiple times in my application?


No, it isn't a problem, since it isn't a singleton. It creates a new  
instance for you each time.


corbin



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leak in NSSavePanel

2008-06-26 Thread Andy Lee

On Jun 26, 2008, at 6:23 PM, Jelle Vandebeeck wrote:

You should check out this link: 
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSavePanel_Class/Reference/Reference.html

The word singleton is used :-)


As a full-text search in the Xcode doc window would have quickly  
revealed. :)


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


Re: How to get a message when RETURN is pressed in a NSTextField

2008-06-26 Thread Patrick Burleson
On Tue, Jun 24, 2008 at 1:41 AM, Markus Spoettl
[EMAIL PROTECTED] wrote:
 Hi Kenny,

 Thanks for your suggestion. Unfortunately that doesn't work because I cannot
 differentiate between the multiple possibilities of what makes the action
 fire. The NSTextField action is sent not only for pressing enter but also
 when the control looses firstResponder status.

If I remember correctly, in IB you can set a NSTextField to only fire
its action on Enter It's on the Info panel in the inspector for a
NSTextField.

Maybe that will get it where you want?

Patrick
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSArchiver question?

2008-06-26 Thread Damien Cooke
I am getting the following error from this line NSData *data =  
[NSArchiver archivedDataWithRootObject:viewItem];
-[DCOViewItem encodeWithCoder:]: unrecognized selector sent to  
instance 0x17fa00


do I need to override this method below for my class DCOViewItem to  
use the NSArchiver class?

(void)encodeWithCoder:(NSCoder *)encoder

 Regards
Damien
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSArchiver question?

2008-06-26 Thread Mike Abdullah
Yes, it is your responsibility to implement the NSCoding protocol in  
your own classes.


On 27 Jun 2008, at 00:09, Damien Cooke wrote:

I am getting the following error from this line NSData *data =  
[NSArchiver archivedDataWithRootObject:viewItem];
-[DCOViewItem encodeWithCoder:]: unrecognized selector sent to  
instance 0x17fa00


do I need to override this method below for my class DCOViewItem to  
use the NSArchiver class?

(void)encodeWithCoder:(NSCoder *)encoder

Regards
Damien
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


description and proxy objects

2008-06-26 Thread Torsten Curdt
I am getting the selected object from a controller (that is using  
bindings)


 NSDictionary *accountSettings = [accountsController selection];

The returned object is a proxy object. But why isn't the  
[accountSettings description] passed on?
Instead of the print out of the contents of the dictionary I am now  
getting the description of the proxy object.


_NSControllerObjectProxy: 0x196110

Is there a way around that? I don't want to iterate the dictionary  
myself if I don't have to.


cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTableView / NSArrayController Drawing

2008-06-26 Thread Murray Bookchin
Hi All,
I'm using an NSArrayController to populate my NSTableView from an array of
dictionaries. The problem is my app spends the majority of its cpu time
re-drawing the NSTableview (~60-70%) as I add rows, even though the view is
idle (displaying the top 20 or so rows which aren't changing).

I did find one thread in the archives on this topic... (
http://www.cocoabuilder.com/archive/message/cocoa/2007/4/24/182355) it
sounds like there's a trick to getting the ArrayController to recognize that
the content array is mutable.. Doing that stops the ArrayController from
redrawing the TableView every time something is added to the content array?
The fix is not clear to me from that thread however...

Has anyone else experienced this and/or know how to work around 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 [EMAIL PROTECTED]


noob questions regarding KVC accessors for a mutable array property

2008-06-26 Thread Stuart Malin
I am trying to gain a working understanding of KVC. I have made a  
small app that has a class Party which has a property attendees  
that holds Person objects. The attendees property is KVC compliant  
for a mutable array (it has index accessors). In another part of my  
app, I want to find the Nth attendee. My first approach to doing so  
was to code:
	Person *person = [[party mutableArrayValueForKey:@attendees]  
objectAtIndex:index];
This does work, and, as I best understand, it complies with the KVC  
protocol.
But I do believe this approach generates a proxy mutable array, which  
seems inefficient to me. As the underlying Party class is KVC  
compliant for the attendees property, I substituted the above with:

Person *person = [party objectInAttendeesAtIndex:index];
This does work. But I sense I may be breaking some sort of  
encapsulation regarding the workings of KVC by using the accessors  
that support it.


The compiler issued a warning that Party may not respond to - 
objectInAttendeesAtIndex: because I hadn't included the index  
accessors in the class's header file... Which I could do But then  
wonder even more if I am exposing something that I shouldn't.   
Question: is it acceptable (perhaps even desirable) to expose the  
index accessors of a class via its interface declaration (header file)?


Also: I could add a method to my Party class to provide such access  
in a way that seems more semantically direct, to wit:  -personAtIndex:
Would providing such a method be preferred to having code elsewhere  
in the app use the Party class's KVC index accessor(s)?

(It does seem quite redundant)

~~~

Separately, I have an accessor -attendees: of the Party class, which  
is currently implemented as:


- (NSArray*) attendees
{
	return [NSArray arrayWithArray:attendees];	// attendees is an  
NSMutableArray, and is an ivar

}

I intentionally do not return the underlying mutable array, because I  
don't want other code accessing the content without going through the  
accessors.


Is my implementation reasonable? Or are there preferable ways to do  
this (such as to return a copy of the mutable array)?



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSArchiver question?

2008-06-26 Thread Jonathan Hess

Hey Damien -

You should also consider using NSKeyedArchiver over NSArchiver.  
NSKeyedArchiver is much more flexible and handles archive versioning  
much better.


Jon Hess

On Jun 26, 2008, at 4:22 PM, Mike Abdullah wrote:

Yes, it is your responsibility to implement the NSCoding protocol in  
your own classes.


On 27 Jun 2008, at 00:09, Damien Cooke wrote:

I am getting the following error from this line NSData *data =  
[NSArchiver archivedDataWithRootObject:viewItem];
-[DCOViewItem encodeWithCoder:]: unrecognized selector sent to  
instance 0x17fa00


do I need to override this method below for my class DCOViewItem to  
use the NSArchiver class?

(void)encodeWithCoder:(NSCoder *)encoder

Regards
Damien
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPredicateEditor

2008-06-26 Thread Peter Ammon


On Jun 25, 2008, at 7:27 PM, Chris wrote:


The net effect is that NSPredicateEditor can't display a predicate  
like


NOT (foo = bar)


A bug in NSPredicateEditor system perhaps? But surely someone would  
have

seen it before.


Hi Chris,

NOT type compound predicates only support exactly one subpredicate, or  
at least they did when NSPredicateEditor was written.  For this  
reason, the default implementation of NOT expects the sole  
subpredicate to be an OR type.  So set this:


NOT(OR(foo=bar))

Hope this helps,
-Peter

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Moderator] List Guidelines - Must Read

2008-06-26 Thread Scott Ribe
 What we really need is for the cocoa-dev list admin page to require
 new subscribers to type in the phrase I will not make posts about the
 iPhone or Snow Leopard :)

You know, I think that's a good idea. Either there, or where downloading the
iPhone SDK, rather than just click to acknowledge, make them type in
something confirming the NDA.

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSpeechSynthesizer and empty strings

2008-06-26 Thread William Squires
Actually, if ([myString length] == 0) is probably better, but just  
IMHO... :)


On Jun 26, 2008, at 1:15 PM, I. Savant wrote:


If NSSpeechSynthesizer has nothing to say, I want to create an audio
file with 1 second of silence.


  Maybe I'm misunderstanding the problem, but how about ...

  if ([myString isEqualToString:@])
  {
// Record silence into file ...
  } else {
// Send string to speech synthesizer
  }

--
I.S.
___

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

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

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


This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTrackingArea message lag

2008-06-26 Thread Graham Cox


On 27 Jun 2008, at 3:42 am, Markus Spoettl wrote:


On Jun 26, 2008, at 4:15 AM, Graham Cox wrote:
I think this is your problem. After the first rect is marked as  
needing update, the needsDisplay method will return YES. That then  
rejects all subsequent rect marking until the next event loop and  
the view has been redrawn. Then another rect gets a shot, and so  
on. Simply removing that if([![self needsDisplay]) should fix your  
problem, I think.


For whatever reason, simply calling -setNeedsDisplay:YES without  
update rectangle and needsDisplay check is producing the same kind  
of lag. The view is not updated any faster or more accurately.  
Granted, the needsDisplay check may be wrong though, I can see the  
issue there.



you can still (and should) use -setNeedsDisplayInRect:, just don't  
make this conditional on -needsDisplay.


I think to really get to the bottom of the delay problem we'd need to  
see the code in its full context. For example how does your drawRect:  
method know which rect(s) to repaint? Or does it just go over the  
whole lot? There could be many reasons why it's slow.


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


Re: description and proxy objects

2008-06-26 Thread Omar Qazi


On Jun 26, 2008, at 4:36 PM, Torsten Curdt wrote:

I am getting the selected object from a controller (that is using  
bindings)


NSDictionary *accountSettings = [accountsController selection];

The returned object is a proxy object. But why isn't the  
[accountSettings description] passed on?
Instead of the print out of the contents of the dictionary I am now  
getting the description of the proxy object.


_NSControllerObjectProxy: 0x196110



Do this:

NSDictionary *accountSettings = [[accountsController  
selectedObjects]objectAtIndex:0];


Omar Qazi
Hello, Galaxy!
1.310.294.1593



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSTrackingArea message lag

2008-06-26 Thread Markus Spoettl

On Jun 26, 2008, at 5:21 PM, Graham Cox wrote:
you can still (and should) use -setNeedsDisplayInRect:, just don't  
make this conditional on -needsDisplay.


I think to really get to the bottom of the delay problem we'd need  
to see the code in its full context. For example how does your  
drawRect: method know which rect(s) to repaint? Or does it just go  
over the whole lot? There could be many reasons why it's slow.



Unfortunately that's not an option, but it isn't really necessary.  
I've switched to updating the view from -mouseMoved: events doing my  
own hit testing and it works very quickly now, there is no more lag.


Notice the drawing mechanism didn't change, so the drawing wasn't  
causing the lag. I have no other explanation than a strange delay in  
the delivery of tracking area messages. What causes the delay I don't  
know, it's very likely my fault but it's most definitely not the  
drawing code.


Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSSpeechSynthesizer and empty strings

2008-06-26 Thread I. Savant


Actually, if ([myString length] == 0) is probably better, but  
just IMHO... :)


http://www.cocoabuilder.com/archive/message/cocoa/2004/7/5/111029  
for details.


  Nick beat me to it! ;-) I must say I've been slow on the draw (and  
largely uncommunicative) lately - a major deadline came and went and  
I'm sure every professional developer here knows just how draining  
that is.


  ... of course being the only developer on this particular project,  
I'm now having fun writing the Help Book, a task about which I have  
mixed feelings. ;-)


--
I.S.



___

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

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

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

This email sent to [EMAIL PROTECTED]


NSPopUpButton setPreferredEdge

2008-06-26 Thread Francisco Tolmasky
I'm attempting to make a pop up button that pops its menu to the left  
of itself.  However, setting setPullsDown:YES and  
setPreferredEdge:NSMinXEdge does not appear to work.  In fact,  
setPreferredEdge seems to be largely ignored, whether I set it in code  
or even quickly testing it in IB.  Am I forgetting some sort of step?


Thanks,

Francisco
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: description and proxy objects

2008-06-26 Thread Kyle Sluder
On Thu, Jun 26, 2008 at 7:36 PM, Torsten Curdt [EMAIL PROTECTED] wrote:
 I am getting the selected object from a controller (that is using bindings)

  NSDictionary *accountSettings = [accountsController selection];

 The returned object is a proxy object. But why isn't the [accountSettings
 description] passed on?

There are probably a few good reasons for that.
1) Imagine debugging a Distributed Object application.  You pause the
execution and the debugger sends a million -description messages to
every object on the stack.  Probably not the best idea.
2) Without implementing -description for the proxy itself, you would
have no idea that an object was actually a proxy without inspecting
its isa pointer, which for all you know has been swizzled out anyway.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTrackingArea message lag

2008-06-26 Thread Kyle Sluder
On Thu, Jun 26, 2008 at 8:41 PM, Markus Spoettl
[EMAIL PROTECTED] wrote:
 Notice the drawing mechanism didn't change, so the drawing wasn't causing
 the lag. I have no other explanation than a strange delay in the delivery of
 tracking area messages. What causes the delay I don't know, it's very likely
 my fault but it's most definitely not the drawing code.

Well you've avoided the problem, but you should still remove the
condition on -needsDisplay.  It's semantically incorrect.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTextFieldCell subclass template image inversion

2008-06-26 Thread Brandon Walkin

You can make a template image white by telling its cell:

[cell setBackgroundStyle:NSBackgroundStyleDark]

Cheers,
Brandon

On 26-Jun-08, at 4:18 PM, [EMAIL PROTECTED] wrote:


Hello list

My NSTextFieldCell subclass is based on ImageAndTextCell.m from the  
SourceView sample.

This displays text and images in a single cell.

My difficult is in getting system media template images to invert  
when the cell is highlighted.

The documentation for NSImage - setTemplate states:

You can mark an image as a “template image” to notify clients who  
care that the image contains only black and clear content.


Yes, I detect that an image is a template, but how do I initiate  
caring.


My feeble attempts at getting my client to care have firstly been to  
try and invert the NSImageRep of the template, but this fails as the  
image rep is the undocumented NSCoreUIImageRep and not a  
NSBitmapImageRep.


My second attempt was along the following lines:

[cell setHighlighted:YES];
[cell setState:NSOnState];
NSImage *image = [cell preparedImage];

A modified - duller - image is returned, but not an inverted one.
I think that this is more along the right track. But something's  
missing (brains probably).


Any enlightenment would be welcome.

Jonathan



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Prevent Asynchronous operation of beginSheetModalForWindow

2008-06-26 Thread Graham Cox


On 27 Jun 2008, at 12:19 am, John Love wrote:


Still pouring over your thesis


I thought it was getting a bit damp around here... ;-)


and at the very top:

@implementation CalculateSheetController

id *mFileSheetDelegate;

Within the implementation of showSheetOnParentWindow, I get  
assignment from

incompatible pointer type with:



id already is a pointer, so you don't want the *



and later on within this SC's implementation:

- (void) sheetDidEnd:(NSWindow*)sheet
returnCode:(int)returnCode
contextInfo:(void*)contextInfo {
   [mFileSheetDelegate doSheetSelection:sheet returnCode:returnCode
contextInfo:contextInfo];



Looking much better, but one question: why are you passing sheet to  
your FC? Why on earth does it need it? Again this exposes UI  
implementation details to an unrelated controller that shouldn't need  
to care about that.


By the way my FC has the formal  
doSheetSelection:returnCode:contextInfo

selector or method .. one final thing on this item, I do not really
understand informal protocols, so I have not yet tried to  
implement such.


Well, you could try searching the docs for that phrase...

But in simple terms an informal protocol is just a method or methods  
that different objects agree between themselves will be how they  
communicate (and by 'agree between themselves' I mean that you, the  
programmer, made that decision). In fact you are using them all the  
time whenever you write any method that another object calls. Don't be  
too misled by the jargon, there's not much more to it than that. A  
*formal* protocol on the other hand, is much stricter, and uses the  
@protocol directive, but I won't get into that, you probably don't  
need to know. The term 'informal' is really there to distinguish it  
from a formal @protocol situation.


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


Re: NSSpeechSynthesizer and empty strings

2008-06-26 Thread James Walker

Nick Zitzmann wrote:

It is possible for an NSString to have zero 
length but not be empty. See 
http://www.cocoabuilder.com/archive/message/cocoa/2004/7/5/111029 for 
details.


The message you quote says that it is possible for an NSString to be 
empty (in a semantic sense) but have positive length.  That's not what 
you said.

--
  James W. Walker, Innoventive Software LLC
  http://www.frameforge3d.com/
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPredicateEditor

2008-06-26 Thread Chris
On Fri, Jun 27, 2008 at 10:09 AM, Peter Ammon [EMAIL PROTECTED] wrote:


 On Jun 25, 2008, at 7:27 PM, Chris wrote:


 The net effect is that NSPredicateEditor can't display a predicate like

 NOT (foo = bar)


 A bug in NSPredicateEditor system perhaps? But surely someone would have
 seen it before.


 Hi Chris,

 NOT type compound predicates only support exactly one subpredicate, or at
 least they did when NSPredicateEditor was written.  For this reason, the
 default implementation of NOT expects the sole subpredicate to be an OR
 type.  So set this:

 NOT(OR(foo=bar))


Ahh, this would explain why it hasn't been reported before.

However the BNF description of predicates does not impose that restriction:

http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Predicates.pdf

And also, when you convert the predicate to a string, it doesn't show the
OR. The OR is apparently optimized away by the predicateFormat routine.
Since the only way to feasibly store a predicate is as a string, and then
parse it back in, its not really consistent.

I've worked around it by replacing the matchForPredicate routine of
NSPredicateEditorRowTemplate, which is where I think the actual problem
lies:


- (double)matchForPredicate:(NSPredicate *)predicate {

if ([predicate class] == [NSCompoundPredicate self]) {

return 0.5;

}

return 0.0;

}
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Moderator] List Guidelines - Must Read

2008-06-26 Thread mmalc Crawford


On Jun 26, 2008, at 11:36 AM, Hamish Allan wrote:


Making these general posts repeatedly seems to me to be pretty futile.
Those who post iPhone questions here are presumably those who have
signed up five minutes beforehand for the purpose. The fact that they
post without reading the FAQ or performing even a cursory search of
the archives indicates, to my mind, that they are unlikely to read the
above before posting, even if they have received it.


The guidelines are also automatically sent on sign-up.


What we really need is for the cocoa-dev list admin page to require
new subscribers to type in the phrase I will not make posts about the
iPhone or Snow Leopard :)


Unfortunately the list management s/w is not that sophisticated.
(Another possible solution that it doesn't support is setting new  
members to being moderated to begin with.)


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


Re: NSPopUpButton setPreferredEdge

2008-06-26 Thread Peter Ammon


On Jun 26, 2008, at 5:49 PM, Francisco Tolmasky wrote:

I'm attempting to make a pop up button that pops its menu to the  
left of itself.  However, setting setPullsDown:YES and  
setPreferredEdge:NSMinXEdge does not appear to work.  In fact,  
setPreferredEdge seems to be largely ignored, whether I set it in  
code or even quickly testing it in IB.  Am I forgetting some sort of  
step?


Hi Francisco,

This isn't supported on OS X.  The preferred edge is ignored for menu  
positioning, because the standard UI is to show the menu below the  
control.


If you want the menu to pop up somewhere else, you will have to  
override mouseDown: and pop up the menu manually.  However, it's  
normally best to follow Macintosh conventions and let the frameworks  
worry about menu positioning.


-Peter

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie question: error in creating a NSData object using handle (Resource Management)

2008-06-26 Thread Tran Kim Bach
Wow, thanks Ken a lot.About the endian issues, I have a compatible swap
function to convert data to Big-endian (and vice verse).
Then, I will correct big-endian issues.
I may know where the problem is.
When I read to your suggestion,

On Fri, Jun 27, 2008 at 6:11 AM, Ken Thomases [EMAIL PROTECTED] wrote:



 data = [NSData dataWithBytes:*dataHandle length:sizeLong ];

   resID = [NSNumber numberWithShort:resIDShort];

 if((type2 =='PREC')([resID intValue]== 302))

 {

   struct PGControlRes pgControlRes;

 memcpy(pgControlRes,[data bytes], [data length]);


 Have you tested that the resource size is the same as the structure size?


I found out something.
Actually, I'm just trying to make a prototype in one fixed size of the same
resource type.
I used to test on the same resource files with this fixed resource
structure.
but in reality, in my application, the resource size for this type(PREC) is
various for each resource file(.rsrc).
So, I think the struct caused my problem ( I never thought of it before).
By the way, I have a lot of structs of the same resource type(PREC for
example) written in C,
Is there any way to still take advantage of them in Objective-C?
(I mean if I can use these C structs in Objective-C?, don't have to rewrite
them using Objective-C language).
Thank you for your supports.

---(Bachtk
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie question: error in creating a NSData object using handle (Resource Management)

2008-06-26 Thread Graham Cox

Just an aside that may or may not be relevant.

In the old days, often variable-length resources and other OS types  
would have a struct defined for them that used a fixed field size to  
represent some variable length field in the real resource, for example:


typedef struct
{
short count;
long  stuff[1]; // in reality count length
}
someResTypeStruct;

This is simply because you can't express variable length structs in C.  
So using sizeof(someResTypeStruct) == GetHandleSize(anActualResource)  
very often doesn't work, never has worked, and definitely shouldn't be  
relied upon. Same goes for allocating memory for such resources, which  
is why many common types had their own NewXXX function.


That said, you can use C structs in Objective-C normally, just be  
aware that they might only describe part of the real resource itself  
(the header, say).




hth,

Graham


On 27 Jun 2008, at 1:00 pm, Tran Kim Bach wrote:

but in reality, in my application, the resource size for this  
type(PREC) is

various for each resource file(.rsrc).
So, I think the struct caused my problem ( I never thought of it  
before).

By the way, I have a lot of structs of the same resource type(PREC for
example) written in C,
Is there any way to still take advantage of them in Objective-C?
(I mean if I can use these C structs in Objective-C?, don't have to  
rewrite

them using Objective-C language).


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSpeechSynthesizer and empty strings

2008-06-26 Thread Michael Ash
On Thu, Jun 26, 2008 at 8:32 PM, Nick Zitzmann [EMAIL PROTECTED] wrote:

 On Jun 26, 2008, at 6:16 PM, William Squires wrote:

 Actually, if ([myString length] == 0) is probably better, but just
 IMHO... :)


 No; don't ever do that. It is possible for an NSString to have zero length
 but not be empty.

This is backwards. You can have a string that is empty but has
non-zero length, due to the characters it contains being semantically
null.

Logically, an NSString is completely described by the unichars it
contains. If an NSString has length zero then it has no unichars, so
there is no room for any variation.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTrackingArea message lag

2008-06-26 Thread Markus Spoettl

On Jun 26, 2008, at 6:11 PM, Kyle Sluder wrote:

Well you've avoided the problem, but you should still remove the
condition on -needsDisplay.  It's semantically incorrect.



I did that (I thought I mentioned that).

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

subclassing CAAnimation

2008-06-26 Thread Matthew Johnson
I would like to subclass CAAnimation to implement an animation with  
custom rendering.  I can't find any details about how animations work  
with the render tree to render each frame.  There doesn't appear to be  
public API for this yet.  This is an experimental project so I don't  
mind using unsupported APIs if anyone knows how to do this.  Any help  
is much appreciated.


Thanks,
Matthew
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableView / NSArrayController Drawing

2008-06-26 Thread Ken Thomases

On Jun 26, 2008, at 6:43 PM, Murray Bookchin wrote:

I'm using an NSArrayController to populate my NSTableView from an  
array of
dictionaries. The problem is my app spends the majority of its cpu  
time
re-drawing the NSTableview (~60-70%) as I add rows, even though the  
view is

idle (displaying the top 20 or so rows which aren't changing).

I did find one thread in the archives on this topic... (
http://www.cocoabuilder.com/archive/message/cocoa/2007/4/24/182355) it
sounds like there's a trick to getting the ArrayController to  
recognize that
the content array is mutable.. Doing that stops the ArrayController  
from
redrawing the TableView every time something is added to the content  
array?

The fix is not clear to me from that thread however...

Has anyone else experienced this and/or know how to work around it?


How are you modifying the array?  I suspect you're using - 
mutableArrayValueForKey:, and then mutating the returned array proxy.   
Read the documentation for that.


In particular, note that if the mutable array primitive methods aren't  
found, the proxy resorts to setKey:.  Each time setKey: is used,  
you're telling the receiver that the entire array is being replaced,  
rather than making some more limited change to just one or a few  
elements of the array.  In particular, this is equivalent to calling  
will/didChangeValueForKey:, which results in KVO notifications whose  
NSKeyValueChangeKindKey has a value of NSKeyValueChangeSetting.


By contrast, if the mutable array primitive methods were available,  
the proxy would use them.  In turn, KVO could use the equivalent of  
will/didChange:valuesAtIndexes:forKey:, which results in notifications  
whose NSKeyValueChangeKindKey will be one of  
NSKeyValueChangeInsertion, NSKeyValueChangeRemoval, or  
NSKeyValueChangeReplacement.


Only the latter kinds of notifications give the NSTableView the  
information it needs to perform efficient updates to itself.


If you're not using -mutableArrayValueForKey:, then you're either  
calling setKey: yourself, which has the same effect, or you're  
calling will/didChangeValueForKey: yourself.  If you doing that, you  
shouldn't.  If you insist on generating the notifications manually,  
use will/didChange:valuesAtIndexes:forKey:.  Even better would be to  
implement the mutable array primitive methods and use those.  (Once  
those are implemented, you _could_ use -mutableArrayValueForKey:, and  
it would be able to be somewhat more efficient, but in that case it's  
still an unnecessary intermediary and you'd be better off to just call  
the mutable array primitive methods directly.)


So, to solve the issue you're seeing, I recommend that you implement  
the mutable array primitive methods and use those when you need to  
modify your array.  http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html#//apple_ref/doc/uid/20002174-178830-BAJEDEFB 



Cheers,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: noob questions regarding KVC accessors for a mutable array property

2008-06-26 Thread Ken Thomases

On Jun 26, 2008, at 6:54 PM, Stuart Malin wrote:

I am trying to gain a working understanding of KVC. I have made a  
small app that has a class Party which has a property attendees  
that holds Person objects. The attendees property is KVC compliant  
for a mutable array (it has index accessors). In another part of my  
app, I want to find the Nth attendee. My first approach to doing so  
was to code:
	Person *person = [[party mutableArrayValueForKey:@attendees]  
objectAtIndex:index];
This does work, and, as I best understand, it complies with the KVC  
protocol.
But I do believe this approach generates a proxy mutable array,  
which seems inefficient to me.


Since you say below that you have an -attendees method, why not

Person *person = [[party attendees] objectAtIndex:index];

?

As the underlying Party class is KVC compliant for the attendees  
property, I substituted the above with:

Person *person = [party objectInAttendeesAtIndex:index];
This does work. But I sense I may be breaking some sort of  
encapsulation regarding the workings of KVC by using the accessors  
that support it.


Doesn't seem like breaking encapsulation to me.  Your code is still  
always the gatekeeper of access to the property, so it's still  
encapsulated.  Just as much as it is to provide an -attendees method,  
for example.  In theory, it offers greater encapsulation since your  
code could, if you wanted, make decisions about how to behave on an  
element-by-element basis, which isn't possible if you give up the  
array all at once.


The compiler issued a warning that Party may not respond to - 
objectInAttendeesAtIndex: because I hadn't included the index  
accessors in the class's header file... Which I could do But  
then wonder even more if I am exposing something that I shouldn't.   
Question: is it acceptable (perhaps even desirable) to expose the  
index accessors of a class via its interface declaration (header  
file)?


Yes.

I've said this before -- so much so that I probably sound like a  
broken record: the property is not the ivar.  The ivar, if it exists  
at all, is an implementation detail for the property.  The property is  
the set of methods in the class interface which allow clients to  
inquire about that information/state of your object.  Therefore, it is  
perfectly sensible, and often very much the right thing to do, to put  
the KVC accessors in the interface of your class.


One example is when your to-many property is not backed by an array.   
Suppose the objects in the to-many relationship are pulled from a  
database.  Or generated on demand, or whatever.  Maybe your property  
is backed by a library which only provides an interface for counting  
and access-by-index (e.g. CGImageSource).  Maybe your property  
represents a large but sparse array.  A property might not actually  
have a -key accessor (because it would be prohibitively expensive to  
generate the required array); it might _only_ exist as the set of  
indexed accessors.  In that case, as you can imagine, clients could  
only use those KVC accessors to access the property, and they'd be  
perfectly right to do so.



Also: I could add a method to my Party class to provide such access  
in a way that seems more semantically direct, to wit:  -personAtIndex:
Would providing such a method be preferred to having code elsewhere  
in the app use the Party class's KVC index accessor(s)?

(It does seem quite redundant)


It seems redundant to me, too.  (To be pedantic, it would more  
appropriately be -attendeeAtIndex:.  ;)


Seems like a matter of personal taste/style.  Give it a try and see if  
it feels more (or less) comfortable or efficient or whatever-criterion- 
matters-to-you. I doubt you'll be excoriated here for either choice.



Separately, I have an accessor -attendees: of the Party class, which  
is currently implemented as:


- (NSArray*) attendees
{
	return [NSArray arrayWithArray:attendees];	// attendees is an  
NSMutableArray, and is an ivar

}

I intentionally do not return the underlying mutable array, because  
I don't want other code accessing the content without going through  
the accessors.


Is my implementation reasonable? Or are there preferable ways to do  
this (such as to return a copy of the mutable array)?


My personal theory is that using -copy (plus -autorelease) at least  
gives the opportunity for a more efficient implementation.  In this  
case, there's probably no point, but in the general case my rule is to  
go with the most semantically specific operation to give the  
implementation the greatest amount of information and thus the  
greatest opportunity to do something smart.


That said, the larger issue is whether to protect yourself against  
your clients.  We just had a fairly good thread on this subject: http://lists.apple.com/archives/Cocoa-dev/2008/Jun/msg00188.html 
.


Lastly, just let me say you're doing very well for a self-described  
noob!  :)


Cheers,
Ken

Re: subclassing CAAnimation

2008-06-26 Thread Scott Anguish


On Jun 26, 2008, at 11:49 PM, Matthew Johnson wrote:

I would like to subclass CAAnimation to implement an animation with  
custom rendering.  I can't find any details about how animations  
work with the render tree to render each frame.  There doesn't  
appear to be public API for this yet.  This is an experimental  
project so I don't mind using unsupported APIs if anyone knows how  
to do this.  Any help is much appreciated.


there is no API to allow this, and private API can't be discussed here.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: description and proxy objects

2008-06-26 Thread Ken Thomases

On Jun 26, 2008, at 8:05 PM, Kyle Sluder wrote:

On Thu, Jun 26, 2008 at 7:36 PM, Torsten Curdt [EMAIL PROTECTED]  
wrote:
I am getting the selected object from a controller (that is using  
bindings)


NSDictionary *accountSettings = [accountsController selection];

The returned object is a proxy object. But why isn't the  
[accountSettings

description] passed on?


2) Without implementing -description for the proxy itself, you would
have no idea that an object was actually a proxy without inspecting
its isa pointer, which for all you know has been swizzled out anyway.


Uh, except for the -isProxy method.  :)

That said, I hope Torsten is only using -description for debugging  
purposes rather than as a general way to get a text form of a  
dictionary.  For the latter, I recommend NSPropertyListSerialization.


Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]