Re: NSFileHandle -readInBackgroundAndNotify behavior on EOF

2008-06-24 Thread Ken Thomases

On Jun 25, 2008, at 1:31 AM, Rick Mann wrote:

It's not clear from the docs what this method does when the  
NSFileHandle is associated with a file. The docs say it will return  
an empty NSData at EOF, but what I'm seeing instead is this: I get  
back an NSData with -length = 50, even though the file is less than  
half that length. Upon examination, the data matches that of the  
file for the first part, and the rest of the bytes look like garbage.


Subsequently, I get notified many times with 0-length data  
(presumably because I'm at the end of the file).


But why wouldn't it return just the bytes in the file? This seems  
very broken.


So broken that I doubt it's true.  ;)  What I mean is I find it more  
likely that you have a bug in your code.


Please, show us your code so we can have a chance to find the bug (if  
there is one).


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: [SOLVED] NSFileHandle -readInBackgroundAndNotify behavior on EOF

2008-06-24 Thread Rick Mann


On Jun 24, 2008, at 23:31:24, Rick Mann wrote:

It's not clear from the docs what this method does when the  
NSFileHandle is associated with a file. The docs say it will return  
an empty NSData at EOF, but what I'm seeing instead is this: I get  
back an NSData with -length = 50, even though the file is less than  
half that length. Upon examination, the data matches that of the  
file for the first part, and the rest of the bytes look like garbage.


Subsequently, I get notified many times with 0-length data  
(presumably because I'm at the end of the file).


But why wouldn't it return just the bytes in the file? This seems  
very broken.



Argh. My bad. I was using old code to dump memory in a formatted way,  
and it was padding the bytes.


Sorry for the noise.

--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


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

2008-06-24 Thread Ken Thomases

On Jun 25, 2008, at 1:19 AM, Tran Kim Bach wrote:


Hi folks,I'm a newbie to Cocoa.
Recently, I'm working on a project relating to Resource Management.
In my project, there's a part that I'm reading through the resources  
in a

resource file.
I'm using:
int count = CountResources( typeName );
to get all resource that has the type "typeName", then loop through  
this

resource list to take resource data out.

for (n = 1; n <= count; n++)
{
  Handle dataHandle = Get1IndResource( type1, n);
  
  NSData *data = [NSData dataWithBytes: *dataHandle length:
GetResourceSizeOnDisk(dataHandle)];  // I GOT AN ERROR HERE


What do you mean "GOT AN ERROR"?  What error?  How did it manifest?




  //using data
  struct A_STRUCT aStruct;

  memcpy(& aStruct,[data bytes], [data length]);
}
After several times looping through the list, I got an error in the  
line

above.
But if I use data directly, like the following code, there is no error
occurred.
 memcpy(&pgControlRes,*dataHandle, GetResourceSizeOnDisk(dataHandle));
Any suggestions for my problem.
I highly appreciate all your helps.


You don't show if you're:

1) Checking if dataHandle is NULL
2) Checking if *dataHandle is NULL
3) If (1) or (2), checking ResError()
4) Disposing of dataHandle with ReleaseResource()

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.


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: Newbie question: error in creating a NSData object using handle (Resource Management)

2008-06-24 Thread Kai

Hi,

"I GOT AN ERROR HERE" may be a little too unspecific. Perhaps you can  
elaborate: crash, exception, nil return, Console entry, what else?


That said, you should use GetHandleSize (dataHandle) instead of  
GetResourceSizeOnDisk(dataHandle). GetResourceSizeOnDisk() can return  
values which are too large (see documentation).


Ah, and I just see that you combinded CountResources with  
Get1IndResource, that’s probably wrong. You should use CountResources  
with GetIndResource or Count1Resources with Get1IndResource.


Neither of this directly explains the difference between using NSData  
and the direct copy. But since you potentially access non existing  
bytes or data, that may be coincidence.


Best
Kai


Hi folks,I'm a newbie to Cocoa.
Recently, I'm working on a project relating to Resource Management.
In my project, there's a part that I'm reading through the resources  
in a

resource file.
I'm using:
int count = CountResources( typeName );
to get all resource that has the type "typeName", then loop through  
this

resource list to take resource data out.

for (n = 1; n <= count; n++)
{
  Handle dataHandle = Get1IndResource( type1, n);
  
  NSData *data = [NSData dataWithBytes: *dataHandle length:
GetResourceSizeOnDisk(dataHandle)];  // I GOT AN ERROR HERE
  //using data
  struct A_STRUCT aStruct;

  memcpy(& aStruct,[data bytes], [data length]);
}
After several times looping through the list, I got an error in the  
line

above.
But if I use data directly, like the following code, there is no error
occurred.
 memcpy(&pgControlRes,*dataHandle, GetResourceSizeOnDisk(dataHandle));
Any suggestions for my problem.
I highly appreciate all your helps.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kai%40granus.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]


NSFileHandle -readInBackgroundAndNotify behavior on EOF

2008-06-24 Thread Rick Mann
It's not clear from the docs what this method does when the  
NSFileHandle is associated with a file. The docs say it will return an  
empty NSData at EOF, but what I'm seeing instead is this: I get back  
an NSData with -length = 50, even though the file is less than half  
that length. Upon examination, the data matches that of the file for  
the first part, and the rest of the bytes look like garbage.


Subsequently, I get notified many times with 0-length data (presumably  
because I'm at the end of the file).


But why wouldn't it return just the bytes in the file? This seems very  
broken.


TIA,
--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


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

2008-06-24 Thread Tran Kim Bach
Hi folks,I'm a newbie to Cocoa.
Recently, I'm working on a project relating to Resource Management.
In my project, there's a part that I'm reading through the resources in a
resource file.
I'm using:
int count = CountResources( typeName );
to get all resource that has the type "typeName", then loop through this
resource list to take resource data out.

for (n = 1; n <= count; n++)
{
   Handle dataHandle = Get1IndResource( type1, n);
   
   NSData *data = [NSData dataWithBytes: *dataHandle length:
GetResourceSizeOnDisk(dataHandle)];  // I GOT AN ERROR HERE
   //using data
   struct A_STRUCT aStruct;

   memcpy(& aStruct,[data bytes], [data length]);
}
After several times looping through the list, I got an error in the line
above.
But if I use data directly, like the following code, there is no error
occurred.
  memcpy(&pgControlRes,*dataHandle, GetResourceSizeOnDisk(dataHandle));
Any suggestions for my problem.
I highly appreciate all your helps.
___

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

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


NSPredicateEditor

2008-06-24 Thread Chris
Let's say I create a NSPredicateEditor and it looks like this:


[All] of the following are true:

[Name] equals [ ]
---

So the user enters say "Fred" and the predicate returned is "Name == Fred".

Later on, I reload that predicate into the NSPredicateEditor and it looks
like this:


[Name] equals [ Fred ]
---

But now there is no option to change it to say:

[Some] of the following are true:

because that line isn't shown.

How do I make that line reappear the next 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]


Re: Allocating outlets from NIB file

2008-06-24 Thread Ken Thomases

On Jun 24, 2008, at 7:43 AM, Johan Kool wrote:


You create your controller with this:
spriteController = [[SpriteController alloc]  
initWithWindowNibName:@"YourNib"];


and to show the window you use:
[[spriteController window] makeKeyAndOrderFront:self];
or
[[spriteController spriteWindow] makeKeyAndOrderFront:self];


Care should be taken with the second form.  -[NSWindowController  
window] does some important stuff besides just returning the window --  
it loads the nib if necessary!  So, calling your own -spriteWindow  
accessor will not be sufficient unless it in turn calls -window.


Also, consider using -[NSWindowController showWindow:] instead of  
calling both -window and -makeKeyAndOrderFront:.



On Jun 24, 2008, at 7:49 AM, Chris wrote:

You should not be allocating either SpriteView or SpriteController  
if they are referred to in the NIB. (which is the normal case).


Instead you go to the File's Owner object in interface builder, and  
go to the Identity tab, and set the Class to be whatever class  
contains your loadNib statement. ONLY load the NIB, don't attempt to  
create windows, views or controllers. (Let's call this class that  
loads the NIB as class "A".). Now you add some outlets to class "A"  
called spriteView, spriteWIndow, spriteController or whatever else  
you need. Then in interface builder you connect these outlets of  
"File's Owner" to those objects. Now when you load the NIB, you'll  
have pointers to all the objects you care about in the same object  
that loaded the NIB.


This is potentially confusing advice, in my opinion.  The OP was doing  
a very typical thing, which is that he had a custom subclass of  
NSWindowController "outside" of his nib, which would serve to load and  
own the nib.  Therefore, he _should_ be allocating it himself, and the  
nib should not have an instance of his class.  Instead the nib's  
File's Owner should be configured to know that its class will be  
SpriteController.


In other words, you're introducing an unnecessary class "A" to fulfill  
the role that SpriteController is already filling.



On Jun 24, 2008, at 7:56 AM, Andy Lee wrote:


On Jun 24, 2008, at 8:17 AM, Joseph Ayers wrote:

SpriteController and SpriteView are defined and connected in the NIB


