Re: NSLayoutConstraint crash
Thanks for the responses. It looks like it was a problem with how I was instantiating my NSStackView subclass in the xib. I dragged in a Custom View and then changed the class, I guess assuming that IB would see that my class is a subclass of NSStackView. Of course, what I should have done was drag in a stack view and then change the class. I'm not sure exactly why that resolved the exception, but it needed fixing anyway. On Fri, Mar 16, 2018 at 11:12 AM, Jack Brindle <jackbrin...@me.com> wrote: > I would be willing to bet that you are throwing a lot of constraint > exceptions without realizing it. > When the view is laid out the constraints are evaluated, including the > priorities. When a set > of constraints has a conflict with another (very easy to do) the > priorities come into play. If > you set the constraints in IB and do not set the priorities, then they > will usually be the same. > The view system will then have to take a guess at what you really wanted > to do, breaking > one of the constraints (usually the very one you find most important). > This will be > displayed in the log as a constraint exception. Many times it will take > several layout > passes before it finds a setup it can work with. Reading the constraint > display information > is an art, but one that can be learned and is then very valuable. > > It turns out that the key to really understanding and working with > constraints is in setting > priorities properly. This takes a while to figure out, but it appears to > be something you > are about to go through. As you lay out the views and set the constraints, > try to make > sure that there is only a single set of constraints on each view, and then > if there are > more than one, the priorities are set so that the views will display where > you want > them to be. > > There is another thing that most developers don’t realize - the view > system will create > constraints behind your back if you let it. It will use the autoresizing > mask to generate > constraints, which means there is an extra set of constraints that can > interfere with > what you really want. In most of my view controllers in either the > viewDidLoad or > awakeFromNib you will find the line: > view.translatesAutoresizingMaskIntoConstraints = NO; > This allows me to only have the constraints I set, eliminating a lot of > issues. > > There are a few NSView methods that will dump the constraints in place for > the view: > > constraints > > will return the constraints for a view. This is all the constraints (in an > NSArray) and > will show you everything, including some not so useful things. > > After a layout has occurred, use: > constraintsAffectingLayoutForOrientation: > > The NSArray of constraints will include the ones you really want to look > at for > the view. This is the one you really want to use to see what is actually > going on. > > Constraints is a very big topic with many things to learn and control. > They are > very powerful, and thus very maddening when they don’t work they way you > understand. Take the time to learn how to use them, and you will be much > happier! > > - Jack > > > > On Mar 16, 2018, at 9:40 AM, David Catmull <davidcatm...@gmail.com> > wrote: > > > > I might try it, but it's difficult to do accurately because the views are > > assembled programmatically - it's dynamically generated based on the data > > read in. > > > > On Fri, Mar 16, 2018 at 10:37 AM, Richard Charles <rcharles...@gmail.com > > > > wrote: > > > >> > >>> On Mar 16, 2018, at 9:03 AM, David Catmull <davidcatm...@gmail.com> > >> wrote: > >>> > >>> After I set up a somewhat complex view hierarchy, I'm getting a crash > >> with > >>> this exception: > >>> > >>> 2018-03-16 08:59:21.814873-0600 App[31201:13046721] *** Assertion > >> failure > >>> in -[NSLayoutConstraint setPriority:], > >>> /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/ > >> Foundation-1451/Foundation/Layout.subproj/NSLayoutConstraint.m:222 > >>> > >>> It happens on the main event loop where none of my code is involved; I > >>> never set constraint priorities myself. What could be causing this > error? > >> > >> Have you tried manually exercising the constraints? In Interface Builder > >> drag the views into random positions and sizes then click "Update > Frames” > >> to force the constraint system to apply the constraints. This may > uncover > >> any errors you have in the constraints containted in the view hierarchy.
Re: NSLayoutConstraint crash
I might try it, but it's difficult to do accurately because the views are assembled programmatically - it's dynamically generated based on the data read in. On Fri, Mar 16, 2018 at 10:37 AM, Richard Charles <rcharles...@gmail.com> wrote: > > > On Mar 16, 2018, at 9:03 AM, David Catmull <davidcatm...@gmail.com> > wrote: > > > > After I set up a somewhat complex view hierarchy, I'm getting a crash > with > > this exception: > > > > 2018-03-16 08:59:21.814873-0600 App[31201:13046721] *** Assertion > failure > > in -[NSLayoutConstraint setPriority:], > > /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/ > Foundation-1451/Foundation/Layout.subproj/NSLayoutConstraint.m:222 > > > > It happens on the main event loop where none of my code is involved; I > > never set constraint priorities myself. What could be causing this error? > > Have you tried manually exercising the constraints? In Interface Builder > drag the views into random positions and sizes then click "Update Frames” > to force the constraint system to apply the constraints. This may uncover > any errors you have in the constraints containted in the view hierarchy. > > --Richard Charles > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSLayoutConstraint crash
I found that in my googling, but since I'm not changing priorities, it wasn't helpful. On Fri, Mar 16, 2018 at 10:06 AM, Richard Charles <rcharles...@gmail.com> wrote: > > > On Mar 16, 2018, at 9:03 AM, David Catmull <davidcatm...@gmail.com> > wrote: > > > > After I set up a somewhat complex view hierarchy, I'm getting a crash > with > > this exception: > > > > 2018-03-16 08:59:21.814873-0600 App[31201:13046721] *** Assertion > failure > > in -[NSLayoutConstraint setPriority:], > > /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/ > Foundation-1451/Foundation/Layout.subproj/NSLayoutConstraint.m:222 > > > > It happens on the main event loop where none of my code is involved; I > > never set constraint priorities myself. What could be causing this error? > > Perhaps this might help. > > https://books.google.com/books?id=JTxsAQAAQBAJ=PP51; > lpg=PP51=Assertion+failure+NSLayoutConstraint+ > setPriority=bl=5hS5MqkC4F=RZENjGG10if2pqw9_RKTbJhTQQA& > hl=en=X=0ahUKEwjJhrm6m_HZAhVM6WMKHU0wCogQ6AEIZjAI#v= > onepage=false > > --Richard Charles > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSLayoutConstraint crash
After I set up a somewhat complex view hierarchy, I'm getting a crash with this exception: 2018-03-16 08:59:21.814873-0600 App[31201:13046721] *** Assertion failure in -[NSLayoutConstraint setPriority:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1451/Foundation/Layout.subproj/NSLayoutConstraint.m:222 It happens on the main event loop where none of my code is involved; I never set constraint priorities myself. What could be causing this error? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTableView drag image - using the first column image
In my table view, when you drag an item, the drag image it uses comes from the column cell where the drag started, rather than using the cell from the first column where I have the icon and name. How do I make it use the first column? I'm looking at Apple's TableViewPlayground as an example, and the outline view there works like I want, and I can't see what the key difference is. I'm tempted to try to fix it in tableView:updateDraggingItemsForDrag: but the Apple sample only uses that to update the image for external drags. For local drags, that method is essentially not used. If I comment that method out, the first-column-image behavior I want still works in the sample. I have a simple example at https://github.com/Uncommon/TableTest - notice that dragging from different columns yields different drag images even though the data in the drag is the same. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Are Core Data to-many relationships nullable?
Apparently the answer is that they should be declared nullable. Even though I've seen claims that the property will always return a set, apparently it's also allowable to assign it to nil to clear it out. On Thu, Oct 5, 2017 at 1:00 PM, David Catmull <davidcatm...@gmail.com> wrote: > I'm adding nullability notations to my Core Data classes for Swift > interoperability, and I need to know whether the properties for to-many > relationships should be considered nullable, or if they will always read as > empty sets. Is there an authoritative answer for this? > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Are Core Data to-many relationships nullable?
I'm adding nullability notations to my Core Data classes for Swift interoperability, and I need to know whether the properties for to-many relationships should be considered nullable, or if they will always read as empty sets. Is there an authoritative answer for this? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Window animates width but not height
I have a preferences window with a NSTabViewController hooked up to the toolbar for selecting tabs. I want the window to be resizable, and to resize iself if necessary when switching tabs to fit the new tab's size. I'm subclassing NSTabViewController with the following overload: override var selectedTabViewItemIndex: Int { didSet { guard let view = tabViewItems[selectedTabViewItemIndex].view, let window = view.window else { return } let minSize = view.fittingSize let contentRect = NSWindow.contentRect(forFrameRect: window.frame, styleMask: window.styleMask) let minRect = NSRect(origin: contentRect.origin, size: minSize) let newRect = minRect.union(contentRect) let newFrame = NSWindow.frameRect(forContentRect: newRect, styleMask: window.styleMask) window.animator().setFrame(newFrame, display: true, animate: true) } } The result is that it animates resizing horizontally, and at the end of the animation it suddenly resizes vertically as well. How do I get it to just animate both directions at once? Note - I posted this question to Stack Overflow a few days ago, but haven't gotten any responses. Feel free to respond there if you'd like the rep points :) https://stackoverflow.com/q/46493460/310159 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Dealing with validModesForFontPanel signature change
In the 10.13 SDK, the return type for NSObject.validModesForFontPanel() changed from Int to NSFontPanel.ModeMask. This is problematic for backwards compatibility because the different signature means it's considered to be a new function, different from the one that's been around since 10.3. If I simply update my function to match the new signature, then I have to change my deployment target to 10.13, which I'd rather not do just yet. I also tried going with the auto-fix suggestion of using @available to make the function 10.13 only. This would mean a minor loss of functionality on 10.12... but it doesn't work because my override isn't allowed to have different availability from the base version. I also tried installing the 10.12 SDK and building against that, but it's not compatible with Xcode 9 GM's Swift 3.2. So once I start using Xcode 9 regularly, I basically have to comment that function out until I want to require 10.13 for my app. Are there any other options? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Process.launch() in Swift
The documentation for Process.launch() (the equivalent of -[NSTask launch]) says it "raises an NSInvalidArgumentException if the launch path has not been set or is invalid or if it fails to create a process", and yet the function is not marked as "throws". So what happens if I call it from Swift and it encounters an error? I'm thinking I should probably just call it from Objective-C to be safe. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Can't restore first responder when restoring window state
I looked through the documentation, and didn't see anything that says you shouldn't call those methods. If they were meant to be overridden and not called, I expect they'd use something more opaque and special-purpose than NSCoder. As for being called twice, I don't see a problem, since they'll just be restored to the same values both times. On Thu, Feb 16, 2017 at 1:22 PM, Quincey Morris < quinceymor...@rivergatesoftware.com> wrote: > On Feb 16, 2017, at 11:32 , David Catmull <davidcatm...@gmail.com> wrote: > > > I am explicitly calling encodeRestorableState (in windowWillClose) and > restoreStateWithCoder > (in windowDidLoad). > > > You can’t. These methods — assuming you’re talking about overrides in > (say) the window controller — are called by the state restoration system > when it wants to. They’re there for you to override, not to call. > > If you do indeed call them, then they’re being called twice, at different > times, which certainly sounds like it’s going to lead to problems. > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Can't restore first responder when restoring window state
I am explicitly calling encodeRestorableState (in windowWillClose) and restoreStateWithCoder (in windowDidLoad), storing and reading the data to/from a file myself. I know those are normally used as part of the automatic app state restoration, but I want to restore a window's state regardless of whether it was open when the application last quit. I'm using encode/restoreState because it's an existing mechanism that seems to suit my needs, and aside from this first responder thing it's working fine. Also, I'm assuming - though I haven't tested this yet and the docs don't say - that the window state restoration will take into account changes in the monitor configuration, ensuring that the window is restored to a location that is still on screen. If there's a better way to do that I'm open to it. On Thu, Feb 16, 2017 at 11:52 AM, Quincey Morris < quinceymor...@rivergatesoftware.com> wrote: > On Feb 16, 2017, at 10:09 , David Catmull <davidcatm...@gmail.com> wrote: > > > I'm working on using encodeRestorableState/restoreStateWithCoder to save > and restore the state of a window. (I'm doing this manually because I want > to explicitly save my window state in the document and not just rely on the > OS restoring its state as part of restoring the application state.) > > > It’s a while since I’ve had to wrestle with custom restoration, so maybe > I’m missing something obvious, but I can’t quite come to grips with what > you’ve said here. > > On the face of it, if you’re saving the window state in the document, you > should not be using window restoration *at all*. Instead, you should simply > configure the window back to how/where it should appear as part of the > document opening process, after creating the window controller and before > showing the window — in an override of NSDocument’s “makeWindowControllers” > probably. > > If by "encodeRestorableState/restoreStateWithCoder” you mean the standard > NSResponder methods, then the saved state is *not* saved in your document, > and restoration likely happens — or at least starts — before your > NSDocument instance exists. You then fall into a timing and state > consistency hole (the window being restored is created early in app > startup, the document information is available later), so I don’t find it > entirely surprising that an error occurs. > > If I’m off track here, can you clarify what you’re trying to do with the > actual state restoration mechanism, if it’s not to save/restore its own > state data? > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Can't restore first responder when restoring window state
I'm working on using encodeRestorableState/restoreStateWithCoder to save and restore the state of a window. (I'm doing this manually because I want to explicitly save my window state in the document and not just rely on the OS restoring its state as part of restoring the application state.) The problem I'm having is that when it restores, an error is logged in the console that it can't restore the first responder because the view in question has its window set to nil. I tried calling makeFirstResponder(nil) before encoding, but then the window is its own first responder and an exception is thrown because it can't encode itself. I'm doing this from my window controller's windowDidLoad. Doing it in awakeFromNib didn't make a difference. So is there a way I can either prevent the window from saving/restoring the first responder, or ensure that the first responder view is installed in the window first? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Xcode-like title bar using title bar accessory view
I'm trying to create a title bar resembling Xcode's, where toolbar-like controls replace the standard window title in the area to the right of the standard 3 buttons. So far, I've added a title bar accessory view and set the window's titleVisibility to hidden. But the results aren't quite right. If my accessory view uses the default layoutAttribute value of .bottom, then my accessory view appears below the standard window controls as if it were a toolbar. If I set the layoutAttribute to .right, then the accessory view appears up in place of the title where I want it, except the title bar isn't tall enough and the bottom gets cut off. Also, the accessory view is pinned to the right, and doesn't resize horizontally with the window (as it does with .bottom). Similarly with .left. So how to I get my title bar accessory view to: - Appear to the right of the standard window buttons - Always fill the remaining width of the title bar - Get enough vertical space ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Unit testing with mixed Swift & Objective C
I found another solution: set the header search paths in the test target so it can find the App-Swift.h file from the app target, include that in the ObjC tests that need the Swift classes (instead of the one generated for the test target), and then remove all the app Swift files from the test target. Using an auto-generated header from another target is kind of a hack, but it works, and it's the simplest solution so far, so I'm going with it for now. On Sun, Jul 17, 2016 at 2:16 PM, David Catmull <davidcatm...@gmail.com> wrote: > After converting some parts of my project to Swift, I've run into some > problems with my tests. > > The first problem was where an app (not test) function, in Swift, was > iterating over an NSArray of instances of a Swift class, because that array > was generated by Objective C code. It was throwing an exception because the > objects were of the wrong type. I eventually figure out that it was because > my Swift files are in both the app and test targets, so there are two > versions of each Swift class. > > For Swift tests, I understand that you're now supposed to not have your > Swift sources in the test target, and instead use "@testable import > MyAppModule". But what about test written in Objective C that need to > access my Swift classes? If they're not in the test target, they won't be > in AppTest-Swift.h. Is there some other way to generate a Swift header file? > > Without that, I'm looking at two alternatives for the NSArray iterating > scenario: > - Rewrite the function that does the iterating, using Objective C so that > it doesn't do the type checking. > - Rewrite the function that creates the array, using Swift so that > hopefully the classes will match. > > Any other recommendations? > > -- > David Catmull > davidcatm...@gmail.com > http://uncommonplace.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Unit testing with mixed Swift & Objective C
After converting some parts of my project to Swift, I've run into some problems with my tests. The first problem was where an app (not test) function, in Swift, was iterating over an NSArray of instances of a Swift class, because that array was generated by Objective C code. It was throwing an exception because the objects were of the wrong type. I eventually figure out that it was because my Swift files are in both the app and test targets, so there are two versions of each Swift class. For Swift tests, I understand that you're now supposed to not have your Swift sources in the test target, and instead use "@testable import MyAppModule". But what about test written in Objective C that need to access my Swift classes? If they're not in the test target, they won't be in AppTest-Swift.h. Is there some other way to generate a Swift header file? Without that, I'm looking at two alternatives for the NSArray iterating scenario: - Rewrite the function that does the iterating, using Objective C so that it doesn't do the type checking. - Rewrite the function that creates the array, using Swift so that hopefully the classes will match. Any other recommendations? -- David Catmull davidcatm...@gmail.com http://uncommonplace.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sidebar outline view, rowSizeStyle, and bold text
OK, thanks. I wasn't thinking of bold being affected by row size, but I guess it makes sense that it's going to reset the font entirely. On Fri, Jun 10, 2016 at 10:46 AM, corbin dunn <corb...@apple.com> wrote: > > On Jun 10, 2016, at 7:58 AM, David Catmull <davidcatm...@gmail.com> wrote: > > I have a view-based, sidebar-style NSOutlineView. For some items, I want to > make the text bold. But if I change the rowSizeStyle to medium instead of > the default (in awakeFromNib), the text doesn't display as bold. If instead > I use a custom row size (in outlineView:heightOfRowByItem:) it works. What > gives? > > > Let’s take a look at the header :) > > typedef NS_ENUM(NSInteger, NSTableViewRowSizeStyle) { > /* The table will use the system default layout size: small, medium > or large. */ > NSTableViewRowSizeStyleDefault = -1, > > > /* The table will use the -rowHeight or ask the delegate for a > variable row height (if implemented) and cell layout is not changed. */ > NSTableViewRowSizeStyleCustom = 0, > > > /* The table will use a row height specified for a small/medium or > large table. > It is required that all sizes be fully tested and supported if > NSTableViewRowSizeStyleCustom is not used. > * Some standard Aqua metrics may be applied to cells based on the > current size. */* > NSTableViewRowSizeStyleSmall = 1, > NSTableViewRowSizeStyleMedium = 2, > NSTableViewRowSizeStyleLarge = 3, > } NS_ENUM_AVAILABLE_MAC(10_7); > > > So, if you set it to Small/Medium/Large then you will get some standard > metrics applied to things. Specifically, things setup to these outlets on > an NSTableCellView: > > @property (nullable, assign) IBOutlet NSTextField *textField; > @property (nullable, assign) IBOutlet NSImageView *imageView; > > > > > > corbin > > > > > > > I'm setting it to bold in outlineView:viewForTableColumn:item: by setting > view.textField.font = NSFont boldSystemFontOfSize > :view.textField.font.pointSize]. > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com > > This email sent to corb...@apple.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Sidebar outline view, rowSizeStyle, and bold text
I have a view-based, sidebar-style NSOutlineView. For some items, I want to make the text bold. But if I change the rowSizeStyle to medium instead of the default (in awakeFromNib), the text doesn't display as bold. If instead I use a custom row size (in outlineView:heightOfRowByItem:) it works. What gives? I'm setting it to bold in outlineView:viewForTableColumn:item: by setting view.textField.font = NSFont boldSystemFontOfSize :view.textField.font.pointSize]. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: PDF image template comes out too small
OK, if I open the PDFs in Preview, it says that the icons are 8x8 pts instead of 16x16. Exporting at a different DPI in Designer doesn't change this, but if I export from a document that itself has a different DPI (72 vs 144), then that can fix it. So I guess I have at thing or two to learn about working with Affinity Designer. On Wed, Jun 1, 2016 at 12:30 PM, Quincey Morris < quinceymor...@rivergatesoftware.com> wrote: > On Jun 1, 2016, at 10:55 , David Catmull <davidcatm...@gmail.com> wrote: > > > On OS X. I have an NSSegmentedControl in my xib, with my template images > assigned to the segments by specifying the image names. > > > It’s a bit hard to tell what’s going on if it’s all done in IB. You might > consider adding code to examine the images on the segments to see what’s > going on. > > I would try re-exporting the PDFs at a larger size (say 192 x 192, which > is a factor of 12). There may be an issue scaling the PDF *up* to get a > retina resolution of 32 x 32 px for 16 x 16 pt. > > This is going to be a problem if you really want the images to be 16 x 16 > pt regardless of the size of the control. If that is the case, I think it’s > better to provide them in an image catalog with 1x, 2x and/or 3x as > necessary. > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: PDF image template comes out too small
On OS X. I have an NSSegmentedControl in my xib, with my template images assigned to the segments by specifying the image names. On Wed, Jun 1, 2016 at 10:36 AM, Quincey Morris < quinceymor...@rivergatesoftware.com> wrote: > On Jun 1, 2016, at 07:51 , David Catmull <davidcatm...@gmail.com> wrote: > > > I'm trying to use PDF files as image templates for my segment controls, but > they come out too small. > > > What platform? What does “use” mean? That is, are you creating > NSImage/UIImage objects, drawing them into bitmaps, using CGPDF… functions, > etc? > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
PDF image template comes out too small
I'm trying to use PDF files as image templates for my segment controls, but they come out too small. I created them using Affinity Designer, adding the "Template" suffix. They end up getting drawn at half size in my controls. I tried changing the export DPI from the default (~144) to 72, but it had no effect. Exporting them as png instead works fine - at runtime, that is. Xcode 7.3.1's editor shows them at half size like the PDFs. This only happens with my custom images, never with standard system images. The images are 16x16, exported using Designer's "PDF (flatten)" setting. My segment control is "small square" style, with 37px wide segments. How can I make them display at the right size? I can make do with pngs if necessary, but for one thing I like not having to have @2x versions of everything. Plus Apple's documentation recommends PDF for template images, so it ought to work. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Proper target for table cell view buttons
> On Apr 8, 2016, at 10:48 AM, Quincey Morris >wrote: > > You could verify this by simply removing the target connection that’s causing > the warning, and see if the action method still ends up in the right place. As has been pointed out, removing the target connection in the nib also removes the action. Setting the action at runtime, and leaving the target nil, results in the action method not getting called. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Proper target for table cell view buttons
On Apr 7, 2016, at 1:23 PM, Quincey Morriswrote: > I don’t actually know the answer to the original question, but I wonder if > the problem is that (for a view-based table view) the cell view is archived > in a separate NIB file that’s generated when the storyboard or XIB containing > the table view is compiled. Then, there would be a difficulty that objects in > the NIB have no way to connect to anything outside the NIB except via File’s > Owner, and that’s set to something else. I don’t see any additional nib files in the application package. > Perhaps "it works as is” because there’s actually no target, so the action > message passes up the responder chain to the view controller. In that case, > there isn’t any need to find a way to specify the target explicitly. From what I see in the debugger, that doesn’t seem to be happening, although it goes through something called os_activity_initiate and I suppose it’s possible the responder chain is being traced in there. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Proper target for table cell view buttons
On Apr 7, 2016, at 11:45 AM, Fritz Andersonwrote: > > I’m curious about two things. > > (1) Which platform? OS X 10.11.3 > (2) Is your view controller not a table delegate already? I currently have the data source as the delegate, mainly because to me it makes more sense to have the delegate method outlineView:viewForTableColumn:item in the data source. The data source is a separate object from the view controller because I have different modes for the table, which I implement partly by switching data sources. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Proper target for table cell view buttons
I have some buttons in my table cell views, and I wanted to set my view controller as their target, but Xcode warns that such objects “may only be connected to the table view’s delegate”. The things is, it works as is. Why does Xcode want me to do it that way? I plan to try refactoring to satisfy the warning, but I’m still curious what the reasoning is. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Does NSOutlineView's highlightedTableColumn work?
> Are you sure a (rather small) sort indicator didn't appear in the column's > header? No, nothing appeared there either. >> I’m trying to use the column highlight to indicate a view state unrelated to >> sorting… > > Don't do that. Don't try to hijack features intended for one semantic for > another. I don't think the intended use of highlightedColumn is sufficiently clear in the docs. I'll submit feedback to Apple about that. > If you're using a view-based outline view, try using a custom table row view > that overrides -drawBackgroundInRect:. It seems like that would only give me a background in non empty rows. My next idea was to subclass NSOutlineView and override drawBackgroundInRect on that. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Does NSOutlineView's highlightedTableColumn work?
Is setting the highlightedTableColumn property on an NSOutlineView supposed to work? I’m expecting the column background to darken, but nothing seems to happen. Showing the column headers didn’t help (I normally have them hidden), and neither did setting a sort key for the column. I’m trying to use the column highlight to indicate a view state unrelated to sorting, but I figured since that’s what it’s normally used for it might want a sort key. Anyway, that didn’t work, and I can’t think of any other settings that might be helpful. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Detecting screen capture in progress
How can I detect when a screen shot selection (cmd-shift-4) is in progress? I have a custom window that I’m trying to make behave like a menu (it comes out of a status item). Part of this behavior is dismissing it when the user clicks on something else, which I detect using a CGEventTap. One case where I *don’t* want a click to dismiss is when it’s the start of a screen shot selection. Is there any way to detect this? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Full-height toolbar items
I'm working on a library for doing full-height toolbar items, like the center status display in Instruments, Xcode, and iTunes. I'm not completely finished yet, but I have reached a point where I'd like to share it. Feedback is welcome. https://github.com/Uncommon/UUFullHeightToolbar ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: and nibs
The documentation for toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: says that it's optional for nib toolbars, but it can still be used to augment functionality. My experience is that it actually doesn't get called at all in the nib case, which isn't good because I want to know if my items are going into the toolbar or the customize palette. All my delegate is getting is toolbarWillAddItem:, which isn't enough. Are the docs wrong, or am I doing it wrong? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: and nibs
On Jun 12, 2013, at 5:14 PM, Keary Suska cocoa-...@esoteritech.com wrote: Also, I suspect that the docs you cite might be saying that you would subclass NSToolbar and implement that delegate method if you want to intercept it. If I implement that method in a subclass, then it gets called with toolbar and itemIdentifier set to nil, and the flag is YES even though it's setting up the customize sheet. So it's interesting that it gets called at all, but it's still strangely useless. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
PDF icons scaled wrong on retina displays
As recommended, I used PDF images for some of my button icons with the expectation that they would look nice on retina displays. They are nice and smooth, but they're also scaled a bit smaller than on a regular display. Example: http://dl.dropbox.com/u/10822169/Screen%20Shot%202012-10-12%20at%203.20.53%20PM.png The left and middle icons are mine, and the right one is NSPathTemplate. My PDFs (generated by Inkscape) are here: https://github.com/Uncommon/Xit/blob/master/Xit/images/historyTemplate.pdf https://github.com/Uncommon/Xit/blob/master/Xit/images/stageTemplate.pdf Is there a problem with Inkscape's output? Do I need to change my button settings, or reprocess the PDFs somehow? Will I have to use @2x raster images instead? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Icon Overlay on Mac OSX
Uli Kusterer witness.of.teacht...@gmx.net wrote: In the old days, one could use Icon Services calls to change the icon used for a particular file type, that might even save you the renaming, but Icon Services is probably considered old API these days, and I'm not sure if changes to icons in your app using Icon Services will still affect Finder. Anyway, it's worth a try. That worked back in Mac OS 9, but as of Mac OS X, changing icons like that doesn't affect other applications. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Full-Height Toolbar Item
On Jan 26, 2012, at 9:03 PM, Mark Alldritt alldr...@latenightsw.com wrote: I'm looking for a way to make a view-based Toolbar Item that occupies the full height of the toolbar (i.e. including the space normally reserved for the toolbar item's label). Xcode 4 does this for its status display, and I have a similar need in my application. The NSToolbar and NSToolbarItem definitions don't appear to make this possible, but perhaps there is something I've overlooked. I've looked into this too, and haven't found an answer yet. According to this article, Xcode used to use a floating window trick: http://stackoverflow.com/questions/6169255/is-it-possible-to-draw-in-the-label-area-of-nstoolbar ..but it doesn't anymore. Also note that Instruments has a full-height toolbar item, and that toolbar is fully customizable, so whatever tricks they're using they were able to make it behave like a normal toolbar item - cmd-draggable, in customize sheet, etc. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Full-Height Toolbar Item
On Jan 27, 2012, at 12:27 PM, Jens Alfke wrote: The good news is that these APIs often become public in later OS releases, especially if developers file bugs clamoring for them (hint hint). Done: bug 10766939. -- David Catmull uncom...@uncommonplace.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Status toolbar item like Xcode and Instruments
I'm interested in implementing a status display in my toolbar, similar to the LCD-style ones seen in Xcode 4 and Instruments. The challenge seems to be how to make it a full-height item with no label. If I make my custom view taller, it just makes the whole toolbar taller. Setting the label to nil or @ just leaves the label area blank. I had read* that Xcode uses sneaky hacks for its status display, and I was resigned to having to reproduce that approach. Then I noticed the one in Instruments, which behaves like a normal toolbar item in many respects, including the Customize sheet. This leads me to suspect there's a relatively non-messy way to implement this. * http://stackoverflow.com/questions/6169255/is-it-possible-to-draw-in-the-label-area-of-nstoolbar -- David Catmull uncom...@uncommonplace.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help with view constraints
On Oct 28, 2011, at 6:30 PM, Ken Ferry wrote: The question seems a little general to me. Where did you have problems doing what you wanted to do? To be more specific, the window contains two controls: a text field with the full command arguments for a git command that was executed, and below it a scrolling text box containing the output from the command. I want the command field to resize vertically as needed when that text changes, while manual resizing by the user should only affect the output box. If you really want to get into it, the source is here: https://github.com/Uncommon/Xit/tree/status It's a rewrite of the GitX git client. -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Source list groups hidden by default
I have a source list in my window - an NSOutlineView where my delegate returns YES for outlineView:isGroupItem: for certain items. In 10.7, group items now have a Show/Hide button that appears on mouse-over. The complication is that for some reason my groups are hidden by default. I can expand them programmatically, but that doesn't work if the group is empty. I could expand it when I add children, but then I have to keep track of whether it's for the first time or if I'm just refreshing. So how do I make my groups shown by default? -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Full-height toolbar item
How can I make a toolbar item that takes up the full height of the toolbar, including the space where the label would normally be? Simply setting the label to an empty string doesn't seem to do it. I want to make something like Xcode 4's status display. -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Contextual menu commands in the Finder
So I gather that now that the new 64-bit Finder doesn't support the old CM plugin API, the only way to add commands to the Finder's contextual menus is with the services API. The problem I'm having with doing it as a service is that the commands I want to add should only apply to files in certain locations, and it looks like I can only filter by file type. Is there no way to filter by location too? It looks pretty lame to have to let the commands always appear, and then tell the user afterwards, No, sorry, you can't really do this to that file. -- David Catmull uncom...@uncommonplace.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Animated progress bar in custom menu item view
I'm looking a the MenuItemView sample code: http://developer.apple.com/library/mac/#samplecode/MenuItemView/Introduction/Intro.html This sample shows various views and controls in a menu, including an indeterminate progress bar - but it doesn't animate (even though startAnimation is called). I assume this worked when the code was first released, apparently in the 10.4 days, but in 10.5 and 10.6 it doesn't. What has changed, and what would it take to fix the sample?___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data: many-to-many relationships not being saved
I finally found the answer to this problem. It comes from the way I was setting the relationship. I was calling: [[expense valueForKey:@tags] addObject:tag]; ..which apparently is too direct. What I need is something more like: [[expense mutableSetValueForKey:@tags] addObject:tag]; I discovered the answer as I was preparing to post my question on Stack Overflow. It was yet another case of trying to anticipate all the obvious did you try this responses, and finding the answer myself in the process. On Jul 10, 2010, at 9:03 AM, David Catmull wrote: In my finance app, I have Expense and Tag entities with many-to-many relationships to each other. But changing those relationships doesn't mark the document as dirty, and the changes don't get saved. It doesn't seem to matter if the relationships are optional or not, and they're not transient. This is the first time I've had trouble with object relationships. What could be causing it? The project is on GitHub if you want to try it out: http://github.com/Uncommon/Budget-Machine -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data: many-to-many relationships not being saved
In my finance app, I have Expense and Tag entities with many-to-many relationships to each other. But changing those relationships doesn't mark the document as dirty, and the changes don't get saved. It doesn't seem to matter if the relationships are optional or not, and they're not transient. This is the first time I've had trouble with object relationships. What could be causing it? The project is on GitHub if you want to try it out: http://github.com/Uncommon/Budget-Machine -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: C arrays as __block variables
I had a situation where I was accessing a C array from inside a block. It worked fine until I upgraded to Xcode 3.2.3; then I started to get errors. -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data: binding to a sum
How do I make a table view column show a sum calculated from Core Data Values? I have a Budget entity with a to-many relationship of BudgetItems. In a table view listing my budgets, I want a column that displays the total of a budget's items' amounts. I tried binding the column to ite...@sum.limit, but got this error: Unknown.m:0: error: -[BudgetTests testBudgetSheet] : [_NSFaultingMutableSet 0x102e28500 addObserver:forKeyPath:options:context:] is not supported. Key path: @sum.limit ..so I take it the particular NSSet variant used by Core Data doesn't support observing @sum. Or did I do that wrong? I also tried implementing keyPathsForValuesAffectingTotal on my budget class to return items.limit, but that didn't get me any notifications when things changed. The next thing on my agenda is to try manually observing all changes to BudgetItems, but I'm struggling with the best way to do that. -- David Catmull uncom...@uncommonplace.com___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data: binding to a sum
On Apr 7, 2010, at 10:19 AM, Keary Suska wrote: On Apr 7, 2010, at 9:14 AM, David Catmull wrote: ..so I take it the particular NSSet variant used by Core Data doesn't support observing @sum. Or did I do that wrong? Yes, because you are trying to observe an element of a set. Same goes for arrays. Instead, add an array controller whose content is bound to items, and bind to arrangedObjects-@sum.limit. Thanks! I'm used to just thinking of array controllers as a way to feed table views. This did the trick. David Catmull uncom...@uncommonplace.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Make sheets open instantly
On Jan 18, 2010, at 5:19 PM, Chris Hanson wrote: On Jan 18, 2010, at 2:43 PM, David Catmull wrote: Is there any way to make sheets open instantly, instead of animating? I'd just like to speed up my unit tests. Why do your unit tests need to bring up sheets? I'll just call them tests then. -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Make sheets open instantly
Is there any way to make sheets open instantly, instead of animating? I'd just like to speed up my unit tests. -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data derived property not recognized after save reopen
Follow-up to my own question: I decided that since the year and month derived properties were only there for fetch requests, the correct thing to do is to get rid of them and instead use predicates that look for the corresponding date ranges. That works just as well, and avoids the derived property weirdness entirely. -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data derived property not recognized after save reopen
On Nov 18, 2009, at 2:13 PM, Sean McBride wrote: What do you mean exactly by derived properties? Are they transient? Are they in your xcdatamodel? In any case, I believe your problem is that you can only fetch against properties that are in the persistent store ie in your xcdatamodel and not transient. I subclassed NSManagedObject and just added year and month methods. What confuses me is the sequence of events that leads to the failure - it works after reopening the document, *until* I make a change. In any case, I've gotten around this by dropping the derived property approach and using predicates that access the original date property directly. -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data derived property not recognized after save reopen
I have an entity with a date property, and derived properties year and month (by having year/month methods in my NSManagedObject subclass). In a couple of different places, I fetch the entries from a particular year or month- the fetch requests's predicate says year == 2009. This works fine except in a document that has been saved and reopened: the first time I make a change to an object, and then try to fetch a list of objects by year, an exception is thrown saying keypath year not found. What confuses me is that between reopening the document, and making a change, I can make (as far as I can tell) the same request to filter by year (or month) without problems. It doesn't matter which property I change - date or anything else. So I have two questions: 1. Why would this happen? 2. What's a good, simple way to write a unit test that simulates closing an reopening a Core Data document? I want to avoid actual file operations for the sake of simplicity, but NSPersistentDocument does not implement the dataOfType:error: method. -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Bindings vs MOC change notification
In my Core Data app, I have objects with a date property, and I want to maintain a list of all years that I have objects in. I'm having trouble settling on an approach. Currently, I'm listening for NSManagedObjectContextObjectsDidChangeNotification. This is working fine for additions and deletions, but it's harder for changes, mainly because I don't know the old value. If I did, I could check if the old year still has any other objects in it. As it is I have to refresh the whole list. I also get more notifications than I need, since I only care about date changes on this one entity. Another option is to use KVO so I can be notified only of date changes. I'm assuming that registering as an observer for potentially thousands of Core Data objects doesn't carry too much overhead. The down side is that if lots of objects change at once, I get lots of individual callbacks, and I worry that that would be a bottleneck. Recommendations? Other options? Thanks, -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Unit test crash inside NSTableView
I'm getting a crash in -[NSTableView _isGroupRow:] in my unit tests if I try to run the main run loop. In my document's window, I have an NSOutlineView with its delegate and dataSource set to the window controller. In some unit tests, I want to run the main event loop to give some bindings a chance to do their thing, but this causes a crash. Once, instead of crashing, there was a message logged that some random class (whose name I can't remember) doesn't respond to -[outlineView:isGroupItem:], as if the outline view's delegate were set wrong. I added a check for that in the unit test and it was fine. When I run the app normally everything works. I create the document by calling [[NSDocumentController sharedDocumentsController] openUntitledDocument:YES error:e]. Is there something else I need to do so that everything get set up correctly? -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSArrayController inside NSTreeController?
How would I use an NSArrayController to provide the content of one of the child items in an NSTreeController? This is for a NSOutlineView source view, and each group in the source view contains different kinds of items. In some cases, I want them to be Core Data items, so the easiest way to manage that is to use an array controller. I tried returning the array controller's arrangedObjects as the children of a group object, but when items are added they don't appear in the source view. I'm not sure where to go from there. -- David Catmull uncom...@uncommonplace.com http://www.uncommonplace.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSArrayController inside NSTreeController?
On Nov 4, 2009, at 10:21 AM, Matthew Lindfield Seager matt...@sagacity.com.au wrote: You may need to implement NSOutlineView's data source methods. I considered that, but I'm hoping to avoid having to re-implement all the stuff that already works in the normal table view/array controller case. -- David Catmull uncom...@uncommonplace.com http://uncommonplace.com . There have been at least two discussions of this on the list in the past three months so those threads might be helpful to you! If you come up with a better solution please post your approach though! Matt ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com