NSPredicateEditorRowTemplate
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: unexpected nil outlet
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]
Re: CoreData pagination
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]
Allocating outlets from NIB file
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: Allocating outlets from NIB file
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]
Re: Allocating outlets from NIB file
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]
Seconds since system startup
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
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]
Re: Seconds since system startup
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: NSPredicateEditorRowTemplate
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
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: Seconds since system startup
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]
NSSegmentedControl segment bindings
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]
Core Data, abstract Entity problem
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]
Re: NSPredicateEditorRowTemplate
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]
Re: Learning SQLite by watching Core Data?
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: http://www.amazon.com/SQL-Practical-Developers-Kaufmann-Management/dp/0122205316/ref=sr_1_8?ie=UTF8s=booksqid=1206749658sr=1-8 http://www.amazon.com/Definitive-Guide-SQLite/dp/1590596730/ref=pd_bbs_sr_1?ie=UTF8s=booksqid=120674sr=1-1 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: PDFKit guidance
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: NSPredicateEditorRowTemplate
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: NSSegmentedControl segment bindings
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: Cocoa Text System: How to determine the caret position?
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: question on layer setup in Covertflow sample code
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: How to prevent NSControl from graying out when sent to background?
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: How to prevent NSControl from graying out when sent to background?
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]
[SOLVED] Re: Core Data, abstract Entity problem
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]
wrapping multiple IBOutlet objects for reuse
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]
CFSocket and wifi
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]
Re: CFSocket and wifi
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]
SetControlReference equivalent in NSControl?
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: SetControlReference equivalent in NSControl?
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]
Sourcelist background colors
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: Sourcelist background colors
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]
Re: Sourcelist background colors
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: wrapping multiple IBOutlet objects for reuse
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) snip 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 snip 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]
Custom Drag and Drop Cell for NSTableView
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: Custom Drag and Drop Cell for NSTableView
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]
Re: wrapping multiple IBOutlet objects for reuse
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:WHERE_YOUR_WANT_IT]; [[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: PDFKit guidance
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]
Core Animation: Disabling Implicit Animations
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: SetControlReference equivalent in NSControl?
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]
Leak in NSSavePanel
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: Creating Installer Package from Cocoa
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]
Re: Leak in NSSavePanel
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: Core Animation: Disabling Implicit Animations
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: Core Animation: Disabling Implicit Animations
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]
Re: Newbie question: instantiate a class in its header file OR in IB
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: Newbie question: instantiate a class in its header file OR in IB
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]