Your nib shouldn't contain a SpriteController instance.  Instead, it  
should set the class of File's Owner to SpriteController and make  
the outlet connection from File's Owner to your SpriteView.  Your  
code below will then do the right thing -- it creates a  
SpriteController instance and tells the nib file to use that as the  
File's Owner when it is loaded.



When I open the NIB with

-(void)loadSpriteController{
 if (spriteController == NULL) {
 spriteController = [[SpriteController alloc] init];
   if (![NSBundle loadNibNamed:@"spriteWindow"  
owner:spriteController]) {

  NSLog(@"Error loading SpriteController");}
 else{
  NSLog(@"SpriteController NIB Loaded");   }
 }

}


Actually, you should use the code suggested by Johan Kool to allocate  
and initialize your SpriteController and load the nib.  In other  
words, use NSWindowController's -initWithWindowNibName: method to  
initialize the object, and _don't_ use NSBundle or NSNib to load the  
nib.  Let NSWindowController do that for you, which it will do  
automatically when you (or somebody) call its -window getter method.


It's not called out very strongly in the documentation, but  
NSWindowController has some smarts in it about nib loading and memory  
management of the top-level objects.  In particular, it avoids the  
retain cycles which typically result when something in the nib binds  
to or through File's Owner.


It's possible that -[SpriteController init] is built in terms of - 
[NSWindowController initWithWindowNibName:], which is fine.  My point  
is that NSWindowController should be managing the nib and its loading.


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: Newbie question: instantiate a class in its header file OR in IB

2008-06-24 Thread Jens Alfke


On 24 Jun '08, at 8:34 PM, JArod Wen wrote:

I am a cocoa newbie from Java. Recently I found an example code in  
which the instance of a class is defined in its own class's header  
file, as following:

@interface AppController : NSObject {
// Instance variables here
}
AppController *appController;


That's not valid code as you wrote it … I think you meant to put an  
"@end" after the "}"? In that case, "appController" is a declaration  
of a global variable, a pointer to an AppController instance. This is  
a pretty common thing to do: the global variable points to the  
singleton instance of AppController, as a quick way to let other code  
call methods on it. Usually AppController initializes the variable  
like so:

- (void) awakeFromNib {
appController = self;
}

Now if some other code in the app wants to, say, open the preferences  
panel, it can call [appController openPrefs: self].


—Jens___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: instantiate a class in its header file OR in IB

2008-06-24 Thread Andrew Farmer

On 24 Jun 08, at 20:34, JArod Wen wrote:
I am a cocoa newbie from Java. Recently I found an example code in  
which the instance of a class is defined in its own class's header  
file, as following:


@interface AppController : NSObject {

// Instance variables here

}

AppController *appController;


This example code is incorrect. Importing this header file from more  
than one source file will result in multiple definitions of  
appController - the only reason it's working in the example project is  
probably because there's only one .m file which imports this header.  
Remember that the text of the file being #included or #imported is  
simply inserted into the file which includes it - there's no  
distinction between source created through inclusion and source  
present in the original file. Hence, there's no distinction between a  
variable which is multiply defined by a bad header and a variable  
which is multiply defined by mistake.


Adding the "extern" qualifier to the definition in the header will  
cause the symbol to be treated as a reference to a single variable,  
which you'll have to explicitly define elsewhere.


The correct approach, however, is simply to not make that variable  
public at all. Assuming that this is to implement a singleton pattern,  
standard practice is to create a class method which'll return a shared  
instance - compare +[NSWorkspace sharedWorkspace], among many other  
methods in AppKit which use this pattern.


I am a little bit confused by this code. Since always we will create  
the controller in IB and then I think the instance will be created  
by IB, right? So is there any advanced features/reasons for this  
kind of usage?


Nope. All this does is define a variable - it doesn't allocate an  
instance. That'd have to happen in +initialize or something.

___

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

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

2008-06-24 Thread Shripada Hebbar


All default (implicit) animations are returned in the method:

+(id)defaultAnimationForKey:(NSString*)key

You can simply override this and just return nil. This would  mute out  
all implicit animations.
And if you want specific animations, you can set them into the  
animations dictionary of the view.


Refer:
http://developer.apple.com/documentation/Cocoa/Reference/NSAnimatablePropertyContainer_protocol/Introduction/Introduction.html


-Shripada


Hello, a (hopefully) quick question. I have a view which I would like
to use some Core Animation transitions on, so I've set it to
[theContentView setWantsLayer:YES]. However, this causes all of its
subviews to automatically gain fade transitions (which is the expected
behavior). However, some of the subviews are a WebView and an
IKImageBrowserView which apparently do not play nice with the
automatic transitions and create some ugly funky behavior (the image
browser view does not display anything at all). I simply want to
disable ALL implicit transitions/animations and only animate when I
explicitly tell the view to. How is this best accomplished?

Thanks so much,
Wil



---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.


___

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

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


Newbie question: instantiate a class in its header file OR in IB

2008-06-24 Thread JArod Wen

Hi Gurus,

I am a cocoa newbie from Java. Recently I found an example code in  
which the instance of a class is defined in its own class's header  
file, as following:


@interface AppController : NSObject {

// Instance variables here

}

AppController *appController;


And then this head file will be imported in MyDocument.h(there are  
methods using appController in MyDocument.m).


I am a little bit confused by this code. Since always we will create  
the controller in IB and then I think the instance will be created by  
IB, right? So is there any advanced features/reasons for this kind of  
usage?


In my opinion, I'd like to have a line of

IBOutlet AppController *appController;

in my MyDocument.h and then connect it with the appController in IB.  
Which implementation will be preferred by you?


Thanks in advance for any instructions!

---
JArod Wen




___

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

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

2008-06-24 Thread Scott Anguish

at the core animation level...

three options

1: disable actions in a explicit transaction and do everything inside  
that transaction


http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Transactions.html#/ 
/apple_ref/doc/uid/TP40006096-SW9


or 2:http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Actions.html#/ 
/apple_ref/doc/uid/TP40006095-SW9


basically, set the action to NSNull (listing 3)

3: override the default action method and return NSNull unless some  
condition you've already specified is true.


same chapter I think.


On Jun 24, 2008, at 6:11 PM, Wil Gieseler wrote:

Hello, a (hopefully) quick question. I have a view which I would  
like to use some Core Animation transitions on, so I've set it to  
[theContentView setWantsLayer:YES]. However, this causes all of its  
subviews to automatically gain fade transitions (which is the  
expected behavior). However, some of the subviews are a WebView and  
an IKImageBrowserView which apparently do not play nice with the  
automatic transitions and create some ugly funky behavior (the image  
browser view does not display anything at all). I simply want to  
disable ALL implicit transitions/animations and only animate when I  
explicitly tell the view to. How is this best accomplished?



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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-24 Thread Kyle Sluder
On Tue, Jun 24, 2008 at 6:55 PM, Jelle Vandebeeck
<[EMAIL PROTECTED]> wrote:
> It's the [NSSavePanel savePanel that gets the leak... I know the NSSavePanel
> is a singleton, so it should always use the same instance. Is that the
> problem when I try to call it multiple times in my application?

NSSavePanel and NSOpenPanel have some known memory issues on
Leopard... there was a crasher with any GC-enabled app and the open
panel until recently.  If you can definitively show that you're not
misusing NSSavePanel and it's leaking, you probably shouldn't worry
about it.

--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: Creating Installer Package from Cocoa

2008-06-24 Thread Thomas Bartelmess

Hi Ryan,
i have not unterstand your question completely.
Do you what to create a Installer pkg on the fly by code or do you  
what to create a InstallerPackage with some custom pages and settings.

Both is possible.
I would like to help you

Thomas


Am 24.06.2008 um 01:17 schrieb Ryan Harter:


Hey all-

I have a helper program that essentially only needs to create a  
plist for a different gui-less program.  This can be done manually,  
but I want a gui to aid users.  What I would like, is for the user  
to open this setup program, set some custom strings and other  
preferences, and have the setup program make a pkg including the  
plist that can then be deployed to all the macs.


Any thoughts,

Ryan
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/thomas.bartelmess%40yahoo.de

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]


Leak in NSSavePanel

2008-06-24 Thread Jelle Vandebeeck
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.


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... I know the  
NSSavePanel is a singleton, so it should always use the same instance.  
Is that the problem when I try to call it multiple times in my  
application?


Thnx for helping :)

Jelle
___

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

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

2008-06-24 Thread Graham Cox
Bear in mind that the typical purpose of a ControlRef in Carbon is to  
keep track of an associated wrapper object (or other extended data).  
In Cocoa, NSControl already is that object. The way to extend an  
object is to subclass it and add whatever ivars you need. So there  
would appear to be no need for an equivalent to a ControlRef in the  
Carbon sense.


What are you trying to do? Better advice might be available knowing  
that.


Graham


On 25 Jun 2008, at 4:53 am, [EMAIL PROTECTED] wrote:


Hi,

In Carbon you can tie a 32 bit value to a control with  
SetControlReference.  Is there an equivalent method in NSControl?  I  
looked around in the header files but couldn't find anything  
(NSControl, NSView, NSResponder, NSObject).


thanks
Jeff

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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]


Core Animation: Disabling Implicit Animations

2008-06-24 Thread Wil Gieseler
Hello, a (hopefully) quick question. I have a view which I would like  
to use some Core Animation transitions on, so I've set it to  
[theContentView setWantsLayer:YES]. However, this causes all of its  
subviews to automatically gain fade transitions (which is the expected  
behavior). However, some of the subviews are a WebView and an  
IKImageBrowserView which apparently do not play nice with the  
automatic transitions and create some ugly funky behavior (the image  
browser view does not display anything at all). I simply want to  
disable ALL implicit transitions/animations and only animate when I  
explicitly tell the view to. How is this best accomplished?


Thanks so much,
Wil
___

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

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

On Jun 24, 2008, at 7:15 AM, Adam R. Maxwell wrote:

On Jun 23, 2008, at 3:01 PM, John Calhoun wrote:
You can then either apply it to a context (in your PDFPage  
subclass) with:


- (BOOL) applyToContext:(CGContextRef) aContext;

Or better still, pass it in the options dictionary to one of  
PDFDocument's save routines (key == @"QuartzFilter"):


Should I file a bug asking for that key to be documented also?  And  
can that option be used when creating a CGPDFContext?  I'm sure I'll  
think of more questions :).  Since the OP was trying to stay in  
memory, I was avoiding the save routines.


The key is "documented" in PDFDocument.h.  :-)

Yes, you can apply the QuartzFilter to a CGPDFContext with the - 
[applyToContext:] call listed above.  And, yes, they should better  
document QuartzFilters ... they're nice.


I'm feeling dumb now, but I don't see how that helps?  You can  
insert a subclassed PDFPage in an empty PDFDocument, but then what  
do you do to use it with your PDF file?


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

John Calhoun—___

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

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

2008-06-24 Thread Markus Spoettl

On Jun 24, 2008, at 1:36 PM, Keary Suska wrote:
I would have each "row" of controls as a vanilla NSView in a  
separate nib.
Your controller class, which would be the nib owner, could manage  
each "set"

of controls. You'll need to familiarize yourself with nib loading
(particularly NSNib's methods) and the cocoa drawing system  
(particularly
views and subviews, and the coordinate system), at least. There may  
be more

that I am not thinking of.



In addition to what Keary Suska said, you can use NSViewController to  
manage the custom compound view located it's own NIB. NSViewController  
will manage memory, help with bindings and general management.  
Basically everyhing you would have to do manually otherwise.


NSViewController is available in 10.5.

See http://developer.apple.com/documentation/Cocoa/Reference/NSViewController_Class/Introduction/Introduction.html 
 for more information.


The basic steps are these:

1) create a custom NSViewController derived class (MyViewController)  
which will manage one row of controls in your UI (define outlets for  
one row)


2) create a view XIB/NIB in Xcode and set it up in IB.

3) In IB make sure you set the File's Owner class to your custom  
NSViewController class.


4) Set the view outlet of the File's Owner to your compound view in  
the XIB


5) Add other views, controls buttons and wire them to the outlets in  
the custom controller.


6) Prepare your main UI by setting up a container view that will host  
the compound view and create an outlet for that view (container).


7) In the main controller (the one that embeds the individual rows),  
create an instance of your view controller like this:


  myViewController = [[MyViewController alloc]  
initWithNibName:@"MyViewNib" bundle:nil];


(release it in -dealloc of that class).

8) Embed the compound view in your container using:

 [container addSubview:[myViewController view]];
 [[myViewController view] setFrame:];
 [[myViewController view] setHidden:NO];

9) You can also use NSViewControllers representedObject to wire  
bindings or add your own UI management code that loads and saves data.


10) Repeat steps 7-9 for each row you need to display.

In your case you would have an array of MyViewControllers than let you  
access the individual rows.


Hope this helps.

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: Custom Drag and Drop Cell for NSTableView

2008-06-24 Thread I. Savant
> I would like to create an own NSCell for a NSTableView.

http://developer.apple.com/documentation/Cocoa/Conceptual/ControlCell/ControlCell.html

> This cell should be dragable and I would like to draw the content of the
> Cell by my self (But it's text only).

  What do you mean by draggable? You want the entire contents of the
cell to be able to be dragged somewhere outside its bounds or you want
to drag something within it (like a slider cell)? Depending on your
answer, this could be answered in the link above or it could be a bit
more complicated. Specify.

  Regarding drawing, that *is* answered above and here:

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Introduction/chapter_1_section_1.html

> I would like to work with the cell in Interface Builder.

http://developer.apple.com/documentation/DeveloperTools/Conceptual/IBPlugInGuide/Introduction/chapter_1_section_1.html

> Could somebody help me to do that?

  Read the documentation first, then ask specific questions. Nobody's
going to walk you through what's already in the manuals.

--
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]


Custom Drag and Drop Cell for NSTableView

2008-06-24 Thread Thomas Bartelmess

Hello everyone!
I would like to create an own NSCell for a NSTableView.

This cell should be dragable and I would like to draw the content of  
the Cell by my self (But it's text only).

I would like to work with the cell in Interface Builder.

Could somebody help me to do that?

Thanks a lot

Thomas Bartelmess
___

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

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

2008-06-24 Thread Keary Suska
6/24/08 12:21 PM, also sprach [EMAIL PROTECTED]:

> Is there a way to use class objects that wrap multiple IBOutlet objects?
> 
> The app I am working on has groups of interface elements that are
> repeated on the interface and in the code. Let me see if I can
> illustrate what I mean:
> 
> The window looks (slightly) like this:
> 
> (button_set_src_1) (add) (delete) (halt) (progressbar1)
> (button_set_src_2) (add) (delete) (halt) (progressbar2)
> (button_set_src_3) (add) (delete) (halt) (progressbar3)
> 

> This is pretty klunky, and I would like something more like:
> @interface Element : NSObject
> {
> IBOutlet NSTextField  *src;
> IBOutlet NSProgressIndicator  *progressbar;
> IBOutlet NSTextField  *dest;
> IBOutlet NSButton *halt;
> IBOutlet NSButton *remove;
> IBOutlet NSTextField  *precentdone;
> }
> @end

> But, while the code part seems easy enough, I am not sure how it
> would work with Interface Builder. Is it possible to create a custom
> class like that (Element), and place instances of it on a window in
> IBuilder, hook up the controls in the code? Maybe someone can help me
> with terminology or examples? I know what I want, but I don't know
> enough about Cocoa yet to express it.

I would have each "row" of controls as a vanilla NSView in a separate nib.
Your controller class, which would be the nib owner, could manage each "set"
of controls. You'll need to familiarize yourself with nib loading
(particularly NSNib's methods) and the cocoa drawing system (particularly
views and subviews, and the coordinate system), at least. There may be more
that I am not thinking of.

HTH,

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Sourcelist background colors

2008-06-24 Thread Markus Spoettl

On Jun 24, 2008, at 1:13 PM, Dave DeLong wrote:

Sourcelist active background color:  RGB(214, 221, 229)  (#d6dde5)
Sourcelist inactive background color: RGB(232, 232, 232)  (#e8e8e8)

I got this by taking two screenshots and using the color palette's
magnifying glass.

This is what you're looking for, right?



Yes and no. Measuring the actual RGB values gives you what your system  
is displaying it with at the moment, not the computation that leads to  
that color - assuming such a computation takes place. Whether or not  
those are fixed values, I don't know. I guess that's part of the  
question (only Apple might be able to answer). I should have been more  
careful when asking. Sorry.


Thanks for your suggestion!

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: Sourcelist background colors

2008-06-24 Thread Dave DeLong
Sourcelist active background color:  RGB(214, 221, 229)  (#d6dde5)
Sourcelist inactive background color: RGB(232, 232, 232)  (#e8e8e8)

I got this by taking two screenshots and using the color palette's
magnifying glass.

This is what you're looking for, right?

HTH,

Dave

On Tue, Jun 24, 2008 at 1:57 PM, Markus Spoettl
<[EMAIL PROTECTED]> wrote:
> Hello List,
>
>  is there a way to get the background color of an NSOutlineView when in
> sourcelist mode (for both key and non-ket state)? NSColor doesn't seem to
> define the color. If not, is there a way to derive the color somehow, by
> blending or highlighting with another system defined color?
>
> Thanks for any pointers!
>
> Regards
> Markus
___

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

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


Sourcelist background colors

2008-06-24 Thread Markus Spoettl

Hello List,

  is there a way to get the background color of an NSOutlineView when  
in sourcelist mode (for both key and non-ket state)? NSColor doesn't  
seem to define the color. If not, is there a way to derive the color  
somehow, by blending or highlighting with another system defined color?


Thanks for any pointers!

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: SetControlReference equivalent in NSControl?

2008-06-24 Thread Kyle Sluder
On Tue, Jun 24, 2008 at 2:53 PM,  <[EMAIL PROTECTED]> wrote:
> In Carbon you can tie a 32 bit value to a control with SetControlReference.
>  Is there an equivalent method in NSControl?  I looked around in the header
> files but couldn't find anything (NSControl, NSView, NSResponder, NSObject).

What do you mean?  Something like -setTag:?  What is this used for and
why do you want to do it?

--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]


SetControlReference equivalent in NSControl?

2008-06-24 Thread jeffs87

Hi,

In Carbon you can tie a 32 bit value to a control with 
SetControlReference.  Is there an equivalent method in NSControl?  I 
looked around in the header files but couldn't find anything 
(NSControl, NSView, NSResponder, NSObject).


thanks
Jeff

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CFSocket and wifi

2008-06-24 Thread Jens Alfke


On 24 Jun '08, at 11:27 AM, sheen mac wrote:

I am working on a server-client application for live video broadcast  
using CFSocket.Its working good in LAN connection.But when I changed  
it into

wifi network .It gets blocked after a few seconds.


There's nothing fundamentally different. What's probably going on is  
some variation in timing that's exposing a bug in your code, most  
likely where you're handling reading or writing data.


Is there a reason  you're not using NSStream or CFStream instead?  
Those are higher-level APIs that are easier to work with (especially  
since NSStream is Objective-C.) My "MYNetwork" library includes a  
generic TCP client/listener; you could subclass those or just look at  
the code for hints.

http://mooseyard.com/hg/hgwebdir.cgi/MYNetwork/

—Jens___

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

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


CFSocket and wifi

2008-06-24 Thread sheen mac

Hi All,

I am working on a server-client application for live video broadcast using 
CFSocket.Its working good in LAN connection.But when I changed it into
wifi network .It gets blocked after a few seconds.

Kindly help me.

Thanks In Advance,
Sheen

Code
===

// create socket
mSocketRef = CFSocketCreate( kCFAllocatorDefault, PF_INET, SOCK_STREAM, 
IPPROTO_TCP,  kCallbackTypes,
(CFSocketCallBack)VideoSocket::_SocketCallBack, 
context );

  // Create socket runloop source
mRunLoopSource = CFSocketCreateRunLoopSource(kCFAllocatorDefault, 
mSocketRef, 0);
if(mRunLoopSource == NULL)
{
fprintf(stderr, "DCSocket::Failed to create runloop source" );
return false;
}

// add socket source to runloop
CFRunLoopAddSource(CFRunLoopGetCurrent(), mRunLoopSource, 
kCFRunLoopDefaultMode);
CFRelease(mRunLoopSource);





   
___

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

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


wrapping multiple IBOutlet objects for reuse

2008-06-24 Thread Paul Archibald

Is there a way to use class objects that wrap multiple IBOutlet objects?

The app I am working on has groups of interface elements that are  
repeated on the interface and in the code. Let me see if I can  
illustrate what I mean:


The window looks (slightly) like this:

(button_set_src_1) (add) (delete) (halt) (progressbar1)
(button_set_src_2) (add) (delete) (halt) (progressbar2)
(button_set_src_3) (add) (delete) (halt) (progressbar3)

And the code looks (slightly) like this:

IBOutlet NSTextField*src1;
IBOutlet NSProgressIndicator*progressbar1;
IBOutlet NSTextField*dest1;
IBOutlet NSButton   *halt1;
IBOutlet NSButton   *remove1;
IBOutlet NSTextField*precentdone1;

IBOutlet NSTextField*src2;
IBOutlet NSProgressIndicator*progressbar2;
IBOutlet NSTextField*dest2;
IBOutlet NSButton   *halt2;
IBOutlet NSButton   *remove3;
IBOutlet NSTextField*precentdone2;

IBOutlet NSTextField*src3;
IBOutlet NSProgressIndicator*progressbar3;
IBOutlet NSTextField*dest3;
IBOutlet NSButton   *halt3;
IBOutlet NSButton   *remove3;
IBOutlet NSTextField*precentdone3;

This is pretty klunky, and I would like something more like:
@interface Element : NSObject
{
IBOutlet NSTextField*src;
IBOutlet NSProgressIndicator*progressbar;
IBOutlet NSTextField*dest;
IBOutlet NSButton   *halt;
IBOutlet NSButton   *remove;
IBOutlet NSTextField*precentdone;
}
@end

...
Element *e1;
Element *e2;
Element *e3;

or even better, an array of Elements:

NSArray *elements [[NSArray alloc] initWithObjects:
e1, e2, e3];
 not sure exactly how to do this, but you get the idea..


But, while the code part seems easy enough, I am not sure how it  
would work with Interface Builder. Is it possible to create a custom  
class like that (Element), and place instances of it on a window in  
IBuilder, hook up the controls in the code? Maybe someone can help me  
with terminology or examples? I know what I want, but I don't know  
enough about Cocoa yet to express 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: NSTreeController filter contents

2008-06-24 Thread Jens Alfke


On 24 Jun '08, at 10:33 AM, Michael Hanna wrote:


So how does your tree controller know how to return FilteredItem
instead of Item?


The NSTreeController doesn't create any objects. It's entirely up to  
your model objects what children they return.


In what I'm doing, the tree controller never sees an Item directly,  
only FilteredItems, because -[FilteredItem children] returns an  
NSArray of FilteredItems. (It asks its Item for its children, then  
wraps each one in a new FilteredItem and returns an array of those.)


I thought you have to return the model class for the object  
controller that you set in the nib file.


No, it doesn't matter what class they are as long as they respond  
properly to the children/isLeaf/count selectors you specify. (It's  
"duck typing", as the Ruby people say.)


—Jens___

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

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

2008-06-24 Thread Michael Hanna
So how does your tree controller know how to return FilteredItem
instead of Item? I thought you have to return the model class for the
object controller that you set in the nib file. Also, how did you
manage to avoid duplicating subclasses of Item?

I tried a very simple form of filtering on the children method:

- (NSMutableArray *)children
{
NSAssert( m_guid != nil, @"unexpected nil value for m_children" );

NSLog(@"m_children %@", m_children);
NSMutableArray* filteredChildren = [NSMutableArray array];

NSEnumerator* en = [m_children objectEnumerator];

MFST_TreeElement* element = nil;
while ( element = [en nextObject] )
{
if( [element enabled] )
{
[filteredChildren addObject:element];
}

}

NSLog(@"filteredChildren %@", filteredChildren);

//return filteredChildren;

return m_children;
}

TreeElement is a superclass of RuleGroups and RuleElement. RuleGroups
is a non-leaf node, and RuleElement is a leaf node.

So in the code above if I comment-out "return m_children" and
un-comment filteredChildren, the NSTreeController doesn't draw
anything! Both arrays are empty. I find this bizarre behavior. But
running the code as it is returns the unfiltered array(which, in the
end isn't what I want). So I'm a bit unclear as to what to do next.
You used proxies to avoid this problem?

Michael

On Mon, Jun 23, 2008 at 6:09 PM, Jens Alfke <[EMAIL PROTECTED]> wrote:
>
> On 23 Jun '08, at 5:10 PM, Michael Hanna wrote:
>
>> How do I filter-out the contents of an NSTreeController? I saw an
>> example with NSArrayController by overriding the [NSArrayController
>> -arrangeObjects] method, but NSTreeController doesn't have this
>> method.
>
> I asked about this a month or two ago, and the consensus seemed to be that
> there isn't any built-in way to filter the contents of the tree.
>
> I've ended up doing the filtering myself. If we call my regular tree model
> class Item, then I've created a class FilteredItem. This acts as a proxy for
> an Item, but its -children method filters out the children I don't want to
> display, and returns FilteredItem proxies for those I do.
>
> —Jens
___

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

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


[SOLVED] Re: Core Data, abstract Entity problem

2008-06-24 Thread Alain Schartz


 Here's where you're mistaken. Only one *instance* is created: A
'TreeGroup' instance (which is a kind of TreeNode). The reason it's
only showing up in one place reliably is because the add: message is
being sent to *one* controller. Your other controller may not have
been informed that it needs to -fetch: to update its contents.
Hopefully that's enough of a push in the right direction for you to
research this more thoroughly ...

--
I.S.


Of course! The add: message is sent to only one controller, this  
explains the (not so odd after all) behaviour.


Thanks for the quick reply !
Alain
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 prevent NSControl from graying out when sent to background?

2008-06-24 Thread Greg

Thanks a bunch!!  :-)

- Greg

On Jun 24, 2008, at 12:32 PM, j o a r wrote:



On Jun 24, 2008, at 9:28 AM, Greg wrote:

Hi, I'm making little notification windows that contain some  
NSControls in them, one particular one is the NSProgressIndicator  
(as a bar).  These windows are similar to the default growl  
windows, and so appear above all other windows and appear "active"  
while actually being hosted by a background application.  As such,  
the progress indicator in one of them is grayed out, how do I  
prevent it from doing that?



Create a custom NSWindow / NSPanel subclass that overrides "- 
isKeyWindow" to always return YES.


j o a r




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSCalendarDate dayOfWeek

2008-06-24 Thread mmalc crawford


On Jun 24, 2008, at 10:04 AM, James Sugrue wrote:

In the docs it says that you should avoid using NSCalenderDate. I  
want to
get the dayOfWeek value. What would be the best way going forward  
instead of

using  NSCalendarDate dayOfWeek?

"For calendrical calculations, you should use suitable combinations of  
NSCalendar, NSDate, and NSDateComponents, as described in Calendars in  
Dates and Times Programming Topics for Cocoa."


-> 
http://developer.apple.com/documentation/Cocoa/Conceptual/DatesAndTimes/Articles/dtCalendars.html

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]


NSCalendarDate dayOfWeek

2008-06-24 Thread James Sugrue
In the docs it says that you should avoid using NSCalenderDate. I want to
get the dayOfWeek value. What would be the best way going forward instead of
using  NSCalendarDate dayOfWeek?

Cheers
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 prevent NSControl from graying out when sent to background?

2008-06-24 Thread j o a r


On Jun 24, 2008, at 9:28 AM, Greg wrote:

Hi, I'm making little notification windows that contain some  
NSControls in them, one particular one is the NSProgressIndicator  
(as a bar).  These windows are similar to the default growl windows,  
and so appear above all other windows and appear "active" while  
actually being hosted by a background application.  As such, the  
progress indicator in one of them is grayed out, how do I prevent it  
from doing that?



Create a custom NSWindow / NSPanel subclass that overrides "- 
isKeyWindow" to always return YES.


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


How to prevent NSControl from graying out when sent to background?

2008-06-24 Thread Greg
Hi, I'm making little notification windows that contain some  
NSControls in them, one particular one is the NSProgressIndicator (as  
a bar).  These windows are similar to the default growl windows, and  
so appear above all other windows and appear "active" while actually  
being hosted by a background application.  As such, the progress  
indicator in one of them is grayed out, how do I prevent it from doing  
that?


Thanks,

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: question on layer setup in Covertflow sample code

2008-06-24 Thread Scott Anguish

first, please don't crosspost between cocoadev and quartz-dev

the reflection is a sublayer of the image so that it will move the  
same.  rotate the layer with the image in it, the reflection also  
rotates.



the reflection layer uses additional Core Animation features to  
display only parts of the flipped image (a gradient in another layer  
that is set as the reflection layer's mask).


so setting the same imageon the reflection causes it to mask with the  
maskLayer that is set and display only a portion of the image that  
corresponds with the gradient.


hopefully that helps.


___

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

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

2008-06-24 Thread Chris


Hi,

No, I'm doing that all correctly. But now I seem to have changed  
something minor, but I'm not sure what, and now its working.  Now its  
copying the object across correctly when I call objectValue.


Anyway, thanks for the setObjectValue tip which was the key. I never  
would have guessed that one.



On 25/06/2008, at 12:52 AM, Jim Turner wrote:


On Tue, Jun 24, 2008 at 8:46 AM, Chris <[EMAIL PROTECTED]> wrote:


Hi!
This is very interesting information. Wish it was in the doco!
I have a custom view which wasn't responding to setObjectValue /
objectValue.
When I add those methods I find that on startup it does indeed copy  
the
values from object "C" to object "B". This means that when I  
retrieve the
values later on, instead of returning blank like before, it now  
returns the
old value instead of blank. However I need the new value! If it  
were to copy

the values across AFTER the user made changes or prior to me calling
objectValue, then it would work. I thought maybe [rulePredicateEditor
reloadPredicate] sounded like it might do it perhaps, but that  
doesn't help
either. Once the user hits ok, we are still left with bogus values  
from

object "B", albeit now old values instead of nil values.


How are you accessing your custom view's object value?  It almost
sounds like you're asking your original custom view for it's value
each time instead of the object currently being displayed.

When you create your template and insert your custom view, make sure
to keep a reference to that specific object so you can query it later
on.

@interface CustomPredicateEditorRowTemplate :  
NSPredicateEditorRowTemplate

{
CustomTextField *myTextField;
}
-(CustomTextField *) myTextField;
@end

@implementation CustomPredicateEditorRowTemplate
-(CustomTextField *) myTextField
{
if( !myTextField )
   // init your view

return( myTextField );
}

- (NSArray *)templateViews
{
   return( [[super templateViews] arrayByAddingObject:[self  
myTextField]] );

}

-(void) dealloc
{
[myTextField release];
[super dealloc];
}

- (NSPredicate *)predicateWithSubpredicates:(NSArray *)subpredicates
{
   id objectValue = [[self myTextField] objectValue];
   // Do magical things with objectValue
}
@end


--
Jim
http://nukethemfromorbit.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: Seconds since system startup

2008-06-24 Thread Stefan Hafeneger

Hi,

Thanks for your help. I now use UpTime() because I dont't have to do  
anything in a Cocoa app to get this running. I use the following code  
to get the timestamp:


double timestamp = (double)(AbsoluteToDuration(UpTime())) / 1000.0;

Then I use this timestamp to create NSEvents.

With best wishes, Stefan


Am 24.06.2008 um 15:11 schrieb Jean-Daniel Dupas:


Sorry, it look easy with sysctl too.
That just that I had some bad experiences with sysctl to retreive  
some poorely documented values and structs.



Le 24 juin 08 à 15:07, Jean-Daniel Dupas a écrit :


Wow, that one of the more complexe way i see to retreive it.

The former equivalent of GetCurrentEventTime() is -[NSEvent  
timestamp].


But if you need the uptime without using an event, you can use  
mach_absolute_time() or UpTime() (from the CoreServices framework).



Le 24 juin 08 à 15:00, Chris a écrit :




Do a

man 3 sysctl

in the terminal and look for KERN_BOOTTIME






On 24/06/2008, at 10:51 PM, Stefan Hafeneger wrote:


Hi,

I'm looking for a Cocoa function like GetCurrentEventTime() for  
Carbon to get the interval since system startup. Any ideas?


With best wishes,  
Stefan___


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

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/ 
idou747%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/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]




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: Cocoa Text System: How to determine the caret position?

2008-06-24 Thread Douglas Davidson


On Jun 23, 2008, at 7:30 PM, Graham Cox wrote:

Yes, fair enough the problem is more complicated than I realised - I  
guess I assumed that insertion points were always in between glyphs  
but of course with ligatures etc. that isn't the case.


Going back to the OP's original reason for this, My feeling is that  
he's going about it the wrong way. Core Text isn't a text editing  
framework, it's a text layout framework. I thought that using  
Cocoa's text system you can get text editing as well as layout for  
arbitrary text containers including text on a path or vertical text.  
However it's one thing to say it's possible and another to suggest  
how to do it, and I don't have the expertise to do that. But  
reinventing your own text editor from scratch seems like a lot of  
unnecessary work.


Yes, reinventing your own text editor is an enormous amount of work.   
Using a custom text container will get you text laid out within a  
shape, though, which is not the same thing as text laid out on a  
path.  Subclassing NSLayoutManager and overriding the drawing methods  
would enable you to take text laid out conventionally in lines and  
draw it on a path--cf. the CircleView example--but for editing  
purposes one would need more, such as hit-testing, drawing highlights,  
maybe drawing underlines, etc.  That might be possible by overriding  
more methods in an NSLayoutManger subclass, and maybe an NSTextView  
subclass, but I haven't tried it.  Vertical text has its own  
challenges--a minimal version could be obtained by simply rotating  
glyphs 90 degrees and rotating the view 90 degrees the other way, but  
most clients would probably want more than that.


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: NSSegmentedControl segment bindings

2008-06-24 Thread Ron Lue-Sang

Hey Hamish.

Yea, that's correct. There's no "segment" object to bind. Not in the  
same way that tableviews have individual column objects or menus have  
individual menu items.


Still, go ahead and file an enhancement request describing, broadly,  
what you're trying to do.


-
RONZILLA

On Jun 24, 2008, at 6:42 AM, Hamish Allan <[EMAIL PROTECTED]> wrote:


Hi,

As far as I can tell, the enabled state of specific segments of an
NSSegmentedControl (which you can set / get through
setEnabled:forSegment: / -isEnabledForSegment:) are not accessible
through bindings. This surprises me, so I thought I'd ask here in case
I'm missing something?

Thanks,
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/luesang%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: NSPredicateEditorRowTemplate

2008-06-24 Thread Jim Turner
On Tue, Jun 24, 2008 at 8:46 AM, Chris <[EMAIL PROTECTED]> wrote:
>
> Hi!
> This is very interesting information. Wish it was in the doco!
> I have a custom view which wasn't responding to setObjectValue /
> objectValue.
> When I add those methods I find that on startup it does indeed copy the
> values from object "C" to object "B". This means that when I retrieve the
> values later on, instead of returning blank like before, it now returns the
> old value instead of blank. However I need the new value! If it were to copy
> the values across AFTER the user made changes or prior to me calling
> objectValue, then it would work. I thought maybe [rulePredicateEditor
> reloadPredicate] sounded like it might do it perhaps, but that doesn't help
> either. Once the user hits ok, we are still left with bogus values from
> object "B", albeit now old values instead of nil values.

How are you accessing your custom view's object value?  It almost
sounds like you're asking your original custom view for it's value
each time instead of the object currently being displayed.

When you create your template and insert your custom view, make sure
to keep a reference to that specific object so you can query it later
on.

@interface CustomPredicateEditorRowTemplate : NSPredicateEditorRowTemplate
{
CustomTextField *myTextField;
}
-(CustomTextField *) myTextField;
@end

@implementation CustomPredicateEditorRowTemplate
-(CustomTextField *) myTextField
{
if( !myTextField )
// init your view

return( myTextField );
}

- (NSArray *)templateViews
{
return( [[super templateViews] arrayByAddingObject:[self myTextField]] );
}

-(void) dealloc
{
[myTextField release];
[super dealloc];
}

- (NSPredicate *)predicateWithSubpredicates:(NSArray *)subpredicates
{
id objectValue = [[self myTextField] objectValue];
// Do magical things with objectValue
}
@end


-- 
Jim
http://nukethemfromorbit.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: PDFKit guidance

2008-06-24 Thread Adam R. Maxwell

On Jun 23, 2008, at 3:01 PM, John Calhoun wrote:


On Jun 21, 2008, at 6:34 PM, Adam R. Maxwell wrote:
I appreciated Antonio's (and your) reminder :).  If I understand  
correctly, the OP could create a PDF context with  
kCGPDFXDestinationOutputProfile set to a grayscale profile


QuartzFilters make all that a lot simpler. You would create a  
QuartzFilter that does grayscale (look at ColorSync Utility for  
examples and how to create them).  The load the QuartzFilter with:


 + (QuartzFilter*) quartzFilterWithURL:(NSURL*) aURL;


Indeed...that QuartzFilter class sounds cool, so I just filed rdar:// 
problem/6030284 asking that it be documented.  Prior to your post, I'd  
never heard of it, Xcode's doc browser drew a blank, and google just  
turned up the list of 10.5 symbol changes.


You can then either apply it to a context (in your PDFPage subclass)  
with:


 - (BOOL) applyToContext:(CGContextRef) aContext;

Or better still, pass it in the options dictionary to one of  
PDFDocument's save routines (key == @"QuartzFilter"):


Should I file a bug asking for that key to be documented also?  And  
can that option be used when creating a CGPDFContext?  I'm sure I'll  
think of more questions :).  Since the OP was trying to stay in  
memory, I was avoiding the save routines.


Subclassing PDFPage apparently requires 10.5, also, unless I'm  
missing something.


Not strictly speaking.  You can subclass PDFPage in 10.4 but you  
will not be able to get PDFDocument to create instances of your  
subclass when handed a PDF file (i.e. through -[PDFDocument  
initWithURL:]).  You can however still create an empty PDFDocument  
on 10.4 and -insertPage your subclassed PDFPage.


I'm feeling dumb now, but I don't see how that helps?  You can insert  
a subclassed PDFPage in an empty PDFDocument, but then what do you do  
to use it with your PDF file?


thanks,
Adam
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Learning SQLite by watching Core Data?

2008-06-24 Thread Allen Cronce

Hi David,

We're also developing an SQLite3-based database application.  
Unfortunately we can't use Core Data because we're building a cross  
platform product. But we wanted to use Xcode's data modeler tool to  
design a fairly complex database model.


To help us implement our application, we're using LiteSQL as the ORM  
framework. LiteSQL is an open source toolset that allows a developer  
to automatically create a C++ persistent class implementation from an  
XML representation of the database schema. While not as full featured  
as Core Data, LiteSQL is lightweight, easy to use, and fast.


In order to make LiteSQL work well with Xcode, I created a set of  
scripts that allow us to automatically generate the LiteSQL persistent  
class source code from the Xcode authored database model. The scripts  
use a tool called "mogenerator", written by Jonathan ‘Wolf’ Rentzsch,  
in conjunction with custom templates. With these tools in place, we  
can change the database model and rebuild, automatically regenerating  
the corresponding LiteSQL sources used to access our database.


If this sounds interesting, you might want to take a look at LiteSQL  
here:


http://litesql.sourceforge.net/

And here's where you can find information about the "LiteSQL Xcode  
Support" package that we gave to the LiteSQL community:


http://litesql.sourceforge.net/xcode.html

Note that we did have to tweak the library a little to get it to work  
the way we wanted. We had to work around issues with their date  
support, and obscured table names. See my posts to the LiteSQL mailing  
list for details:


http://sourceforge.net/mailarchive/forum.php?forum_name=litesql-users

On a related note, one of my coworkers pointed out that Core Data is  
not currently available on the iPhone. This means that developers who  
wish to create iPhone applications on top of SQLite3 really don't have  
a high level data modeling solution.


But we think that it should be fairly easy to use LiteSQL and the  
scripts we've pulled together to develop iPhone database applications.  
Sure the LiteSQL library would have to be built for the iPhone, but  
that shouldn't be difficult. LiteSQL builds easily for any platform  
that uses gcc. In fact, it builds out of the box for Mac OS X with no  
problems.


Best,
--
Allen Cronce


On Jun 23, 2008, at 2:35 PM, David Carlisle wrote:

I am studying an application design by implementing it with Core  
Data, then studying how I would move it to a platform where only  
sqlite is available.


I appreciate the book recommendations.  I found where the Definitive  
Guide to SQLite is available as an ebook, so I might go that route.   
Otherwise it is listed for 2-5 weeks.


I'm happy with my approach.  I modified ISavant's suggested Unix  
statement, realizing I needed a .sqlite suffix after my document  
name to make it work, so that answered that question.


Ilan noted that Core Data does "undocumented voodoo" with sqlite,  
which is good to be aware of.


I think poking around with sqlite3 and browsing the sqlite header  
file suggests questions for when I buy the book.


DC

On Jun 23, 2008, at 2:14 PM, Ben Trumbull wrote:


David,

I highly recommend these two books:







Now I want to recreate the same thing using just SQLite.  I don't  
know SQLite, and I know very little Unix.


Why do you want to use SQLite directly ?  I don't think it's  
currently a good fit for your self described skill level.  If  
you're simply interested in learning, pick up those books, and  
maybe one or two on UNIX, and hack at it.

--

-Ben


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/allenslists%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: Core Data, abstract Entity problem

2008-06-24 Thread I. Savant
> I could need some help with a Core Data related problem I am experiencing, 
> and I am not entirely sure I understand everything Cocoa does behind my back. 
> In more detail :

  It'd be best if you'd post specific questions regarding what you
believe and what you're unsure of. This is essential if you wish to
succeed with this advanced Cocoa topic.

> In Interface Builder, I dragged two "Core Data Entity" library objects on my 
> window - one for the TreeNode entity, one for the TreeGroup entity. Again, I 
> did not change anything except for choosing a Master/Detail view and 
> specifying the addition of Add/Remove buttons.

  Why do you want views for both the abstract and the concrete? A view
for TreeNode will show all kinds of TreeNode (TreeGroup and anything
else). Is this really what you want?

> Ok, what I expect to see when I run this and click the "Add TreeGroup" button 
> is a TreeGroup object appearing in the TreeGroup table view (this works all 
> right) and SIMULTANOUSLY a TreeNode "object" (I don't know if this is 
> supposed to be an object since the Entity is abstract) in the TreeNode table 
> view. The problem is, the TreeNode object sometimes appears as soon as I 
> press the add button, sometimes I have to enter a view with the mousepointer 
> for it to appear. No need to say that this is very irritating.

  Here's where you're mistaken. Only one *instance* is created: A
'TreeGroup' instance (which is a kind of TreeNode). The reason it's
only showing up in one place reliably is because the add: message is
being sent to *one* controller. Your other controller may not have
been informed that it needs to -fetch: to update its contents.
Hopefully that's enough of a push in the right direction for you to
research this more thoroughly ...

--
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: NSPredicateEditorRowTemplate

2008-06-24 Thread Chris


Hi!

This is very interesting information. Wish it was in the doco!

I have a custom view which wasn't responding to setObjectValue /  
objectValue.


When I add those methods I find that on startup it does indeed copy  
the values from object "C" to object "B". This means that when I  
retrieve the values later on, instead of returning blank like before,  
it now returns the old value instead of blank. However I need the new  
value! If it were to copy the values across AFTER the user made  
changes or prior to me calling objectValue, then it would work. I  
thought maybe [rulePredicateEditor reloadPredicate] sounded like it  
might do it perhaps, but that doesn't help either. Once the user hits  
ok, we are still left with bogus values from object "B", albeit now  
old values instead of nil values.





On 24/06/2008, at 11:02 PM, Jim Turner wrote:


On Tue, Jun 24, 2008 at 2:02 AM, Chris <[EMAIL PROTECTED]> wrote:
When the user clicks ok, then I call objectValue on the  
NSPredicateEditor
and it calls predicateWithSubpredicates not on object "C", but on  
object
"B", which is always going to be blank, because it is in fact  
object "C"
which is the one displayed. Thus I can never retrieve values from  
the row.
This phantom and unexplained object "B" that is created during NIB  
loading

suddenly seems to be the one it cares about.

I'm not sure where to go next. Has anyone got any advice?


Hi Chris,

I saw this very same behavior and was fortunate enough to get the
following explanation from Peter Ammon:

"A single row may be composed of views from multiple templates.  When
it's time to construct a predicate for that row, we pick one template,
and if its views are not actually in the row, we call objectValue on
the view in the row, and then setObjectValue: on the corresponding
view in your template.

Due to a bug, this happens more often than it should :(

What this means for your NSTextField subclass is that it should do the
right thing for objectValue and setObjectValue:.  The object value of
your view should encapsulate all the state your template needs to
compute that portion of the predicate."

The short answer, for me at least, was to make sure my custom
NSTextField in my template handled objectValue/setObjectValue:
properly.  That way, when predicateWithSubpredicates: is called, the
internals of the editor can pass around the values needed to properly
compute the predicate.

--
Jim
http://nukethemfromorbit.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]


Core Data, abstract Entity problem

2008-06-24 Thread Alain Schartz
Dear List.

I could need some help with a Core Data related problem I am experiencing, and 
I am not entirely sure I understand everything Cocoa does behind my back. In 
more detail :

I created a Core Data document based project from scratch. The Core Data model 
consists of an abstract TreeNode entity (containing a displayText attribute of 
type string with a default value of "New TreeNode", simply to have something to 
display) and of a TreeGroup entity (with parent set to TreeNode). It may be 
important to note that I did not change anything else, the entities' custom 
classes were left at NSManagedObject.

In Interface Builder, I dragged two "Core Data Entity" library objects on my 
window - one for the TreeNode entity, one for the TreeGroup entity. Again, I 
did not change anything except for choosing a Master/Detail view and specifying 
the addition of Add/Remove buttons.

Ok, what I expect to see when I run this and click the "Add TreeGroup" button 
is a TreeGroup object appearing in the TreeGroup table view (this works all 
right) and SIMULTANOUSLY a TreeNode "object" (I don't know if this is supposed 
to be an object since the Entity is abstract) in the TreeNode table view. The 
problem is, the TreeNode object sometimes appears as soon as I press the add 
button, sometimes I have to enter a view with the mousepointer for it to 
appear. No need to say that this is very irritating.

This is driving me nuts, as you can see there cannot be any code interfering 
simply because there is none. So all that's left is a misconception on my part, 
and I was hoping one of you guys could point me in the right direction on this 
one.

Much obliged,
Alain

P.S. This is actually a bounce of my "Core Data / Bindings problem: context not 
notified of add: ?" thread I posted on 6/18; Quincy Morris suggested that I 
reformulate my question as it was not very clear. Sorry for pestering you 
guys...
___

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

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


NSSegmentedControl segment bindings

2008-06-24 Thread Hamish Allan
Hi,

As far as I can tell, the enabled state of specific segments of an
NSSegmentedControl (which you can set / get through
setEnabled:forSegment: / -isEnabledForSegment:) are not accessible
through bindings. This surprises me, so I thought I'd ask here in case
I'm missing something?

Thanks,
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: Seconds since system startup

2008-06-24 Thread Jean-Daniel Dupas

Sorry, it look easy with sysctl too.
That just that I had some bad experiences with sysctl to retreive some  
poorely documented values and structs.



Le 24 juin 08 à 15:07, Jean-Daniel Dupas a écrit :


Wow, that one of the more complexe way i see to retreive it.

The former equivalent of GetCurrentEventTime() is -[NSEvent  
timestamp].


But if you need the uptime without using an event, you can use  
mach_absolute_time() or UpTime() (from the CoreServices framework).



Le 24 juin 08 à 15:00, Chris a écrit :




Do a

man 3 sysctl

in the terminal and look for KERN_BOOTTIME






On 24/06/2008, at 10:51 PM, Stefan Hafeneger wrote:


Hi,

I'm looking for a Cocoa function like GetCurrentEventTime() for  
Carbon to get the interval since system startup. Any ideas?


With best wishes,  
Stefan___


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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%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/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]




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: Seconds since system startup

2008-06-24 Thread Jean-Daniel Dupas

Wow, that one of the more complexe way i see to retreive it.

The former equivalent of GetCurrentEventTime() is -[NSEvent timestamp].

But if you need the uptime without using an event, you can use  
mach_absolute_time() or UpTime() (from the CoreServices framework).



Le 24 juin 08 à 15:00, Chris a écrit :




Do a

man 3 sysctl

in the terminal and look for KERN_BOOTTIME






On 24/06/2008, at 10:51 PM, Stefan Hafeneger wrote:


Hi,

I'm looking for a Cocoa function like GetCurrentEventTime() for  
Carbon to get the interval since system startup. Any ideas?


With best wishes,  
Stefan___


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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%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/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]





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: NSPredicateEditorRowTemplate

2008-06-24 Thread Jim Turner
On Tue, Jun 24, 2008 at 2:02 AM, Chris <[EMAIL PROTECTED]> wrote:
> When the user clicks ok, then I call objectValue on the NSPredicateEditor
> and it calls predicateWithSubpredicates not on object "C", but on object
> "B", which is always going to be blank, because it is in fact object "C"
> which is the one displayed. Thus I can never retrieve values from the row.
> This phantom and unexplained object "B" that is created during NIB loading
> suddenly seems to be the one it cares about.
>
> I'm not sure where to go next. Has anyone got any advice?

Hi Chris,

I saw this very same behavior and was fortunate enough to get the
following explanation from Peter Ammon:

"A single row may be composed of views from multiple templates.  When
it's time to construct a predicate for that row, we pick one template,
and if its views are not actually in the row, we call objectValue on
the view in the row, and then setObjectValue: on the corresponding
view in your template.

Due to a bug, this happens more often than it should :(

What this means for your NSTextField subclass is that it should do the
right thing for objectValue and setObjectValue:.  The object value of
your view should encapsulate all the state your template needs to
compute that portion of the predicate."

The short answer, for me at least, was to make sure my custom
NSTextField in my template handled objectValue/setObjectValue:
properly.  That way, when predicateWithSubpredicates: is called, the
internals of the editor can pass around the values needed to properly
compute the predicate.

-- 
Jim
http://nukethemfromorbit.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: Seconds since system startup

2008-06-24 Thread Chris



Do a

 man 3 sysctl

in the terminal and look for KERN_BOOTTIME






On 24/06/2008, at 10:51 PM, Stefan Hafeneger wrote:


Hi,

I'm looking for a Cocoa function like GetCurrentEventTime() for  
Carbon to get the interval since system startup. Any ideas?


With best wishes,  
Stefan___


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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%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: Allocating outlets from NIB file

2008-06-24 Thread Andy Lee

On Jun 24, 2008, at 8:17 AM, Joseph Ayers wrote:

SpriteController and SpriteView are defined and connected in the NIB


Your nib shouldn't contain a SpriteController instance.  Instead, it  
should set the class of File's Owner to SpriteController and make the  
outlet connection from File's Owner to your SpriteView.  Your code  
below will then do the right thing -- it creates a SpriteController  
instance and tells the nib file to use that as the File's Owner when  
it is loaded.



When I open the NIB with

-(void)loadSpriteController{
  if (spriteController == NULL) {
  spriteController = [[SpriteController alloc] init];
if (![NSBundle loadNibNamed:@"spriteWindow"  
owner:spriteController]) {

   NSLog(@"Error loading SpriteController");}
  else{
   NSLog(@"SpriteController NIB Loaded");   }
  }

}



--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]


Seconds since system startup

2008-06-24 Thread Stefan Hafeneger

Hi,

I'm looking for a Cocoa function like GetCurrentEventTime() for Carbon  
to get the interval since system startup. 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: Allocating outlets from NIB file

2008-06-24 Thread Chris


Hi,

You should not be allocating either SpriteView or SpriteController if  
they are referred to in the NIB. (which is the normal case).


Instead you go to the File's Owner object in interface builder, and go  
to the Identity tab, and set the Class to be whatever class contains  
your loadNib statement. ONLY load the NIB, don't attempt to create  
windows, views or controllers. (Let's call this class that loads the  
NIB as class "A".). Now you add some outlets to class "A" called  
spriteView, spriteWIndow, spriteController or whatever else you need.  
Then in interface builder you connect these outlets of "File's Owner"  
to those objects. Now when you load the NIB, you'll have pointers to  
all the objects you care about in the same object that loaded the NIB.






On 24/06/2008, at 10:17 PM, Joseph Ayers wrote:

I am quite confounded with regard to how/when to allocate outlets  
which are classes existing as instances in

another class. Consider

@interface SpriteController : NSWindowController {
  IBOutlet  SpriteView* spriteView;
  IBOutlet  NSWindow* spriteWindow;
}

SpriteController* spriteController;

- (id)spriteWindow;
- (id)spriteView;
-(void)setSpriteView:(SpriteView*)view;
}

SpriteView is defined in another subclass as:

@interface SpriteView: NSView
{
  NSImage  *spriteImage;
}

SpriteController and SpriteView are defined and connected in the NIB

When I open the NIB with

-(void)loadSpriteController{
  if (spriteController == NULL) {
  spriteController = [[SpriteController alloc] init];
if (![NSBundle loadNibNamed:@"spriteWindow"  
owner:spriteController]) {

   NSLog(@"Error loading SpriteController");}
  else{
   NSLog(@"SpriteController NIB Loaded");   }
  }

}

spriteController gets a pointer, but spriteView is NIL.  All  
subsequent messages to spriteView are

messages to NIL

How/where should I be allocating spriteView. I've tried adding:

  [self setSpriteView: [[SpriteView alloc] init]];

to loadSpriteController with no consequence. spriteView gets a  
pointer but


  [[spriteController spriteView] drawRect:[[spriteController  
spriteWindow] bounds]];

does not get to drawRect

ja


--
Joseph Ayers, Professor
Department of Biology and
Marine Science Center
Northeastern University
East Point, Nahant, MA 01908
Phone (781) 581-7370 x309(office), x335(lab)
Cellular (617) 755-7523, FAX: (781) 581-6076 Boston Office 444RI,  
(617) 373-4044

eMail: [EMAIL PROTECTED]
http://www.neurotechnology.neu.edu/

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%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: Allocating outlets from NIB file

2008-06-24 Thread Johan Kool
You do not allocate outlets. Outlets point to instances in your nib.  
These instances are instantiated(/allocated) when the nib is loaded.  
You usually set the File's Owner to be a your own subclass of  
NSWindowController. Next control-drag from the File's Owner icon to  
the window and the view to connect the outlets. (Btw, you can probably  
better use the window outlet from the NSWindowController instead of  
your spriteWindow outlet, though the latter may be needed if you  
manage multiple related windows with one controller.)


You create your controller with this:
spriteController = [[SpriteController alloc]  
initWithWindowNibName:@"YourNib"];


and to show the window you use:
[[spriteController window] makeKeyAndOrderFront:self];
or
[[spriteController spriteWindow] makeKeyAndOrderFront:self];

The drawRect: method of your SpriteView will get called automatically.  
You do not need to do this yourself. You can force a view to update  
its drawing using the method setNeedsDisplay:.


Btw, this:
[self setSpriteView: [[SpriteView alloc] init]];

will cause you to leak memory. Use this pattern:
SpriteView *mySpriteView = [SpriteView alloc] init];
[self setSpriteView: mySpriteView];
[mySpriteView release];

thought it should be noted that this is an uncommon way to instantiate  
a view. (Usually done in nibs, and through the initWithFrame: method,  
after which it is added as a subview to another view.)


Hth,

Johan

Op 24 jun 2008, om 14:17 heeft Joseph Ayers het volgende geschreven:

I am quite confounded with regard to how/when to allocate outlets  
which are classes existing as instances in

another class. Consider

@interface SpriteController : NSWindowController {
 IBOutlet  SpriteView* spriteView;
 IBOutlet  NSWindow* spriteWindow;
}

SpriteController* spriteController;

- (id)spriteWindow;
- (id)spriteView;
-(void)setSpriteView:(SpriteView*)view;
}

SpriteView is defined in another subclass as:

@interface SpriteView: NSView
{
 NSImage  *spriteImage;
}

SpriteController and SpriteView are defined and connected in the NIB

When I open the NIB with

-(void)loadSpriteController{
 if (spriteController == NULL) {
 spriteController = [[SpriteController alloc] init];
   if (![NSBundle loadNibNamed:@"spriteWindow"  
owner:spriteController]) {

  NSLog(@"Error loading SpriteController");}
 else{
  NSLog(@"SpriteController NIB Loaded");   }
 }

}

spriteController gets a pointer, but spriteView is NIL.  All  
subsequent messages to spriteView are

messages to NIL

How/where should I be allocating spriteView. I've tried adding:

 [self setSpriteView: [[SpriteView alloc] init]];

to loadSpriteController with no consequence. spriteView gets a  
pointer but


 [[spriteController spriteView] drawRect:[[spriteController  
spriteWindow] bounds]];

does not get to drawRect

ja


--
Joseph Ayers, Professor
Department of Biology and
Marine Science Center
Northeastern University
East Point, Nahant, MA 01908
Phone (781) 581-7370 x309(office), x335(lab)
Cellular (617) 755-7523, FAX: (781) 581-6076 Boston Office 444RI,  
(617) 373-4044

eMail: [EMAIL PROTECTED]
http://www.neurotechnology.neu.edu/

___

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

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

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

This email sent to [EMAIL PROTECTED]


---
http://www.johankool.nl/




___

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

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


Allocating outlets from NIB file

2008-06-24 Thread Joseph Ayers
I am quite confounded with regard to how/when to allocate outlets which 
are classes existing as instances in

another class. Consider

@interface SpriteController : NSWindowController {
   IBOutlet  SpriteView* spriteView;
   IBOutlet  NSWindow* spriteWindow;
}

SpriteController* spriteController;

- (id)spriteWindow;
- (id)spriteView;
-(void)setSpriteView:(SpriteView*)view;
}

SpriteView is defined in another subclass as:

@interface SpriteView: NSView
{
   NSImage  *spriteImage;
}

SpriteController and SpriteView are defined and connected in the NIB

When I open the NIB with

-(void)loadSpriteController{
   if (spriteController == NULL) {
   spriteController = [[SpriteController alloc] init];
  
   if (![NSBundle loadNibNamed:@"spriteWindow" 
owner:spriteController]) {

NSLog(@"Error loading SpriteController");}
   else{
NSLog(@"SpriteController NIB Loaded");   
}

   }

}

spriteController gets a pointer, but spriteView is NIL.  All subsequent 
messages to spriteView are

messages to NIL

How/where should I be allocating spriteView. I've tried adding:

   [self setSpriteView: [[SpriteView alloc] init]];

to loadSpriteController with no consequence. spriteView gets a pointer but

   [[spriteController spriteView] drawRect:[[spriteController 
spriteWindow] bounds]];  


does not get to drawRect


ja


--
Joseph Ayers, Professor
Department of Biology and
Marine Science Center
Northeastern University
East Point, Nahant, MA 01908
Phone (781) 581-7370 x309(office), x335(lab)
Cellular (617) 755-7523, FAX: (781) 581-6076 
Boston Office 444RI, (617) 373-4044

eMail: [EMAIL PROTECTED]
http://www.neurotechnology.neu.edu/

___

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

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

2008-06-24 Thread Ian
Here are my findings thanks to the great advice to all those that  
answered.


First and foremost - I was testing on an elderly G5 iMac, so fetching  
~million objects was taking 4 minutes.

I think this is definitely down to paging the VM as someone suggested.
Here on my main machine (8 cores, gigs of ram) the same fetch takes  
around 9 seconds.


Unbelievably I hadn't [request setIncludesPropertyValues:NO], so was  
getting properties on everything.
As I'm fetching primarily to feed an IKImageBrowserView, it makes  
sense to fault the data in when needed.

This brings my fetch down from 9 seconds to 0.5 - much nicer.

I was pulling in all objects with a predicateWithValue:YES.
Changing this to a predicate on an indexed UID (eg to get all, fetch  
where > 0) brings the query time down to 0.3 seconds.


Bringing in just IDs speeds things up even more.

All of the above is obvious I'm sure but great thanks are due for your  
suggestions and advice - I may not be a CoreData newbie but I  
certainly am rank amateur!


Thanks again to all,
Ian
___

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

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

2008-06-24 Thread David Reynolds


On 23 Jun 2008, at 1:32 am, William Squires wrote:

  Assuming you've followed the RaiseMan example up to that point,  
and have IB open, select the 1st column of the NSTableView (in  
MyDocument.nib - or .xib, depending on your Xcode version), and  
examine its properties with the inspector window.
  Make sure the sortKey is personName.length, and the selector is  
"compare:". If that doesn't work, delete the text for the sort key  
and try again. If it still doesn't work, then something isn't  
connected to the ArrayController properly. Otherwise, you should be  
able to get it to work with that key path.

  HTH!



It helped me ;)

Thanks William.

--
David Reynolds
[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]


NSPredicateEditorRowTemplate

2008-06-24 Thread Chris
I've got a NSPredicateEditor and I'm inheriting from
NSPredicateEditorRowTemplate to make a custom template. It implements
copyWithZone as the doco seems to imply I should. In Interface builder I
have a number of standard row templates, and I've added my custom one at the
end by setting the class in the identity pane.

When I load the nib containing the NSPredicateEditor, for some reason it
calls copyWithZone on my custom NSPredicateEditorRowTemplate during the nib
loading process. Let's call this object passed to copyWithZone as object
"A", and I return from copyWithZone as instance "B". So now there are two
instances created during the nib loading process. Nothing in the
documentation seems to explain why this would happen during nib
loading. From my reading of the doco, it should only get called when I do a
setObjectValue on the NSPredicateEditor.
Anyway, when I call setObjectValue, it does indeed call copyWithZone again
with object "A" and creates another object. Let's call this one "C". It then
calls setPredicate on object "C" as you'd expect, whereupon I populate the
fields of MyCustomPredicateRowTemplate.

When the user clicks ok, then I call objectValue on the NSPredicateEditor
and it calls predicateWithSubpredicates not on object "C", but on object
"B", which is always going to be blank, because it is in fact object "C"
which is the one displayed. Thus I can never retrieve values from the row.
This phantom and unexplained object "B" that is created during NIB loading
suddenly seems to be the one it cares about.

I'm not sure where to go next. Has anyone got any advice?
___

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

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

Hi Markus.

Maybe you can become the delegate of the field editor instead then.

-Kenny


On Jun 23, 2008, at 11:41 PM, Markus Spoettl wrote:

Hi Kenny,

On Jun 23, 2008, at 9:39 PM, Kenny Leung wrote:
NSTextField is a single-line entry control, so it wants to end  
editing when you hit return. In order to be notified, you should  
wire up its target outlet to be your controller and wire up its  
action to be an action method in your controller. If you are not  
familiar with target-action, you should read about it in the dev  
docs:



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.


Sure, I could workaround this by checking if the text field is  
still firstResponder and then assume it was enter that caused the  
event.


However, I was hoping that there is a definitive way to actually  
know that RETURN has been pressed on the text field.


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]