Re: Questions about NSPopupButtonCell and NSBrowser
In case anyone else is struggling with popup button cells like I was, I did finally get this to work - though the solution looks a bit strange it definitely seems to be giving me the behavior I wanted. Short version: there are two entities defined (Core Data) and there is a one-to-many relationship between them: for sake of explanation, lets call them "Folder" and "File" - where each "File" is in one "Folder" but there can be multiple files in a folder. A third entity had a reference to Files, and I wanted an NSTableView to list the records of that third entity, call it "X", but I wanted two popup button cells for selecting the Files - one to choose a Folder, and the other listing the Files inside of it. The way I finally got this working: In the custom subclass of NSManagedObject for entity "X", I implemented "folder" and "setFolder" methods; "folder" returns the "folder" of the "File" that is referenced by "X", and "setFolder" effectively picks an arbitrary "File" from the indicated "Folder" and sets "X" to point there. In the custom subclass of NSManagedObject for entity "Folder", I implemented "arrangedFiles", which returns a sorted NSArray of the files in the folder (the actual relationship returns an NSSet and I needed an NSArray - plus I wanted it sorted a specific way). In the XIB file, I have an NSArrayController for the set of all Folder records - call it "Folders" - and another one for the set of records in X - call it "Xrecs" (I am making up these names). The File and Folder entities both have "name" attributes for display. My bindings for the NSPopupButtonCells are: For the Folders one: Content - Folders.arrangedObjects Content Values - Folders.arrangedObjects.name Selected Object - Xrecs.arrangedObjects.folder For the Files one: Content - Xrecs.arrangedObjects.folder.arrangedFiles Content Values - Xrecs.arrangedObjects.folder.arrangedFiles.name Selected Object - Xrecs.arrangedObjects.file It seems a bit weird to me to specify a record attribute of an array (arrangedFiles.name), but it occurred to me that this was how the other ones look with arrangedObjects, so I gave it a try and it seems to work just fine. Hope someone finds this 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
Re: Questions about NSPopupButtonCell and NSBrowser
> On 5 Jun 2015, at 9:59 am, Frank D. Engel, Jr. wrote: > > > If I don't bind from there, I'm not sure where else to do it from? In IB, in -awakeFromNib, in -windowDidLoad: (in a window controller), etc? Anywhere but in the drawing pathway. I’m not sure whether bindings only makes single connection per binding even if called multiple times, or whether it adds a new one each time, but in the drawing pathway, it’s going to be called many times. If it makes a new binding each time, you could end up with hundreds of redundant KVO notifications when the property changes, with the app gradually getting slower and slower. > In the future, I will be expanding the use of the "icon" to show it in places > besides the browser - I am considering the "icon" to be a calculated part of > the data model, with the "image" being part of one view which I expect to > later be many views against the same object, so trying to update from within > the source object isn't going to work unless I reinvent the wheel and > basically recreate the bindings or some other notification mechanism. It’s perfectly reasonable that the ‘icon’ property is part of your data model, and that any number of views are bound to it. I’m not suggesting you update from within the source at all. I’m suggesting that you provide a method in the relevant controller that will update your browser cell and the right part of the view and bind that to the icon property. It doesn’t change the way the icon property works or how it gets its new data. > The update of the icon is based on any of several properties of the source > object changing dynamically, sometimes by the user, and sometimes from a > method triggered an NSTimer (I am conditionally animating some of these > properties), and since the set of views against the object is likely to > change periodically while the application is running (and quite possibly in > the middle of those animations), with some views potentially changing which > objects they represent, I was hoping to avoid having to stoop to that level > (and didn't expect that I would need to) - but I will if that is what it > takes. Not sure why this is a problem. All I’m suggesting is that a suitable method of the browser’s controller is bound to the icon. It doesn’t stop you binding other things to the same icon. > I still need a pointer of some kind with the NSPopupButtonCell question. > Can’t help you with that one - cells are gnarly, pop-up button cells doubly so. —Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Questions about NSPopupButtonCell and NSBrowser
On 6/4/2015 19:39, Graham Cox wrote: On 5 Jun 2015, at 9:19 am, Frank D. Engel, Jr. wrote: - (void)browser:(NSBrowser *)browser willDisplayCell:(MyBrowserCell *)cell atRow:(NSInteger)row column:(NSInteger)column { // Find the item and set the image. WhateverObject *c = [browser itemAtRow:row inColumn:column]; [cell bind:@"image" toObject:c withKeyPath:@"icon" options:nil]; } This looks wrong to me. If you have the source object (c) and the cell that is to display the image (cell), why not just set the image directly? [cell setImage:[c icon]]; The binding might help when the “icon” property changes, but setting up the binding here (which is effectively within a call to -drawRect: of the NSBrowser) is almost certainly incorrect. The binding needs to be set up outside of the drawing pathway, but since cells are annoying things, just binding the cell’s image to the icon property won’t work - the cell won’t automatically refresh the relevant part of the browser view. Cells generally don’t update their host views on a change, because they’re designed to be reusable in a lot of different circumstances - the view uses the cell to draw some content, but the cell is unaware of which view it belongs to so there isn’t a general way for a cell to update its host view. It’s also undesirable, because many classes such as NSTableView and NSBrowser set up the cell’s state (properties) on the fly just before the cell is drawn, so if the cell dirtied the view when that happened you’d get an infinite redraw cycle. So what you need to do is to have a property or method on your browser controller that sets the relevant cell’s image property AND refreshes the correct part of the view, then bind that controller method to the object’s icon property. —Graham P.S. Cells in general are deprecated, so getting away from code that requires them is the way of the future. If I don't bind from there, I'm not sure where else to do it from? Originally I was just doing a setImage: method call there, but I changed it to a bind to fix the first issue I listed earlier (this is why it updates more readily now when I keep it up). In the future, I will be expanding the use of the "icon" to show it in places besides the browser - I am considering the "icon" to be a calculated part of the data model, with the "image" being part of one view which I expect to later be many views against the same object, so trying to update from within the source object isn't going to work unless I reinvent the wheel and basically recreate the bindings or some other notification mechanism. The update of the icon is based on any of several properties of the source object changing dynamically, sometimes by the user, and sometimes from a method triggered an NSTimer (I am conditionally animating some of these properties), and since the set of views against the object is likely to change periodically while the application is running (and quite possibly in the middle of those animations), with some views potentially changing which objects they represent, I was hoping to avoid having to stoop to that level (and didn't expect that I would need to) - but I will if that is what it takes. I'll work with that a bit more. I still need a pointer of some kind with the NSPopupButtonCell question. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Questions about NSPopupButtonCell and NSBrowser
> On 5 Jun 2015, at 9:19 am, Frank D. Engel, Jr. wrote: > > - (void)browser:(NSBrowser *)browser willDisplayCell:(MyBrowserCell *)cell > atRow:(NSInteger)row column:(NSInteger)column > { > // Find the item and set the image. > WhateverObject *c = [browser itemAtRow:row inColumn:column]; > [cell bind:@"image" toObject:c withKeyPath:@"icon" options:nil]; > } This looks wrong to me. If you have the source object (c) and the cell that is to display the image (cell), why not just set the image directly? [cell setImage:[c icon]]; The binding might help when the “icon” property changes, but setting up the binding here (which is effectively within a call to -drawRect: of the NSBrowser) is almost certainly incorrect. The binding needs to be set up outside of the drawing pathway, but since cells are annoying things, just binding the cell’s image to the icon property won’t work - the cell won’t automatically refresh the relevant part of the browser view. Cells generally don’t update their host views on a change, because they’re designed to be reusable in a lot of different circumstances - the view uses the cell to draw some content, but the cell is unaware of which view it belongs to so there isn’t a general way for a cell to update its host view. It’s also undesirable, because many classes such as NSTableView and NSBrowser set up the cell’s state (properties) on the fly just before the cell is drawn, so if the cell dirtied the view when that happened you’d get an infinite redraw cycle. So what you need to do is to have a property or method on your browser controller that sets the relevant cell’s image property AND refreshes the correct part of the view, then bind that controller method to the object’s icon property. —Graham P.S. Cells in general are deprecated, so getting away from code that requires them is the way of the future. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Questions about NSPopupButtonCell and NSBrowser
On 6/4/2015 18:43, Graham Cox wrote: On 5 Jun 2015, at 6:38 am, Frank D. Engel, Jr. wrote: On 6/3/2015 20:29, Graham Cox wrote: On 4 Jun 2015, at 10:20 am, Frank D. Engel, Jr. wrote: I am wondering if the browser is actually caching an image of the cells in the second column when I switch away, then just displaying that without actually recreating the cells in the second column until it needs one of them for something? That might explain the behavior I am seeing, and may be a sensible optimization in most cases, but in this instance it is not very helpful for my particular application. Sounds very doubtful. [self controlView] is probably unreliable in your cell - you might want to check it. But even if it’s correct (being the NSMatrix for the browser column) invalidating the whole thing is going to be very sub-performant (though should work). Note that NSBrowser, unlike a NSTableView, allocates one cell per row within a NSMatrix - it does not reuse and redisplay a single cell. —Graham My method isn't even being called at that point, so it never gets that far. Which method? Unfortunately the problem isn’t very clearly stated, so I don’t know if it’s the view refresh that you're having trouble with (as I supposed) or some other meaning of “refresh” that you’re applying. —Graham - (void)browser:(NSBrowser *)browser willDisplayCell:(MyBrowserCell *)cell atRow:(NSInteger)row column:(NSInteger)column { // Find the item and set the image. WhateverObject *c = [browser itemAtRow:row inColumn:column]; *[cell bind:@"image" toObject:c withKeyPath:@"icon" options:nil];* } - (void)setIcon:(NSImage *)icon { // this is for the benefit of bindings - it doesn't actually do anything itself // it tricks the bindings mechanism into updating the icons in the browser, etc. NSLog(@"setIcon called"); } - (void)setImage:(NSImage *)newImage { NSLog(@"setImage called"); img = newImage; [[self controlView] setNeedsDisplay:YES]; } When I switch to a different row in the first row, then switch back, even though the "icon" property is changing (my "setIcon called" text appears), the "setImage called" text never appears, meaning that my setImage method is not being called. Once I select a row within the second column, it starts being called again. I did notice that "setImage" is actually being called temporarily if I switch to another window, or switch back - but it only does so momentarily then it stops again. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Questions about NSPopupButtonCell and NSBrowser
> On 5 Jun 2015, at 6:38 am, Frank D. Engel, Jr. wrote: > > > On 6/3/2015 20:29, Graham Cox wrote: >>> On 4 Jun 2015, at 10:20 am, Frank D. Engel, Jr. wrote: >>> >>> I am wondering if the browser is actually caching an image of the cells in >>> the second column when I switch away, then just displaying that without >>> actually recreating the cells in the second column until it needs one of >>> them for something? That might explain the behavior I am seeing, and may >>> be a sensible optimization in most cases, but in this instance it is not >>> very helpful for my particular application. >> >> Sounds very doubtful. >> >> [self controlView] is probably unreliable in your cell - you might want to >> check it. But even if it’s correct (being the NSMatrix for the browser >> column) invalidating the whole thing is going to be very sub-performant >> (though should work). >> >> Note that NSBrowser, unlike a NSTableView, allocates one cell per row within >> a NSMatrix - it does not reuse and redisplay a single cell. >> >> —Graham >> >> >> > My method isn't even being called at that point, so it never gets that far. > Which method? Unfortunately the problem isn’t very clearly stated, so I don’t know if it’s the view refresh that you're having trouble with (as I supposed) or some other meaning of “refresh” that you’re applying. —Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Questions about NSPopupButtonCell and NSBrowser
On 6/3/2015 20:29, Graham Cox wrote: On 4 Jun 2015, at 10:20 am, Frank D. Engel, Jr. wrote: I am wondering if the browser is actually caching an image of the cells in the second column when I switch away, then just displaying that without actually recreating the cells in the second column until it needs one of them for something? That might explain the behavior I am seeing, and may be a sensible optimization in most cases, but in this instance it is not very helpful for my particular application. Sounds very doubtful. [self controlView] is probably unreliable in your cell - you might want to check it. But even if it’s correct (being the NSMatrix for the browser column) invalidating the whole thing is going to be very sub-performant (though should work). Note that NSBrowser, unlike a NSTableView, allocates one cell per row within a NSMatrix - it does not reuse and redisplay a single cell. —Graham My method isn't even being called at that point, so it never gets that far. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Questions about NSPopupButtonCell and NSBrowser
> On 4 Jun 2015, at 10:20 am, Frank D. Engel, Jr. wrote: > > I am wondering if the browser is actually caching an image of the cells in > the second column when I switch away, then just displaying that without > actually recreating the cells in the second column until it needs one of them > for something? That might explain the behavior I am seeing, and may be a > sensible optimization in most cases, but in this instance it is not very > helpful for my particular application. Sounds very doubtful. [self controlView] is probably unreliable in your cell - you might want to check it. But even if it’s correct (being the NSMatrix for the browser column) invalidating the whole thing is going to be very sub-performant (though should work). Note that NSBrowser, unlike a NSTableView, allocates one cell per row within a NSMatrix - it does not reuse and redisplay a single cell. —Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Questions about NSPopupButtonCell and NSBrowser
After all of this, I finally at least partially solved this one. I added a line of code to run each time that method is called. It wasn't being called most of the time. I found where I was calling this and changed the code a bit to use a binding created by code, and now it is almost working. The images are in the second column of the browser (these columns are actually the same A and B as the NSPopupButtonCell question I still am trying to figure out - the first column shows A, and second column shows the B's for that A). If I arrange for one of them to start changing while I have a particular A selected, it works as long as I keep that A selected. When I switch to a different A then switch back while it should still be changing, it is "frozen" - the image appears from wherever it was when I switched away, and my setImage method is not being called. When I select a B within that A, it starts being called again. I am wondering if the browser is actually caching an image of the cells in the second column when I switch away, then just displaying that without actually recreating the cells in the second column until it needs one of them for something? That might explain the behavior I am seeing, and may be a sensible optimization in most cases, but in this instance it is not very helpful for my particular application. On 6/3/2015 19:52, Frank D. Engel, Jr. wrote: I based my code on one of Apple's examples and had tried using NSBrowserCell but was not able to get that working; I assume there is some reason why Apple chose to use NSTextFieldCell in their example and I followed suit. Currently, I have this coded - I had tried several variations to force the redraw and landed here but it still is not working consistently. - (void)setImage:(NSImage *)newImage { //[newImage retain]; //[img release]; img = newImage; [[self controlView] setNeedsDisplay:YES]; } On 6/3/2015 19:39, Graham Cox wrote: On 4 Jun 2015, at 7:29 am, Frank D. Engel, Jr. wrote: Now what I am hoping is the simpler one: I have a custom subclass of NSTextFieldCell which I am using to show an icon in an NSBrowser. The icon image is being generated dynamically by a method in my subclass and I want it to change more or less in "real time" as a bound value changes. I have that almost working, but the one problem is that it doesn't refresh when I need it to. Is there some way I can "force" a browser cell to redraw its image, short of redrawing the entire browser or window? The text isn't changing, just the icon, but I'd settle for redrawing the cell... I've tried a number of things to get this working and it seems I keep coming up short. NSBrowser normally uses NSBrowserCell to draw its content. That class has a -setImage: method which presumably knows how to mark the correct part of its host view as needing display. If you have to use a different cell class, then you’ll need to figure out how to do the same. The cell is part of a 1-column NSMatrix which has methods to return the rect occupied by a given row, so given that you can call -setNeedsDisplayInRect: on the matrix itself. Useful methods there are -[NSMatrix getRow:column:ofCell:] and -[NSMatrix cellFrameAtRow:column:]; hth, —Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/fde101%40fjrhome.net This email sent to fde...@fjrhome.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Questions about NSPopupButtonCell and NSBrowser
I based my code on one of Apple's examples and had tried using NSBrowserCell but was not able to get that working; I assume there is some reason why Apple chose to use NSTextFieldCell in their example and I followed suit. Currently, I have this coded - I had tried several variations to force the redraw and landed here but it still is not working consistently. - (void)setImage:(NSImage *)newImage { //[newImage retain]; //[img release]; img = newImage; [[self controlView] setNeedsDisplay:YES]; } On 6/3/2015 19:39, Graham Cox wrote: On 4 Jun 2015, at 7:29 am, Frank D. Engel, Jr. wrote: Now what I am hoping is the simpler one: I have a custom subclass of NSTextFieldCell which I am using to show an icon in an NSBrowser. The icon image is being generated dynamically by a method in my subclass and I want it to change more or less in "real time" as a bound value changes. I have that almost working, but the one problem is that it doesn't refresh when I need it to. Is there some way I can "force" a browser cell to redraw its image, short of redrawing the entire browser or window? The text isn't changing, just the icon, but I'd settle for redrawing the cell... I've tried a number of things to get this working and it seems I keep coming up short. NSBrowser normally uses NSBrowserCell to draw its content. That class has a -setImage: method which presumably knows how to mark the correct part of its host view as needing display. If you have to use a different cell class, then you’ll need to figure out how to do the same. The cell is part of a 1-column NSMatrix which has methods to return the rect occupied by a given row, so given that you can call -setNeedsDisplayInRect: on the matrix itself. Useful methods there are -[NSMatrix getRow:column:ofCell:] and -[NSMatrix cellFrameAtRow:column:]; hth, —Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Questions about NSPopupButtonCell and NSBrowser
> On 4 Jun 2015, at 7:29 am, Frank D. Engel, Jr. wrote: > > Now what I am hoping is the simpler one: > > I have a custom subclass of NSTextFieldCell which I am using to show an icon > in an NSBrowser. The icon image is being generated dynamically by a method > in my subclass and I want it to change more or less in "real time" as a bound > value changes. I have that almost working, but the one problem is that it > doesn't refresh when I need it to. > > Is there some way I can "force" a browser cell to redraw its image, short of > redrawing the entire browser or window? The text isn't changing, just the > icon, but I'd settle for redrawing the cell... > > I've tried a number of things to get this working and it seems I keep coming > up short. NSBrowser normally uses NSBrowserCell to draw its content. That class has a -setImage: method which presumably knows how to mark the correct part of its host view as needing display. If you have to use a different cell class, then you’ll need to figure out how to do the same. The cell is part of a 1-column NSMatrix which has methods to return the rect occupied by a given row, so given that you can call -setNeedsDisplayInRect: on the matrix itself. Useful methods there are -[NSMatrix getRow:column:ofCell:] and -[NSMatrix cellFrameAtRow:column:]; hth, —Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Questions about NSPopupButtonCell and NSBrowser
I have two questions I'm hoping I can get some advice on... First the complicated one: I have an NSTableView (cell-based) in which I am trying to rig two columns with NSPopupButtonCell - the selection in the first one determines the possible values of the second. This is part of a document-based core data setup; the data model has three entities that are relevant to this activity; for my purposes here I will call the first two A and B. There is a one-to-many relationship from A to B, such that an A has - let's call them "kids", and the reverse would be the "parent" of a B. Every B is tied to an A; an A will usually have one or more B's. The individual rows in the NSTableView are members of another entity, which I herein call E, which has a many-to-one relationship to a B (any given E has exactly one B tied to it, call it the "b" of E; but several E's can be tied to the same B). I created a custom NSManagedObject subclass which implements a method, call it "a", which returns "b.parent" - the A of the B that the E is connected to. Attempt at a picture: A -> B <- E | -> B | -> B <-- E |- E The first NSPopupButtonCell should have a list of all of the A's and let me pick one - that much I have working using bindings: Content: aController.arrangedObjects Content Values: aController.arrangedObjects.name Selected Object: eController.arrangedObjects.a Now I'm trying to figure out how to set up the second NSPopupButtonCell to list all of the B's whose parent is A (so, a.kids) with the "b" of E being the selected one. I can't very well use another NSArrayController to do this (at least not via IB?) since the list may be different for each row of the table. I'm a bit confused on how to rig this one and I'm not finding any clear documentation to help with this. Does anyone have any suggestions on how to make this work? I don't want to just list all of the B's since there could be thousands of them and it would be WAY too much to navigate through without narrowing it down first (thus the first popup list...) Now what I am hoping is the simpler one: I have a custom subclass of NSTextFieldCell which I am using to show an icon in an NSBrowser. The icon image is being generated dynamically by a method in my subclass and I want it to change more or less in "real time" as a bound value changes. I have that almost working, but the one problem is that it doesn't refresh when I need it to. Is there some way I can "force" a browser cell to redraw its image, short of redrawing the entire browser or window? The text isn't changing, just the icon, but I'd settle for redrawing the cell... I've tried a number of things to get this working and it seems I keep coming up short. Thank you! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: NSBrowser Frustration
Now I feel stupid. For efficiency, my code was caching the values for the second column, but I never cleared that cache before trying to refresh that column. The browser was refreshing the (now incorrect) cached values - clearing my cache out so that it was rebuilt fixed my issue. Sorry for any confusion! On 3/7/2015 12:39, Frank D. Engel, Jr. wrote: I have an NSBrowser class which has at most two columns; it is populated from a core data store. If I delete an object from the core data store that is from the first column of the browser, I can send loadColumnZero to the browser object, and it correctly refreshes the column and deselects everything. I cannot, however, find a programmatic way to correctly refresh the second column (column number 1) when I delete something from there. If I try loadColumnZero, then reselect the item in the first column, the second column shows a blank entry in the second column where the old object was. If I select a different item in the first column, then reselect the one that would show the deleted item, then it refreshes correctly; but if I programmatically do this within the method that performs the delete, it ends up showing the same thing as if I hadn't done the reload. I have tried reloadColumn:1, reloadDataForRowIndexes..., and numerous combinations of these and other method calls, and no matter what I try I can't seem to get it to just refresh the column. The only thing that comes close to doing what I want is to have it select a different item in the first column (selectRow:0 inColumn:0), which leaves it on the "wrong" item in the first column - when I then manually select the desired column, it does correctly reload. What am I missing - how can I get it to just do the sensible thing and refresh the data in the second column? This is getting frustrating, and I'm sure I must be missing something simple...? I'm on OS X 10.9.5 if that makes a difference. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: NSBrowser tooltips
On May 5, 2014, at 4:58 PM, Paul Wasmund wrote: > I am using an NSBrowser to display items and my code is based on the > ComplexBrowser sample from Apple. This uses browser features introduced in > 10.6 and does not implement a NSMatrix to display columns. The only support I > see for implementing tooltips is > browser:shouldShowCellExpansionForRow:column: which does not allow for a > custom tooltip, only the display of the entire cell contents if the cell > contents doesn't fit in the column. Is there some way of implementing custom > tooltips for any cell in the browser? Well, it's not directly associated with cells, per se, but you can use -[NSView addToolTipRect:owner:userData:] to add a tooltip rect covering the whole browser view (and update it when its bounds change). Set the owner to an object which implements the NSToolTipOwner informal protocol – i.e. the -view:stringForToolTip:point:userData: method. In that method, you can translate from the point to a row and column and return an appropriate string. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSBrowser tooltips
I am using an NSBrowser to display items and my code is based on the ComplexBrowser sample from Apple. This uses browser features introduced in 10.6 and does not implement a NSMatrix to display columns. The only support I see for implementing tooltips is browser:shouldShowCellExpansionForRow:column: which does not allow for a custom tooltip, only the display of the entire cell contents if the cell contents doesn't fit in the column. Is there some way of implementing custom tooltips for any cell in the browser? Paul Wasmund ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: NSBrowser editItemAtIndexPath:withEvent:select:
None of the suggestions panned out. The setting of the allowsBranchSelection had no effect on being able to edit the first row entry programmatically and neither did the isLeaf value. The other relevant values are: isEditable = 1 indexPath = 1 indexes [13] and those look good to me. Any other ideas? Paul On Apr 12, 2013, at 8:59 AM, Keary Suska wrote: > On Apr 4, 2013, at 3:13 PM, Paul Wasmund wrote: > >> I am trying to use editItemAtIndexPath:withEvent:select: in my program to >> programatically start editing the text in my cell. It works for all items >> except those in the first column. As an experiment I added code to the Apple >> sample ComplexBrowser and the same thing happened. Is this a bug, by design, >> or are there extra hoops to jump through to get this to work in the first >> column? >> >> The cells in the first column CAN be edited via clicking in the text of a >> selected cell. >> >> ComplexBrowser changes: >> >> Add to appController.m >> >> - (void)awakeFromNib { >> >> ... >> >> [_browser setAction:@selector(_browserClicked:)]; // add to end of >> awakeFromNib >> } >> >> >> - (void)_browserClicked:(id)sender >> { >> FileSystemBrowserCell *cell = [_browser selectedCell]; >> [cell setEditable:YES]; >> NSIndexPath *path = [_browser selectionIndexPath]; >> [_browser editItemAtIndexPath:path withEvent:nil select:YES]; >> } >> >> - (BOOL)browser:(NSBrowser *)myBrowser shouldEditItem:(id)item >> { >> return YES; >> } >> >> Selecting any cell in the browser should put it into edit mode. Only works >> for items in columns other than the first one. > > > Have you inspected the index path to make sure it is the expected value? In > either case it may not be an issue of "first" column but whether the item is > a "branch" or a "leaf". What is the value of allowsBranchSelection ? Does > setting it to YES change anything? Additionally, this difference may mean > more in the first column than in subsequent columns. Putting a leaf node in > the first column and selecting it may reveal something. > > 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser editItemAtIndexPath:withEvent:select:
On Apr 4, 2013, at 3:13 PM, Paul Wasmund wrote: > I am trying to use editItemAtIndexPath:withEvent:select: in my program to > programatically start editing the text in my cell. It works for all items > except those in the first column. As an experiment I added code to the Apple > sample ComplexBrowser and the same thing happened. Is this a bug, by design, > or are there extra hoops to jump through to get this to work in the first > column? > > The cells in the first column CAN be edited via clicking in the text of a > selected cell. > > ComplexBrowser changes: > > Add to appController.m > > - (void)awakeFromNib { > > ... > >[_browser setAction:@selector(_browserClicked:)]; // add to end of > awakeFromNib > } > > > - (void)_browserClicked:(id)sender > { > FileSystemBrowserCell *cell = [_browser selectedCell]; > [cell setEditable:YES]; > NSIndexPath *path = [_browser selectionIndexPath]; > [_browser editItemAtIndexPath:path withEvent:nil select:YES]; > } > > - (BOOL)browser:(NSBrowser *)myBrowser shouldEditItem:(id)item > { > return YES; > } > > Selecting any cell in the browser should put it into edit mode. Only works > for items in columns other than the first one. Have you inspected the index path to make sure it is the expected value? In either case it may not be an issue of "first" column but whether the item is a "branch" or a "leaf". What is the value of allowsBranchSelection ? Does setting it to YES change anything? Additionally, this difference may mean more in the first column than in subsequent columns. Putting a leaf node in the first column and selecting it may reveal something. 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser editItemAtIndexPath:withEvent:select:
If the problem is with the index path, you could get selectedRowInColumn:0 and construct your own index path with the returned value. -- Gary L. Wade http://www.garywade.com/ On 4/4/2013 2:13 PM, "Paul Wasmund" wrote: >I am trying to use editItemAtIndexPath:withEvent:select: in my program to >programatically start editing the text in my cell. It works for all items >except those in the first column. As an experiment I added code to the >Apple sample ComplexBrowser and the same thing happened. Is this a bug, >by design, or are there extra hoops to jump through to get this to work >in the first column? > >The cells in the first column CAN be edited via clicking in the text of a >selected cell. > >ComplexBrowser changes: > >Add to appController.m > >- (void)awakeFromNib { > >... > >[_browser setAction:@selector(_browserClicked:)]; // add to end of >awakeFromNib >} > > >- (void)_browserClicked:(id)sender >{ > FileSystemBrowserCell *cell = [_browser selectedCell]; > [cell setEditable:YES]; > NSIndexPath *path = [_browser selectionIndexPath]; > [_browser editItemAtIndexPath:path withEvent:nil select:YES]; >} > >- (BOOL)browser:(NSBrowser *)myBrowser shouldEditItem:(id)item >{ > return YES; >} > >Selecting any cell in the browser should put it into edit mode. Only >works for items in columns other than the first one. > > >Paul ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
NSBrowser editItemAtIndexPath:withEvent:select:
I am trying to use editItemAtIndexPath:withEvent:select: in my program to programatically start editing the text in my cell. It works for all items except those in the first column. As an experiment I added code to the Apple sample ComplexBrowser and the same thing happened. Is this a bug, by design, or are there extra hoops to jump through to get this to work in the first column? The cells in the first column CAN be edited via clicking in the text of a selected cell. ComplexBrowser changes: Add to appController.m - (void)awakeFromNib { ... [_browser setAction:@selector(_browserClicked:)]; // add to end of awakeFromNib } - (void)_browserClicked:(id)sender { FileSystemBrowserCell *cell = [_browser selectedCell]; [cell setEditable:YES]; NSIndexPath *path = [_browser selectionIndexPath]; [_browser editItemAtIndexPath:path withEvent:nil select:YES]; } - (BOOL)browser:(NSBrowser *)myBrowser shouldEditItem:(id)item { return YES; } Selecting any cell in the browser should put it into edit mode. Only works for items in columns other than the first one. Paul ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
NSBrowser fills NSPasteboard but won't drop
I have an NSBroswer with a series of entries that look up a text blob. If the blob exists then: - (BOOL)browser:canDragRowsWithIndexes:inColumn:withEvent: returns YES. This invokes - (BOOL)browser:writeRowsWithIndexes:inColumn:toPasteboard: In here I do the following: NSUInteger changeCount; BOOL retBOOL = YES; changeCount = [pasteboard clearContents]; changeCount = [pasteboard declareTypes:@[NSPasteboardTypeString, NSPasteboardTypeHTML] owner:self]; didSet = [pasteboard setString:self.currentHTMLCode forType:NSPasteboardTypeString]; retBOOL = retBOOL & didSet; didSet = [pasteboard setString:[NSString stringWithFormat:@"%@", self.currentHTMLCode] forType:NSPasteboardTypeHTML]; retBOOL = retBOOL & didSet; Now the data analysis of the pasteboard coming out (with retBOOL: Yes) is: pasteboard: : name: : Apple CFPasteboard drag change count: : 77 types: : ( "public.utf8-plain-text", NSStringPboardType, "public.html", "Apple HTML pasteboard type" ) items: : ( "" ) PBItem: : PBType: : public.utf8-plain-text String for type [public.utf8-plain-text] = 89958 characters PBType: : public.html String for type [public.html] = 89969 characters retValue: YES So my problem is that when I drag this to SimpleText or BBEdit, nothing drops. I don't see a highlight of the target document. (Note: I also have a drag image routine, and I see the drag image) Any ideas why I seem to be populating the pasteboard but it refuses to drop in the other app? Thanks, -Andrei ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: NSBrowser column titles disappear when scrolled [SOLVED]
On Sep 9, 2011, at 4:03 PM, Matt Neuburg wrote: > I do hope you're filing bugs on all of this! m. > > On Tue, 06 Sep 2011 06:30:33 -0400, Bill Cheeseman > said: >> >> The solution is to set the "Titled" checkbox in Interface Builder instead of >> calling -setTitled: in -awakeFromNib. Surely this is a bug in NSBrowser, and >> it must have been around since Jaguar or earlier. >> >> I also notice that setting "Titled" in Interface Builder causes "Separators" >> to be checked when you close the Interface Builder editor and then reopen >> it. It isn't nice to have Interface Builder automatically changing settings >> behind my back like this. Also, if I call -setSeparatesColumns: along with >> -setTitled in -awakeFromNib instead of using Interface Builder, the column >> titles still don't work right. So this is clearly a case of Interface >> Builder settings working when the corresponding methods do not work >> correctly. To add to the mystery, the documentation for >> -setSeparatesColumns: says its value "is ignored if -isTitled: does not >> return no." The double negative must have confused the author of that >> sentence, because the value of YES does seem to be required (at least in >> Interface Builder) for column titles to work correctly. Thanks for reminding me. I certainly will. -- Bill Cheeseman - b...@cheeseman.name ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSBrowser column titles disappear when scrolled [SOLVED]
I do hope you're filing bugs on all of this! m. On Tue, 06 Sep 2011 06:30:33 -0400, Bill Cheeseman said: > >The solution is to set the "Titled" checkbox in Interface Builder instead of >calling -setTitled: in -awakeFromNib. Surely this is a bug in NSBrowser, and >it must have been around since Jaguar or earlier. > >I also notice that setting "Titled" in Interface Builder causes "Separators" >to be checked when you close the Interface Builder editor and then reopen it. >It isn't nice to have Interface Builder automatically changing settings behind >my back like this. Also, if I call -setSeparatesColumns: along with -setTitled >in -awakeFromNib instead of using Interface Builder, the column titles still >don't work right. So this is clearly a case of Interface Builder settings >working when the corresponding methods do not work correctly. To add to the >mystery, the documentation for -setSeparatesColumns: says its value "is >ignored if -isTitled: does not return no." The double negative must have >confused the author of that sentence, because the value of YES does seem to be >required (at least in Interface Builder) for column titles to work correctly. -- matt neuburg, phd = m...@tidbits.com, <http://www.apeth.net/matt/> A fool + a tool + an autorelease pool = cool! Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSBrowser column titles disappear when scrolled [SOLVED]
On Sep 5, 2011, at 8:39 AM, Bill Cheeseman wrote: > Long ago, I found that NSBrowser column titles disappear when the user > manually scrolls the browser horizontally, or clicks a cell that forces the > browser to scroll horizontally to show the children of the new selection in > the next column. Manually resizing the window or any column causes them to > reappear immediately. (This is with the browser set so that each column takes > its title from the previous column's selection, and the user is allowed to > resize columns.) This seems like it must be a bug in NSBrowser. > > For many years, I cured the problem by implementing the -browserDidScroll: > delegate method and calling -setNeedsDisplayInRect: on the title frame of the > last column. > > That fix no longer works in Lion, and I can't find any other way to fix it. The solution is very surprising. I had always called -[NSBrowser setTitled:], setting it to YES in my window controller's -awakeFromNib method. This does have the expected effect of showing column titles initially -- but they disappear when the browser is scrolled horizontally, although the rect where they initially appeared is still there above the browser. The solution is to set the "Titled" checkbox in Interface Builder instead of calling -setTitled: in -awakeFromNib. Surely this is a bug in NSBrowser, and it must have been around since Jaguar or earlier. I also notice that setting "Titled" in Interface Builder causes "Separators" to be checked when you close the Interface Builder editor and then reopen it. It isn't nice to have Interface Builder automatically changing settings behind my back like this. Also, if I call -setSeparatesColumns: along with -setTitled in -awakeFromNib instead of using Interface Builder, the column titles still don't work right. So this is clearly a case of Interface Builder settings working when the corresponding methods do not work correctly. To add to the mystery, the documentation for -setSeparatesColumns: says its value "is ignored if -isTitled: does not return no." The double negative must have confused the author of that sentence, because the value of YES does seem to be required (at least in Interface Builder) for column titles to work correctly. -- Bill Cheeseman - b...@cheeseman.name ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
NSBrowser column titles disappear when scrolled
Long ago, I found that NSBrowser column titles disappear when the user manually scrolls the browser horizontally, or clicks a cell that forces the browser to scroll horizontally to show the children of the new selection in the next column. Manually resizing the window or any column causes them to reappear immediately. (This is with the browser set so that each column takes its title from the previous column's selection, and the user is allowed to resize columns.) This seems like it must be a bug in NSBrowser. For many years, I cured the problem by implementing the -browserDidScroll: delegate method and calling -setNeedsDisplayInRect: on the title frame of the last column. That fix no longer works in Lion, and I can't find any other way to fix it. Do others see this problem? How do you fix it? -- Bill Cheeseman - b...@cheeseman.name ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSBrowser matrix
Your instantiating your NSBrowser from a nib file. Try over riding - (id)initWithCoder:(NSCoder *)coder -raleigh On Jun 26, 2011, at 4:18 AM, Ari Black wrote: > On 11-06-26 7:04 AM, Fritz Anderson wrote: >> >> On 25 Jun 2011, at 7:05 PM, Ari Black wrote: >> >>> @implementation SpecialMatrix >>> >>> - (id)initWithFrame:(NSRect)frameRect mode:(NSMatrixMode)aMode >>> prototype:(NSCell *)aCell numberOfRows:(NSInteger)numRows >>> numberOfColumns:(NSInteger)numColumns { >>>int x; >>>x = 0; // I put a breakpoint here >>> >>>return self; >>> } >>> >>> @end >> >> You don't get to this point, so it's not the problem you have now, but I >> assume your real code invokes [super initWithFrame:...]? > > I hadn't put a call to [super ...] yet as I wanted to verify that my > initWithFrame: was being called. Once I get this problem worked out, I will > call [super ...]. > >> >>> This is in the implementation of the class that controls the window the >>> browser is in: >>> >>> - (void)awakeFromNib { >>>[browser setMatrixClass:[SpecialMatrix class]]; >>> >>>[browser loadColumnZero]; >>> >>>NSMatrix *matrix = [storyLine matrixInColumn:0]; //<- return nil >>>matrix = [storyLine matrixInColumn:1]; //<- returns nil >>> } >> >> First step: Break in -awakeFromNib and verify that browser is not nil. > > I've tested this and it's not nil. browser is an outlet I created and > connected with IB. The NSBrowser works for adding items to all of the columns > and I check to make sure that SpecialMatrix is set to be the matrix class in > browser after the call to setMatrixClass: > >> >> Second step: Maybe an NSBrowser doesn't instantiate any matrices until you >> have responded to browser:numberOfRowsInColumn: with a non-zero value? >> >> — F > > That's possible, but I've tested adding items to the columns and > SpecialMatrix's initWith...: doesn't get called. > > I do want to point out that I'm implementing > browser:numberOfChildrenOfItem: not browser:numberOfRowsInColumn, does that > make a difference? > > Thanks! > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/ledet%40apple.com > > This email sent to le...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser matrix
On 11-06-26 7:04 AM, Fritz Anderson wrote: On 25 Jun 2011, at 7:05 PM, Ari Black wrote: @implementation SpecialMatrix - (id)initWithFrame:(NSRect)frameRect mode:(NSMatrixMode)aMode prototype:(NSCell *)aCell numberOfRows:(NSInteger)numRows numberOfColumns:(NSInteger)numColumns { int x; x = 0; // I put a breakpoint here return self; } @end You don't get to this point, so it's not the problem you have now, but I assume your real code invokes [super initWithFrame:...]? I hadn't put a call to [super ...] yet as I wanted to verify that my initWithFrame: was being called. Once I get this problem worked out, I will call [super ...]. This is in the implementation of the class that controls the window the browser is in: - (void)awakeFromNib { [browser setMatrixClass:[SpecialMatrix class]]; [browser loadColumnZero]; NSMatrix *matrix = [storyLine matrixInColumn:0]; //<- return nil matrix = [storyLine matrixInColumn:1]; //<- returns nil } First step: Break in -awakeFromNib and verify that browser is not nil. I've tested this and it's not nil. browser is an outlet I created and connected with IB. The NSBrowser works for adding items to all of the columns and I check to make sure that SpecialMatrix is set to be the matrix class in browser after the call to setMatrixClass: Second step: Maybe an NSBrowser doesn't instantiate any matrices until you have responded to browser:numberOfRowsInColumn: with a non-zero value? — F That's possible, but I've tested adding items to the columns and SpecialMatrix's initWith...: doesn't get called. I do want to point out that I'm implementing browser:numberOfChildrenOfItem: not browser:numberOfRowsInColumn, does that make a difference? Thanks! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser matrix
On 26 Jun 2011, at 6:18 AM, Ari Black wrote: >> Second step: Maybe an NSBrowser doesn't instantiate any matrices until you >> have responded to browser:numberOfRowsInColumn: with a non-zero value? >> >> — F > > That's possible, but I've tested adding items to the columns and > SpecialMatrix's initWith...: doesn't get called. > > I do want to point out that I'm implementing > browser:numberOfChildrenOfItem: not browser:numberOfRowsInColumn, does that > make a difference? Yes. The first returns the number of rows in column n+1, given an item in column n. The second returns whether there are any items in column n at all. — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSBrowser matrix
On 25 Jun 2011, at 7:05 PM, Ari Black wrote: > @implementation SpecialMatrix > > - (id)initWithFrame:(NSRect)frameRect mode:(NSMatrixMode)aMode > prototype:(NSCell *)aCell numberOfRows:(NSInteger)numRows > numberOfColumns:(NSInteger)numColumns { >int x; >x = 0; // I put a breakpoint here > >return self; > } > > @end You don't get to this point, so it's not the problem you have now, but I assume your real code invokes [super initWithFrame:...]? > This is in the implementation of the class that controls the window the > browser is in: > > - (void)awakeFromNib { >[browser setMatrixClass:[SpecialMatrix class]]; > >[browser loadColumnZero]; > >NSMatrix *matrix = [storyLine matrixInColumn:0]; // <- return nil >matrix = [storyLine matrixInColumn:1]; // <- returns nil > } First step: Break in -awakeFromNib and verify that browser is not nil. Second step: Maybe an NSBrowser doesn't instantiate any matrices until you have responded to browser:numberOfRowsInColumn: with a non-zero value? — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
NSBrowser matrix
Hello all, I'm trying to set the matrix class for an NSBrowser I have in a window. I have the following in my .h file: @interface SpecialMatrix : NSMatrix { } //- (id)initWithFrame:(NSRect)frameRect mode:(NSMatrixMode)aMode prototype:(NSCell *)aCell numberOfRows:(NSInteger)numRows numberOfColumns:(NSInteger)numColumns; @end And this is in the .m: @implementation SpecialMatrix - (id)initWithFrame:(NSRect)frameRect mode:(NSMatrixMode)aMode prototype:(NSCell *)aCell numberOfRows:(NSInteger)numRows numberOfColumns:(NSInteger)numColumns { int x; x = 0; // I put a breakpoint here return self; } @end This is in the implementation of the class that controls the window the browser is in: - (void)awakeFromNib { [browser setMatrixClass:[SpecialMatrix class]]; [browser loadColumnZero]; NSMatrix *matrix = [storyLine matrixInColumn:0]; // <- return nil matrix = [storyLine matrixInColumn:1]; // <- returns nil } From the documentation, initWithFrame:mode:prototype:numberOfRos:numberOfColumns is the designated method but it's never called even when I called loadColumnZero. Both calls to matrixInColumn: return nil. Can someone tell me what I'm doing wrong? Thanks! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dragging from an NSBrowser to an NSTableView
HI Mike, we have implemented the following delegate methods in our class for the Table view and the respective counter parts for NSBrowser have also been added. I tested by placing break points on these two methods but still was not able to see them getting hit when the drag and drop was performed. - (NSDragOperation)tableView:(NSTableView*)aTableView validateDrop:(id )info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)op { } - (BOOL)tableView:(NSTableView*)aTableView acceptDrop:(id )info row:(int)dropRow dropOperation:(NSTableViewDropOperation)op { } PS: The dragTypes for both the browser as well as NSTableView have been set to NSStringPasteboardType Please let me know if we are missing something. As of now it would be great if the control would just flow into these methods. Thanks in Advance Sandeep. On Jun 23, 2011, at 4:03 AM, Mike Abdullah wrote: > Look at the datasource API for each view. They both have methods for writing > and reading to/from the pasteboard. > > On 23 Jun 2011, at 09:38, Sandeep Mohan Bhandarkar wrote: > >> Hi All, >> >> within my application i have a screen where exists and NSBrowser as well as >> an NSTableViews. can someone please let me know we can implement dragging >> items from the browser to the table view. >> any source reference on this would be very helpful. >> >> Thanks in Advance, >> Sandeep. >> >> >> >> >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net >> >> This email sent to cocoa...@mikeabdullah.net > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Dragging from an NSBrowser to an NSTableView
Look at the datasource API for each view. They both have methods for writing and reading to/from the pasteboard. On 23 Jun 2011, at 09:38, Sandeep Mohan Bhandarkar wrote: > Hi All, > > within my application i have a screen where exists and NSBrowser as well as > an NSTableViews. can someone please let me know we can implement dragging > items from the browser to the table view. > any source reference on this would be very helpful. > > Thanks in Advance, > Sandeep. > > > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net > > This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Dragging from an NSBrowser to an NSTableView
Hi All, within my application i have a screen where exists and NSBrowser as well as an NSTableViews. can someone please let me know we can implement dragging items from the browser to the table view. any source reference on this would be very helpful. Thanks in Advance, Sandeep. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSBrowser Drag and Drop Issue !!
I tried by setting break point on objc_exception_throw. Unable to get anything from the stack trace. Following is the stack trace. #0 0x7fff835d70da in objc_exception_throw () #1 0x7fff81060c9b in -[NSBrowser _beginColumnDragging] () #2 0x7fff8105b04f in -[NSBrowserTableView draggingEntered:] () #3 0x7fff81114bac in NSCoreDragTrackingProc () #4 0x7fff825b24ce in DoTrackingMessage () #5 0x7fff825b27e0 in SendTrackingMessage () #6 0x7fff825b4001 in DragInApplication () #7 0x7fff825b4b1d in CoreDragStartDragging () #8 0x7fff81115eb8 in -[NSCoreDragManager _dragUntilMouseUp:accepted:] () #9 0x7fff811158fe in -[NSCoreDragManager dragImage:fromWindow:at:offset:event:pasteboard:source:slideBack:] () #10 0x7fff813d0a72 in -[NSWindow(NSDrag) dragImage:at:offset:event:pasteboard:source:slideBack:] () #11 0x7fff812dd24d in -[NSTableView _doImageDragUsingRowsWithIndexes:event:pasteboard:source:slideBack:startRow:] () #12 0x7fff8105b134 in -[NSBrowserTableView _doImageDragUsingRowsWithIndexes:event:pasteboard:source:slideBack:startRow:] () #13 0x7fff80f2e2ca in -[NSTableView _performDragFromMouseDown:] () #14 0x7fff80f2cb9b in -[NSTableView mouseDown:] () #15 0x7fff8105b961 in -[NSBrowserTableView mouseDown:] () #16 0x7fff80ecf34f in -[NSWindow sendEvent:] () #17 0x7fff80e04a86 in -[NSApplication sendEvent:] () #18 0x7fff80d9b4da in -[NSApplication run] () #19 0x7fff80d941a8 in NSApplicationMain () #20 0x00011e54 in start () *** Canceling drag because exception 'NSInternalInconsistencyException' (reason 'Can not nest column dragging sessions') was raised during a dragging session I think the above exception says that, its not possible to nest dragging sessions. I'm not sure where its happening. Thanks, Naresh Kongara On Apr 15, 2011, at 11:27 AM, Corbin Dunn wrote: > > On Apr 14, 2011, at 5:16 PM, Naresh Kongara wrote: > >> HI All, >> >> I implemented drag and drop in NSBrowser, through which I can drag items >> from other views or windows of the applications. The drag and drop in >> NSBrowser is implemented through its delegate methods. >> Everything is going fine except I'm getting the following exception while >> dropping, after which the draggedImage is slide back to original position. >> >> *** Canceling drag because exception 'NSInternalInconsistencyException' >> (reason 'Can not nest column dragging sessions') was raised during a >> dragging session >> >> >> Does any one has any idea/solution for the above exception. > > Break on objc_exception_throw and look at the bt. > > Don't forget that it is your number on breakpoint. > http://www.corbinstreehouse.com/blog/2008/08/your-most-important-breakpoint-in-cocoa/ > > Xcode 4 makes it even easier to break on it. > > corbin > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser Drag and Drop Issue !!
On Apr 14, 2011, at 5:16 PM, Naresh Kongara wrote: > HI All, > > I implemented drag and drop in NSBrowser, through which I can drag items from > other views or windows of the applications. The drag and drop in NSBrowser is > implemented through its delegate methods. > Everything is going fine except I'm getting the following exception while > dropping, after which the draggedImage is slide back to original position. > > *** Canceling drag because exception 'NSInternalInconsistencyException' > (reason 'Can not nest column dragging sessions') was raised during a dragging > session > > > Does any one has any idea/solution for the above exception. Break on objc_exception_throw and look at the bt. Don't forget that it is your number on breakpoint. http://www.corbinstreehouse.com/blog/2008/08/your-most-important-breakpoint-in-cocoa/ Xcode 4 makes it even easier to break on it. corbin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSBrowser Drag and Drop Issue !!
HI All, I implemented drag and drop in NSBrowser, through which I can drag items from other views or windows of the applications. The drag and drop in NSBrowser is implemented through its delegate methods. Everything is going fine except I'm getting the following exception while dropping, after which the draggedImage is slide back to original position. *** Canceling drag because exception 'NSInternalInconsistencyException' (reason 'Can not nest column dragging sessions') was raised during a dragging session Does any one has any idea/solution for the above exception. Do let me know. Thanks, Naresh Kongara ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSBrowser & column resizing
On Mar 6, 2011, at 4:01 PM, Raleigh Ledet wrote: > Why not just a headerViewController on NSBrowser proper? That looks like it might be exactly what I want. I missed it when skimming NSBrowser/Delegate docs. Thanks. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser & column resizing
Why not just a headerViewController on NSBrowser proper? -raleigh On Mar 2, 2011, at 10:03 AM, Scott Ribe wrote: > I need to implement a custom control, which would look very much like an > NSBrowser with a "header row" above each column which would have 1 or 2 > controls per column. It seems like a custom view that embeds an NSBrowser > would be a good starting point. But I'd want my header row cell to resize > along with the column when the user is resizing the column, not snap to the > new size after the user is done resizing. > > Is there any way to hook into column resizing during the drag? > > FWIW, I only need to support 10.6, nothing earlier. > > > -- > Scott Ribe > scott_r...@elevated-dev.com > http://www.elevated-dev.com/ > (303) 722-0567 voice > > > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/ledet%40apple.com > > This email sent to le...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSBrowser & column resizing
I need to implement a custom control, which would look very much like an NSBrowser with a "header row" above each column which would have 1 or 2 controls per column. It seems like a custom view that embeds an NSBrowser would be a good starting point. But I'd want my header row cell to resize along with the column when the user is resizing the column, not snap to the new size after the user is done resizing. Is there any way to hook into column resizing during the drag? FWIW, I only need to support 10.6, nothing earlier. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser
yes i found, thank a lot Le 17 nov. 10 à 18:27, Dave DeLong a écrit : NSBrowser is a subclass of NSControl, which happens to have a target and action mechanism. Have you tried hooking up your browser's target and action? Dave On Nov 17, 2010, at 8:52 AM, Bruno Causse wrote: i can navigate in a tree through the NSbrowser (mouse or keyboard), I would like to view the properties of representedObject during my browsing. but I don't find delegate's method (passif delegate). ( kind: selectedDidChange:) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/bcausse%40lepoint.fr This email sent to bcau...@lepoint.fr ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSBrowser
NSBrowser is a subclass of NSControl, which happens to have a target and action mechanism. Have you tried hooking up your browser's target and action? Dave On Nov 17, 2010, at 8:52 AM, Bruno Causse wrote: > i can navigate in a tree through the NSbrowser (mouse or keyboard), > I would like to view the properties of representedObject during my browsing. > but I don't find delegate's method (passif delegate). ( kind: > selectedDidChange:) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
NSBrowser
hi, i can navigate in a tree through the NSbrowser (mouse or keyboard), I would like to view the properties of representedObject during my browsing. but I don't find delegate's method (passif delegate). ( kind: selectedDidChange:) is it possible? who have a track? a link? thank ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
NSBrowser and column's titles
hi, When I instantiate my browser from XIB file, and when i play with hierarchy, the column 's titles do not appear. Only after the resize the window (container), that the conportment of titles is correct. have you a solution to fix this? thank. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Accessing Scrollers in NSBrowser ?
Hi, I want to add an icon over scrollers of Each column in NSBrowser. How can I access the scrollview of each column and how to add action icon to the scroller in each column. Can anybody help me out ? Thanks. kongara___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
NSBrowser drawing glitch
Hi! NSBrowser leaves an annoying 2-pixel gap between the right edge of a highlighted browser cell and the vertical column slider. Picture: http://dl.dropbox.com/u/86388/NSBrowserDrawingGlitch.png It does go away when the column width is changed live by the user, but reappears when the cell is redrawn. It's not there when the browser shows separators (setSeparateColumns:YES). I am using a regular NSBrowser, pulled from the IB palette, without any fancy stuff done to it. Any ideas why that is? Is it a common problem? Thanks! Sebastian ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
-[NSBrowser setReusesColumns:] broken?
Greetings, I'm trying to implement an NSBrowser view using the legacy (10.5) compatible delegate methods (i.e. not the 10.6 "item data source" methods). I'd very much like to use the reusesColumns property to recycle my, rather complex, NSMatrix subclasses. However this property appears to broken. I'm currently developing and testing under 10.6. The first time my delegate receives -browser:createRowsForColumn:inMatrix:, the matrix parameter is correct and the column gets populated with data. When I select another item in the first column, my delegate receives -browser:createRowsForColumn:inMatrix: again, but this time the matrix value is nil. This makes no sense. Sending the NSBrowser object -matrixInColumn: also returns nil. Is this just broken? TIA P.S. I'd love to use the new 10.6 browser API, but it seems that the new code doesn't use NSMatrix objects for each column; instead using some kind of custom view that doesn't appear to be customizable. Is that also correct? -- James Bucanek ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSBrowser and double click
On Jul 26, 2010, at 12:32 PM, mark wrote: >> On 25/07/2010, at 9:00 AM, mark wrote: >> >>> A problem which is driving me spastic: >>> I have an NSBrowser that allowes multiple selection. >>> When I double click one of the selected items, all other selected items >>> deselect. >>> I have set the doubleaction and action methods and correct target. These >>> are called AFTER the deselection. >>> I have tried to override doClick and that doesn't prevent the deselection. >>> Any ideas? >> >> In general this is the expected behaviour. Most stuff that handles multiple >> selection doesn't wait to see if a click is going to end up as the first of >> a double-click, and so processes the first click in a straightforward way. >> Typically, this is to deselect everything except what was clicked (unless >> modifier keys are down that might extend or flip the selection). On the >> second click, the double-click is detected and the double action triggered. > > How does the Finder do it? It uses the "item based" browser API in 10.6, which behaves correctly. The "matrix based" browser has the bug you mentioned. corbin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser and double click
On 25/07/2010, at 9:00 AM, mark wrote: A problem which is driving me spastic: I have an NSBrowser that allowes multiple selection. When I double click one of the selected items, all other selected items deselect. I have set the doubleaction and action methods and correct target. These are called AFTER the deselection. I have tried to override doClick and that doesn't prevent the deselection. Any ideas? In general this is the expected behaviour. Most stuff that handles multiple selection doesn't wait to see if a click is going to end up as the first of a double-click, and so processes the first click in a straightforward way. Typically, this is to deselect everything except what was clicked (unless modifier keys are down that might extend or flip the selection). On the second click, the double-click is detected and the double action triggered. How does the Finder do it? It is possible to be smarter when processing clicks and wait to see if a second click arrives within the double-click time before processing the first click, but you rarely see code that does this, since for one thing it seems unresponsive - every single-click will have no effect until the double-click period elapses. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser and double click
On 25/07/2010, at 9:00 AM, mark wrote: > A problem which is driving me spastic: > I have an NSBrowser that allowes multiple selection. > When I double click one of the selected items, all other selected items > deselect. > I have set the doubleaction and action methods and correct target. These are > called AFTER the deselection. > I have tried to override doClick and that doesn't prevent the deselection. > Any ideas? In general this is the expected behaviour. Most stuff that handles multiple selection doesn't wait to see if a click is going to end up as the first of a double-click, and so processes the first click in a straightforward way. Typically, this is to deselect everything except what was clicked (unless modifier keys are down that might extend or flip the selection). On the second click, the double-click is detected and the double action triggered. It is possible to be smarter when processing clicks and wait to see if a second click arrives within the double-click time before processing the first click, but you rarely see code that does this, since for one thing it seems unresponsive - every single-click will have no effect until the double-click period elapses. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSBrowser and double click
A problem which is driving me spastic: I have an NSBrowser that allowes multiple selection. When I double click one of the selected items, all other selected items deselect. I have set the doubleaction and action methods and correct target. These are called AFTER the deselection. I have tried to override doClick and that doesn't prevent the deselection. Any ideas? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSBrowser dragging
Dear Corbin, Thanks for responding, however I must contradict you, vertical drag with ComplexBrower does work under 10.6. It does so because its cell is an NSTextfieldCell which inherits from NSActionCell. "Since NSBrowserCell does not inherit from NSActionCell, it doesn’t hold a target and action value and can’t directly participate in the target/action paradigm" quoted from your documentation "Introduction to Browsers" (Last updated: 2004-08-31). I believe that is why it doesn't work. Since I want my software to be 10.5 compatible, it looks like I'm out of luck. Setting the cellClass to NSTextFieldCell does nothing, the NSBrowser under 10.5 still creates NSBrowserCells. ComplexBrower uses 10.6 delegates methods and manages to set the cell class to text field cell. If anyone has any solution it would be great. Michael On 8 mai 2010, at 00:50, Corbin Dunn wrote: > > On May 7, 2010, at 1:01 AM, Micha Fuhrmann wrote: > >> Hi everyone, >> >> I've ran out of ideas, I just don't now what's wrong. >> >> I have an NSBrowser Object. >> >> I've set the delegate to another class which implements: >> >> - (BOOL)browser:(NSBrowser *)browser canDragRowsWithIndexes:(NSIndexSet >> *)rowIndexes inColumn:(NSInteger)column withEvent:(NSEvent *)event >> >> >> If I click-drag in the browser either right or left, the method is called. >> But if I click-drag up or down, it isn't. All that happens is the cells get >> selected. I've compared with the Apple example "ComplexBrowser", and i just >> cannot see any difference. > > The ComplexBrowser also works the same way. (I just tried it to make sure). > > Please log a bug requesting this ability. There is no way to customize it at > the current time. > > --corbin > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser dragging
On May 7, 2010, at 1:01 AM, Micha Fuhrmann wrote: > Hi everyone, > > I've ran out of ideas, I just don't now what's wrong. > > I have an NSBrowser Object. > > I've set the delegate to another class which implements: > > - (BOOL)browser:(NSBrowser *)browser canDragRowsWithIndexes:(NSIndexSet > *)rowIndexes inColumn:(NSInteger)column withEvent:(NSEvent *)event > > > If I click-drag in the browser either right or left, the method is called. > But if I click-drag up or down, it isn't. All that happens is the cells get > selected. I've compared with the Apple example "ComplexBrowser", and i just > cannot see any difference. The ComplexBrowser also works the same way. (I just tried it to make sure). Please log a bug requesting this ability. There is no way to customize it at the current time. --corbin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser dragging
On May 7, 2010, at 1:01 AM, Micha Fuhrmann wrote: > If I click-drag in the browser either right or left, the method is called. > But if I click-drag up or down, it isn't. All that happens is the cells get > selected. I've compared with the Apple example "ComplexBrowser", and i just > cannot see any difference. NSTableView has a flag that specifies whether vertical mouse-down movement selects or drags. I don’t see a similar flag on NSBrowser, though. Have you compared the browser settings in the inspector in IB for your nib vs. the sample one? —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 arch...@mail-archive.com
NSBrowser dragging
Hi everyone, I've ran out of ideas, I just don't now what's wrong. I have an NSBrowser Object. I've set the delegate to another class which implements: - (BOOL)browser:(NSBrowser *)browser canDragRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column withEvent:(NSEvent *)event If I click-drag in the browser either right or left, the method is called. But if I click-drag up or down, it isn't. All that happens is the cells get selected. I've compared with the Apple example "ComplexBrowser", and i just cannot see any difference. I'm lost here, any help appreciated. Michael ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTreeController, NSBrowser image setting
I've determined that what I want to do is not possible with using a NSTreeController and a NSBrowser. As I stated below, the willDisplayCell doesn't have the correct parameters to determine the represented object. Notice the cousin to NSBrowser, NSOutlineView, delegate willDisplayCell has the parameter, (id) item. - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item I've modified my app using the outline view, added the necessary support for the NSOutlineView tableview' cell to support icons and I am able to set images for each item. I will file a bug. If someone feels different, please let me know. Thanks, -tony On Mar 24, 2010, at 1:58 AM, Tony Romano wrote: >> From: Tony Romano >> Date: March 24, 2010 1:57:04 AM PDT >> To: Cocoa Developers >> Subject: Re: NSTreeController, NSBrowser image setting >> >> Thanks Ken, that was somewhat helpful. However, I am still having trouble >> mapping the arguments passed via(- (void)browser:(NSBrowser *)browser >> willDisplayCell:(id)cell atRow:(NSInteger)row column:(NSInteger)column; ) >> and which object it is referring to. With this little snippet I can get to >> all the children under the root. >> >> >> // treeView is the outlet to the NSTreeController object. >> NSArray *a = [[treeView arrangedObjects] childNodes]; >> >> for (NSTreeNode *tn in a) >> { >> // node is the object that I provided to the treeController to >> represent each entry in the tree >> node *n = [tn representedObject]; >> } >> >> The other method supported by the proxy, (NSTreeNode >> *)descendantNodeAtIndexPath:(NSIndexPath *)indexPath, requires an >> NSIndexPath object to access any child node in the tree. Building the >> NSIndexPath seems to be the big blocker. None of the methods for aNSBrowser >> will let you create an NSIndexPath if the data provided to the browser was >> not done via a data source. I am assuming I am missing something here. >> >> This is how I am assuming it would work >> >> NSTreeNode *nodeThatWillBeDisplayed = [treeView NSTreeNode >> *)descendantNodeAtIndexPath:someIndexPath]; >>node *n = [nodeThatWillBeDisplayed representedObject]; >> // Get the icon for the node >> // Set the image in the cell passed in via willDisplayCell >> // Life is good, move on. >> >> >> Anyone that can add some clarity to this, I would be greatly appreciate. >> >> -Tony >> >> >> On Mar 23, 2010, at 7:33 PM, Ken Thomases wrote: >> >>> On Mar 23, 2010, at 9:22 PM, Tony Romano wrote: >>> >>>> I'm using a NSTreeController and bindings to contain the data for a >>>> NSBrowser. Data from my objects is being displayed fine. I want to add >>>> an image to the entries in the browser. From what I gather, I need to >>>> implement the willDisplayCell delegate method. The question I have is how >>>> do I get MY object stored for the node being displayed. The documents >>>> state you cannot use the itemAt* methods if you did not use a data source, >>>> which I didn't. I did find on the Internet someone else who had a similar >>>> problem and the solution they found was call this method [item >>>> representedObject]. It's not clear what the receiver 'item' is. >>> >>> NSTreeController uses its own objects as the items. In Leopard and later, >>> they are NSTreeNode instances. Prior to that, they were completely opaque >>> objects. >>> >>> See >>> <http://developer.apple.com/mac/library/releasenotes/Cocoa/AppKitOlderNotes.html#NSTreeController>. >>> >>> Regards, >>> Ken >>> >>> >> >> -tony >> >> > > -tony > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/tonyrom%40hotmail.com > > This email sent to tony...@hotmail.com > -tony ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Fwd: NSTreeController, NSBrowser image setting
> From: Tony Romano > Date: March 24, 2010 1:57:04 AM PDT > To: Cocoa Developers > Subject: Re: NSTreeController, NSBrowser image setting > > Thanks Ken, that was somewhat helpful. However, I am still having trouble > mapping the arguments passed via(- (void)browser:(NSBrowser *)browser > willDisplayCell:(id)cell atRow:(NSInteger)row column:(NSInteger)column; ) > and which object it is referring to. With this little snippet I can get to > all the children under the root. > > >// treeView is the outlet to the NSTreeController object. > NSArray *a = [[treeView arrangedObjects] childNodes]; > > for (NSTreeNode *tn in a) > { > // node is the object that I provided to the treeController to > represent each entry in the tree > node *n = [tn representedObject]; > } > > The other method supported by the proxy, (NSTreeNode > *)descendantNodeAtIndexPath:(NSIndexPath *)indexPath, requires an NSIndexPath > object to access any child node in the tree. Building the NSIndexPath seems > to be the big blocker. None of the methods for aNSBrowser will let you > create an NSIndexPath if the data provided to the browser was not done via a > data source. I am assuming I am missing something here. > > This is how I am assuming it would work > > NSTreeNode *nodeThatWillBeDisplayed = [treeView NSTreeNode > *)descendantNodeAtIndexPath:someIndexPath]; > node *n = [nodeThatWillBeDisplayed representedObject]; > // Get the icon for the node > // Set the image in the cell passed in via willDisplayCell > // Life is good, move on. > > > Anyone that can add some clarity to this, I would be greatly appreciate. > > -Tony > > > On Mar 23, 2010, at 7:33 PM, Ken Thomases wrote: > >> On Mar 23, 2010, at 9:22 PM, Tony Romano wrote: >> >>> I'm using a NSTreeController and bindings to contain the data for a >>> NSBrowser. Data from my objects is being displayed fine. I want to add an >>> image to the entries in the browser. From what I gather, I need to >>> implement the willDisplayCell delegate method. The question I have is how >>> do I get MY object stored for the node being displayed. The documents state >>> you cannot use the itemAt* methods if you did not use a data source, which >>> I didn't. I did find on the Internet someone else who had a similar >>> problem and the solution they found was call this method [item >>> representedObject]. It's not clear what the receiver 'item' is. >> >> NSTreeController uses its own objects as the items. In Leopard and later, >> they are NSTreeNode instances. Prior to that, they were completely opaque >> objects. >> >> See >> <http://developer.apple.com/mac/library/releasenotes/Cocoa/AppKitOlderNotes.html#NSTreeController>. >> >> Regards, >> Ken >> >> > > -tony > > -tony ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSTreeController, NSBrowser image setting
On Mar 23, 2010, at 9:22 PM, Tony Romano wrote: > I'm using a NSTreeController and bindings to contain the data for a > NSBrowser. Data from my objects is being displayed fine. I want to add an > image to the entries in the browser. From what I gather, I need to implement > the willDisplayCell delegate method. The question I have is how do I get MY > object stored for the node being displayed. The documents state you cannot > use the itemAt* methods if you did not use a data source, which I didn't. I > did find on the Internet someone else who had a similar problem and the > solution they found was call this method [item representedObject]. It's not > clear what the receiver 'item' is. NSTreeController uses its own objects as the items. In Leopard and later, they are NSTreeNode instances. Prior to that, they were completely opaque objects. See <http://developer.apple.com/mac/library/releasenotes/Cocoa/AppKitOlderNotes.html#NSTreeController>. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTreeController, NSBrowser image setting
I'm using a NSTreeController and bindings to contain the data for a NSBrowser. Data from my objects is being displayed fine. I want to add an image to the entries in the browser. From what I gather, I need to implement the willDisplayCell delegate method. The question I have is how do I get MY object stored for the node being displayed. The documents state you cannot use the itemAt* methods if you did not use a data source, which I didn't. I did find on the Internet someone else who had a similar problem and the solution they found was call this method [item representedObject]. It's not clear what the receiver 'item' is. In addition, neither samples ComplexBrowser nor SimpleBrowser use a treecontroller. Note I am not using core data, my object is my own structure. Thanks in advance for the help, -Tony ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSBrowser and tab order
On Mar 18, 2010, at 9:48 AM, Keary Suska wrote: > On Mar 18, 2010, at 8:40 AM, Corbin Dunn wrote: > >> Aj -- I believe this was a bug fixed in 10.6; maybe 10.5. What OS are you on? >> >> The work around is to set it up in awakeFromNib. > > Is there any way to tab into an NSBrowser in 10.4? It seems that once the > browser loses focus, you can't get focus except by clicking... Yes -- ensure you have at least one column and make it the first responder. The issue is that the browser was incorrectly refusing first responder status if it had 0 columns. So, setting it up in IB it had non when unarchived...hence the problem. Alternatively, another solution: subclass NSBrowser and return YES from: - (BOOL)acceptsFirstResponder I double checked; we fixed this in 10.6 (for apps linked on 10.6+). Returning YES from the above method is the best, and most compatible solution. corbin > >> On Mar 18, 2010, at 1:15 AM, Andrew James wrote: >> >>> I have a nib file set up in Interface Builder with a window containing a >>> single NSBrowser. >>> >>> I have set the NSBrowser as the window's initialFirstResponder... but for >>> some reason when the window is displayed the NSBrowser does not receive >>> keyboard focus and will not receive keyboard focus until I click on it. >>> >>> I'm hoping I'm missing something trivially easy. > > > Keary Suska > Esoteritech, Inc. > "Demystifying technology for your home or business" > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser and tab order
Yup you got it. I actually tracked down an Apple doc in regards to that last evening. I did go ahead and set it up correctly in awakeFromNib as follows: // DUE to NSBrowser bug in regards to its implementation // of acceptsFirstResponder, forcibly load it and then // make it the first responder [ midiInBrowser loadColumnZero ]; [ [ selfwindow ] makeFirstResponder: midiInBrowser ]; I did have a bit of a research project in that setInitialResponder did not result in desired behavior but makeFirstResponder did. From the little bit I could glean from setInitialResponder it seems like this call merely "caches" an NSResponder to be set via makeFirstResponder at a later date. Given that, I can only assume that within awakeFromNib, I'd passed the "later date" where setInitialResponder could "cache" usefully. Always a learning experience. :) Cheers, --aj From: Corbin Dunn To: Andrew James Cc: list-cocoa-dev Sent: Thu, March 18, 2010 7:40:06 AM Subject: Re: NSBrowser and tab order Aj -- I believe this was a bug fixed in 10.6; maybe 10.5. What OS are you on? The work around is to set it up in awakeFromNib. corbin On Mar 18, 2010, at 1:15 AM, Andrew James wrote: > I have a nib file set up in Interface Builder with a window containing a > single NSBrowser. > > I have set the NSBrowser as the window's initialFirstResponder... but for > some reason when the window is displayed the NSBrowser does not receive > keyboard focus and will not receive keyboard focus until I click on it. > > I'm hoping I'm missing something trivially easy. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSBrowser and tab order
On Mar 18, 2010, at 8:40 AM, Corbin Dunn wrote: > Aj -- I believe this was a bug fixed in 10.6; maybe 10.5. What OS are you on? > > The work around is to set it up in awakeFromNib. Is there any way to tab into an NSBrowser in 10.4? It seems that once the browser loses focus, you can't get focus except by clicking... > On Mar 18, 2010, at 1:15 AM, Andrew James wrote: > >> I have a nib file set up in Interface Builder with a window containing a >> single NSBrowser. >> >> I have set the NSBrowser as the window's initialFirstResponder... but for >> some reason when the window is displayed the NSBrowser does not receive >> keyboard focus and will not receive keyboard focus until I click on it. >> >> I'm hoping I'm missing something trivially easy. Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBrowser and tab order
Aj -- I believe this was a bug fixed in 10.6; maybe 10.5. What OS are you on? The work around is to set it up in awakeFromNib. corbin On Mar 18, 2010, at 1:15 AM, Andrew James wrote: > I have a nib file set up in Interface Builder with a window containing a > single NSBrowser. > > I have set the NSBrowser as the window's initialFirstResponder... but for > some reason when the window is displayed the NSBrowser does not receive > keyboard focus and will not receive keyboard focus until I click on it. > > I'm hoping I'm missing something trivially easy. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
NSBrowser and tab order
I have a nib file set up in Interface Builder with a window containing a single NSBrowser. I have set the NSBrowser as the window's initialFirstResponder... but for some reason when the window is displayed the NSBrowser does not receive keyboard focus and will not receive keyboard focus until I click on it. I'm hoping I'm missing something trivially easy. Cheers, --aj ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Class instance defaults: e.g. NSBrowser
On Mar 17, 2010, at 4:11 PM, Andrew James wrote: > I am a relative newbie to Cocoa so I trying to make sure that my code > reflects Cocoa's coding culture. > > I'm interested in whether or not instances of Cocoa classes can be expected > to display default behavior. I'll use NSBrowser's - > (BOOL)sendsActionOnArrowKeys as an example. In Apple's documentation there's > no mention of the default. > > For my purposes, I want to make sure from release to release that my > NSBrowser instance does send an action when up/down keys are used. Does that > mean as a Cocoa developer I'm content to always code [ myBrowser > setSendsActionOnArrowKeys: YES ] ? or Make sure the appropriate box is > checked in Interface Builder? There is no hard and fast rule that I know of--that is Cocoa-specific. I would assert that as a general rule if you rely on a behavior, then you should always explicitly set it. It disambiguates your code and is future proof in case Apple decides to change the documented default. You may also want to file a bug against the doc. HTH, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Class instance defaults: e.g. NSBrowser
I am a relative newbie to Cocoa so I trying to make sure that my code reflects Cocoa's coding culture. I'm interested in whether or not instances of Cocoa classes can be expected to display default behavior. I'll use NSBrowser's - (BOOL)sendsActionOnArrowKeys as an example. In Apple's documentation there's no mention of the default. For my purposes, I want to make sure from release to release that my NSBrowser instance does send an action when up/down keys are used. Does that mean as a Cocoa developer I'm content to always code [ myBrowser setSendsActionOnArrowKeys: YES ] ? or Make sure the appropriate box is checked in Interface Builder? Cheers, --aj ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
NSBrowser + Core Data Woes
I'm manually populating an in-memory CD store with a hierarchy of objects and binding them to a NSBrowser via a NSTreeController. Everything displays fine, but now I'm trying to get at the underlying managed object; I use a custom NSBrowserCell that has a checkbox next to the name, and the MO has a state attribute that corresponds to it. I've implemented - (void) browser:(NSBrowser *)sender willDisplayCell:(CleanupBrowserCell *)cell atRow:(NSInteger)row column:(NSInteger)column; in my delegate. I have a fetch request in my CD model to get the objects for a given path. However, [sender path] is never found - I'm not sure, but it looks like that's UTF-16 internally, but the MO stores its path as UTF-8 and there's never a match. I've also tried using the various selection methods in the NSTreeController, but they don't seem to return anything useful. Once populated, I won't be doing any modifications to the tree of objects. It's just for choosing a number of objects on which to do further work. Any pointers would be appreciated. Thanks. Karl Moskowski Voodoo Ergonomics Inc. <http://voodooergonomics.com/> 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 arch...@mail-archive.com
Re: NSBrowser Question
Thanks for your response. That's exactly what I was doing but your response made me take another look (I was working on this all day yesterday). It seems I was reloading the column before the wrapper was completely saved (even though I thought I was)! When I put the reload code in a button and clicked it after the save it works fine. Ugh - if I did this yesterday I would have saved hours of frustration! On Feb 14, 2010, at 9:19 PM, Keary Suska wrote: > On Feb 14, 2010, at 3:53 PM, Brad Stone wrote: > >> I have an app that saves it's documents in a fileWrapper. The document's >> window has a NSBrowser where users can attach files. Before the document is >> saved for the first time the NSBrower's root is a temporary attachments >> folder (because the filewrapper doesn't exist). After it's saved that >> attachment folder is moved into the wrapper. When I save the file for the >> first time, even though I set the root item to the attachment folder in the >> wrapper, the Browser can't find the attachments (the items are still looking >> in the temp folder). If I close and reopen the document it works fine. >> >> What do I have to do to tell the NSBrowser that the root item has been >> changed and that the items are now in the attachment folder in the wrapper? > > Did you call reloadColumn: after the change? > > 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/cocoa-dev%40softraph.com > > This email sent to cocoa-...@softraph.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: NSBrowser Question
On Feb 14, 2010, at 3:53 PM, Brad Stone wrote: > I have an app that saves it's documents in a fileWrapper. The document's > window has a NSBrowser where users can attach files. Before the document is > saved for the first time the NSBrower's root is a temporary attachments > folder (because the filewrapper doesn't exist). After it's saved that > attachment folder is moved into the wrapper. When I save the file for the > first time, even though I set the root item to the attachment folder in the > wrapper, the Browser can't find the attachments (the items are still looking > in the temp folder). If I close and reopen the document it works fine. > > What do I have to do to tell the NSBrowser that the root item has been > changed and that the items are now in the attachment folder in the wrapper? Did you call reloadColumn: after the change? Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSBrowser Question
I have an app that saves it's documents in a fileWrapper. The document's window has a NSBrowser where users can attach files. Before the document is saved for the first time the NSBrower's root is a temporary attachments folder (because the filewrapper doesn't exist). After it's saved that attachment folder is moved into the wrapper. When I save the file for the first time, even though I set the root item to the attachment folder in the wrapper, the Browser can't find the attachments (the items are still looking in the temp folder). If I close and reopen the document it works fine. What do I have to do to tell the NSBrowser that the root item has been changed and that the items are now in the attachment folder in the wrapper? Thanks___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Confused about setting selection in NSBrowser
Yes, I'm doing 10.6. But I don't see anything about "item based" in NSBrowser.h, nor anything else that looks enlightening. From: Corbin Dunn To: Keary Suska Cc: Chris Idou ; cocoa-dev@lists.apple.com Sent: Sat, 16 January, 2010 3:17:00 AM Subject: Re: Confused about setting selection in NSBrowser On Jan 15, 2010, at 8:07 AM, Keary Suska wrote: > On Jan 14, 2010, at 9:56 PM, Chris Idou wrote: > >> I'm trying to set the selected item in an NSBrowser. >> >> I don't want to use setPath: because the items I'm storing in the browser >> are not unique, so therefore paths are not unique. >> >> I'm trying to use setIndexPath: but when I try the program throws an >> exception: >> >> HIToolbox: ignoring exception 'setSelectionIndexPath: is not supported for >> browsers with matrix delegates.' that raised inside Carbon event dispatch >> ( >> 0 CoreFoundation 0x7fff80322444 >> __exceptionPreprocess + 180 >> 1 libobjc.A.dylib 0x7fff8055d0f3 >> objc_exception_throw + 45 >> 2 AppKit 0x7fff8378e252 -[NSBrowser >> setSelectionIndexPath:] + 128 >> >> I don't understand what this exception means. > > Are you building against 10.6 SDK? Chris must be, otherwise he would have warnings. Chris -- read up about the "item based" browser in the NSBrowser.h header. corbin __ See what's on at the movies in your area. Find out now: http://au.movies.yahoo.com/session-times/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Confused about setting selection in NSBrowser
On Jan 15, 2010, at 8:07 AM, Keary Suska wrote: > On Jan 14, 2010, at 9:56 PM, Chris Idou wrote: > >> I'm trying to set the selected item in an NSBrowser. >> >> I don't want to use setPath: because the items I'm storing in the browser >> are not unique, so therefore paths are not unique. >> >> I'm trying to use setIndexPath: but when I try the program throws an >> exception: >> >> HIToolbox: ignoring exception 'setSelectionIndexPath: is not supported for >> browsers with matrix delegates.' that raised inside Carbon event dispatch >> ( >> 0 CoreFoundation 0x7fff80322444 >> __exceptionPreprocess + 180 >> 1 libobjc.A.dylib 0x7fff8055d0f3 >> objc_exception_throw + 45 >> 2 AppKit 0x7fff8378e252 -[NSBrowser >> setSelectionIndexPath:] + 128 >> >> I don't understand what this exception means. > > Are you building against 10.6 SDK? Chris must be, otherwise he would have warnings. Chris -- read up about the "item based" browser in the NSBrowser.h header. corbin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Confused about setting selection in NSBrowser
On Jan 14, 2010, at 9:56 PM, Chris Idou wrote: > I'm trying to set the selected item in an NSBrowser. > > I don't want to use setPath: because the items I'm storing in the browser are > not unique, so therefore paths are not unique. > > I'm trying to use setIndexPath: but when I try the program throws an > exception: > > HIToolbox: ignoring exception 'setSelectionIndexPath: is not supported for > browsers with matrix delegates.' that raised inside Carbon event dispatch > ( > 0 CoreFoundation 0x7fff80322444 > __exceptionPreprocess + 180 > 1 libobjc.A.dylib 0x7fff8055d0f3 > objc_exception_throw + 45 > 2 AppKit 0x7fff8378e252 -[NSBrowser > setSelectionIndexPath:] + 128 > > I don't understand what this exception means. Are you building against 10.6 SDK? Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Confused about setting selection in NSBrowser
I'm trying to set the selected item in an NSBrowser. I don't want to use setPath: because the items I'm storing in the browser are not unique, so therefore paths are not unique. I'm trying to use setIndexPath: but when I try the program throws an exception: HIToolbox: ignoring exception 'setSelectionIndexPath: is not supported for browsers with matrix delegates.' that raised inside Carbon event dispatch ( 0 CoreFoundation 0x7fff80322444 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x7fff8055d0f3 objc_exception_throw + 45 2 AppKit 0x7fff8378e252 -[NSBrowser setSelectionIndexPath:] + 128 I don't understand what this exception means. __ See what's on at the movies in your area. Find out now: http://au.movies.yahoo.com/session-times/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Optimizing Enormous lists in NSBrowser
On 21 Sep 2009, at 17:27, Jens Alfke wrote: (In practice, the HFS+ filesystem does return filenames in alphabetical order, although I think it's just sorted by Unicode codepoint, It's a little more complicated in practice; case-insensitive HFS+ sorts by means of a case-insensitive comparison that's defined in the spec. Case-sensitive HFS+ sorts by UTF-16 code unit. However, you can't rely on this behaviour, since as you rightly point out, other filesystems may return filenames in any order. And, of course, case-sensitive HFS+ sorts differently from case-insensitive. Kind regards, Alastair. -- http://alastairs-place.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Optimizing Enormous lists in NSBrowser
On Sep 21, 2009, at 8:28 AM, Graham Cox wrote: Ideally if the list can't display more than, say 50 files at a time (depends on how big your screen is, etc), then it shouldn't touch more than 50 files on disk. It has never really managed that however, and maybe there are fundamental limitations in the file system that prevent it optimising to that extent. The biggest problem is sorting, I think. The Unix filesystem APIs don't define any ordering for the items in a directory, so you have to assume items will be returned in random order. Since your list is presumably sorted, at least by name, that means you can't just read the first 50 items from the directory's catalog and display them. You have to read every entry so you can sort them all. (In practice, the HFS+ filesystem does return filenames in alphabetical order, although I think it's just sorted by Unicode codepoint, which for non-ascii characters isn't going to be the correct localized sort order. And you still have to be able to handle other filesystems as found on memory cards and file servers...) —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 arch...@mail-archive.com
Re: Optimizing Enormous lists in NSBrowser
Hi, I don't know how helpful to you this could be, but you might want to take a look at: http://developer.apple.com/mac/library/documentation/Performance/Conceptual/ FileSystem/FileSystem.html#//apple_ref/doc/uid/1161 You might be able to salvage something from the samples there. JFD On 9/17/09 5:32 PM, "Dave DeLong" wrote: > Hi everyone, > > I'm recreating a Finder-like column view fro browsing the disk, and > I've come up against some optimization impasses. > > First off, I'm using passive-loading, so that I only load information > regarding an item once I get the browser:willDisplayCell: message. > This works wonderfully for lazy loading. > > My problem lies before that. I'm trying to mimic the Finder, so I > want to not show hidden files if they're not visible in Finder. When > I obtain a directory listing via NSFileManager, it includes everything > (including hidden files). Once I get that listing, I filter it based > with an "isFileVisible = YES" predicate, which calls an -[NSString > isFileVisible] method I've implemented in a category. This method > checks the three standard ways of hiding a file to determine its > visibility (prefixed with ".", a flipped invisible bit, or listing it > in /.hidden [which is deprecated, but I need to support older systems]). > > Once I've filtered the array, I sort it using a custom > "compareLikeFinder:" method, which sorts items into the same order as > they appear in Finder. > > For normal-sized directories, this works pretty well. However, in my > "worst-case" scenario of a flat directory containing 1 million files, > I've found that it takes 34.8 seconds to retrieve a full directory > listing (so I know how many to return in > browser:numberOfRowsInColumn:), 301.5 seconds to filter the array, and > another 73.6 seconds to sort it. > > Believe it or not, this is actually better than the current > implementation, but I'd like to do even better. On that note, here > are my questions: > > 1. How can I obtain a count of files in a directory without > retrieving the actual listing of contents? (I can scan through the > folder and count by just grabbing catalog infos myself, but is there a > faster way?) > 2. How can I retrieve the name of the nth item in a directory without > retrieving the actual listing of contents? > > Thanks! > > Dave DeLong > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/jean-francois.dontigny%40radi > alpoint.com > > This email sent to jean-francois.donti...@radialpoint.com > > > *** > > This e-mail and its attachments are confidential, legally privileged, may be > subject to copyright and sent solely for the attention of the addressee(s). > Any unauthorized use or disclosure is prohibited. Statements and opinions > expressed in this e-mail may not represent those of Radialpoint. > > Le contenu de ce courriel est confidentiel, privil�gi� et peut �tre soumis � > des droits d'auteur. Il est envoy� � l'intention exclusive de son ou de ses > destinataires. Il est interdit de l'utiliser ou de le divulguer sans > autorisation. Les opinions exprim�es dans le pr�sent courriel peuvent diverger > de celles de Radialpoint. *** This e-mail and its attachments are confidential, legally privileged, may be subject to copyright and sent solely for the attention of the addressee(s). Any unauthorized use or disclosure is prohibited. Statements and opinions expressed in this e-mail may not represent those of Radialpoint. Le contenu de ce courriel est confidentiel, privil�gi� et peut �tre soumis � des droits d'auteur. Il est envoy� � l'intention exclusive de son ou de ses destinataires. Il est interdit de l'utiliser ou de le divulguer sans autorisation. Les opinions exprim�es dans le pr�sent courriel peuvent diverger de celles de Radialpoint. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Optimizing Enormous lists in NSBrowser
On 22/09/2009, at 1:20 AM, Dave DeLong wrote: Simple tests show that Finder can handle a folder of a million files in about 2-3 minutes That's still effectively unusable. Ideally if the list can't display more than, say 50 files at a time (depends on how big your screen is, etc), then it shouldn't touch more than 50 files on disk. It has never really managed that however, and maybe there are fundamental limitations in the file system that prevent it optimising to that extent. As a user I'd never put more than 1000 files in a folder if I can help it, and that's well up from what you could practically achieve on Mac OS 9-. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Optimizing Enormous lists in NSBrowser
That's a great question. Simple tests show that Finder can handle a folder of a million files in about 2-3 minutes (more than twice as fast as what I described in my original email). Dave On Sep 21, 2009, at 9:01 AM, Scott Ribe wrote: For normal-sized directories, this works pretty well. However, in my "worst-case" scenario of a flat directory containing 1 million files... Depending on what your purpose here is, you might also benchmark how the Finder handles increasingly large directories, and set that as the bar to match or beat somewhat. In other words, if a directory is so large that it's impractical to use in the Finder, do you really need to be fast at that size? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Optimizing Enormous lists in NSBrowser
> For normal-sized directories, this works pretty well. However, in > my "worst-case" scenario of a flat directory containing 1 million > files... Depending on what your purpose here is, you might also benchmark how the Finder handles increasingly large directories, and set that as the bar to match or beat somewhat. In other words, if a directory is so large that it's impractical to use in the Finder, do you really need to be fast at that size? -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Optimizing Enormous lists in NSBrowser
On Sep 17, 2009, at 2:32 PM, Dave DeLong wrote: For normal-sized directories, this works pretty well. However, in my "worst-case" scenario of a flat directory containing 1 million files, I've found that it takes 34.8 seconds to retrieve a full directory listing (so I know how many to return in browser:numberOfRowsInColumn:), 301.5 seconds to filter the array, and another 73.6 seconds to sort it. Have you sampled/profiled it, so you know exactly what operations are slow? (My hunch is that, at that scale, high-level Cocoa conveniences like predicates and NSFileManager are going to add a lot of overhead.) If you want have fast operations for huge directories, you'll need to use lower-level calls, unfortunately. The most efficient call for your purposes is probably getdirentriesattr. There's a good description of it, with sample code, in "Advanced Mac OS X Programming" (Dalrymple & Hillegass.) —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 arch...@mail-archive.com
Optimizing Enormous lists in NSBrowser
Hi everyone, I'm recreating a Finder-like column view fro browsing the disk, and I've come up against some optimization impasses. First off, I'm using passive-loading, so that I only load information regarding an item once I get the browser:willDisplayCell: message. This works wonderfully for lazy loading. My problem lies before that. I'm trying to mimic the Finder, so I want to not show hidden files if they're not visible in Finder. When I obtain a directory listing via NSFileManager, it includes everything (including hidden files). Once I get that listing, I filter it based with an "isFileVisible = YES" predicate, which calls an -[NSString isFileVisible] method I've implemented in a category. This method checks the three standard ways of hiding a file to determine its visibility (prefixed with ".", a flipped invisible bit, or listing it in /.hidden [which is deprecated, but I need to support older systems]). Once I've filtered the array, I sort it using a custom "compareLikeFinder:" method, which sorts items into the same order as they appear in Finder. For normal-sized directories, this works pretty well. However, in my "worst-case" scenario of a flat directory containing 1 million files, I've found that it takes 34.8 seconds to retrieve a full directory listing (so I know how many to return in browser:numberOfRowsInColumn:), 301.5 seconds to filter the array, and another 73.6 seconds to sort it. Believe it or not, this is actually better than the current implementation, but I'd like to do even better. On that note, here are my questions: 1. How can I obtain a count of files in a directory without retrieving the actual listing of contents? (I can scan through the folder and count by just grabbing catalog infos myself, but is there a faster way?) 2. How can I retrieve the name of the nth item in a directory without retrieving the actual listing of contents? Thanks! Dave DeLong ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
NSBrowser & Core Data?
Hello, I am writing a program that needs to load hierarchical data from an XML document (that I have loaded into a NSXMLDocument), into a NSBrowser... I tried modifying the SimpleBrowser? example code to suit my needs, but then I started wondering if Core Data would be able to do it... I looked up some information about NSTreeController, but I'm still confused as to how it would actually work. Any suggestions as to how to approach this problem would be greatly appreciated. Thanks, Keita ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Context Menu in NSBrowser
> All NSViews show, when control-clicked, their context menu. > But not the NSView subclass NSBrowser. > > Is this a documented feature or a bug? This is a bug in the Leopard and earlier versions of AppKit. For now, you can loop through the matrices using -matrixForColumn: and set their menus individually. You’ll also need to set the menu of their superviews, the clip views which enclose the matrices, if you wish to support context menus in the areas without row content. -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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Context Menu in NSBrowser
All NSViews show, when control-clicked, their context menu. But not the NSView subclass NSBrowser. Is this a documented feature or a bug? And what is the recommended workaround? Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: intercepting NSBrowser multiple selection extension with shift down/up arrow
On Tue, Oct 14, 2008 at 2:04 PM, Andy Lee <[EMAIL PROTECTED]> wrote: > On Oct 14, 2008, at 8:11 AM, Martin Redington wrote: >> >> On Tue, Oct 14, 2008 at 8:12 AM, Andy Lee <[EMAIL PROTECTED]> wrote: >>> >>> If it helps with the ick factor, I >>> would say that it's much less hacky to take advantage of one method's >>> documented purpose -- "do something when the selection changes, even if >>> it's >>> via keyboard" -- than to do trivial overrides of multiple methods that >>> you >>> select by trial and error. >> >> Fair comment, although the documentation for setSendsActionOnArrowKeys >> doesn't really state that explicitly - it probably wouldn't have >> occurred to me to try that for a long time. > > Yeah, I was stretching for the interpretation my conscience would be most > comfortable with :). I think it's worth filing a Radar requesting > notifications analogous to NSTableViewSelectionIsChangingNotification and > NSTableViewSelectionDidChangeNotification. rdar://6290957 > I did a quick search for a third-party alternative to NSBrowser, along the > lines of what Rainer Brockerhoff did with RBSplitView. I thought maybe > there would be something at Cocoatech > <http://www.cocoatech.com/opensource.php>. But I haven't found anything. Koders seems to have some NSBrowser code in its index, which might have something relevant, but I didn't look too closely. http://www.koders.com/default.aspx?s=NSBRowser&btn=&la=ObjectiveC&li=* > > --Andy > -- http://www.mildmanneredindustries.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: NSBrowser, NSTreeController and Core Data
On Oct 13, 2008, at 15:44, Quincey Morris wrote: > Your relationship is from categories to subcategories (and inversely > from categories to parent categories). So calling the relationship > "id" makes no sense. IAC, to-many relationship names make more sense > if they're plural ("categories" instead of "id", and "parentCategory" > instead of "parentID"). But I'm going to need to know the id of the category the user ultimately selects. And, I'm reading it as one parentID to-many ids. > If 'childNode' is of a Cocoa class like NSXMLNode, [childNode > stringValue] is going to return the same value each time, which > doesn't look like what you want. If you're trying to get to various > XML nodes or attributes, you're going to have to do it a different > way. (Or perhaps you've invented a class that returns different > results each time.) This all suggests that you believe that the > relationships are implemented by matching of (string) names. They're > not. Relationships are object references. Core Data is an object > graph, not a database. I'm sorry. I should have included the other code. I realize that relationships are object references. I am handling it in a different way. I'm looping through the nodes. Also, what I had as "childNode", is actually "categoryChildNode". // Get an enumerator that contains all the children of this one category listed in the XML NSEnumerator *categoryChildEnumerator = [[categoryNode children] objectEnumerator]; NSXMLNode *categoryChildNode = nil; while (categoryChildNode = [categoryChildEnumerator nextObject]) { NSString *categoryChildName = [categoryChildNode name]; if ([categoryChildName isEqualToString:@"CategoryName"]) { [category setValue:[categoryChildNode stringValue] forKey:@"name"]; } else if ([categoryChildName isEqualToString:@"CategoryID"]) { [category setValue:[childNode stringValue] forKey:@"id"]; } else if ([categoryChildName isEqualToString:@"CategoryParentID"]) { [category setValue:[childNode stringValue] forKey:@"parentID"]; } ... and so on } All this works fine with core data and an NSTextView. > When you create a category object, it's going to have no subcategories > yet, so there's nothing to set for that relationship immediately. If > it has a parent, you need to find the parent object (possibly via the > name of the parent object, which is another subject), and set that > object for the parent relationship. (The inverse will get set > automatically.) > The to-many relationship is a NSSet, so if you ever need to add or > remove subcategories from an object directly, you would use NSSet > accessors. You won't use [setValue:forKey:] for that. Given the error I received, I guess this is really my main question then. How do I do this? Do I need to create a custom managed object class? Regards, Mark. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: intercepting NSBrowser multiple selection extension with shift down/up arrow
On Oct 14, 2008, at 8:11 AM, Martin Redington wrote: On Tue, Oct 14, 2008 at 8:12 AM, Andy Lee <[EMAIL PROTECTED]> wrote: If it helps with the ick factor, I would say that it's much less hacky to take advantage of one method's documented purpose -- "do something when the selection changes, even if it's via keyboard" -- than to do trivial overrides of multiple methods that you select by trial and error. Fair comment, although the documentation for setSendsActionOnArrowKeys doesn't really state that explicitly - it probably wouldn't have occurred to me to try that for a long time. Yeah, I was stretching for the interpretation my conscience would be most comfortable with :). I think it's worth filing a Radar requesting notifications analogous to NSTableViewSelectionIsChangingNotification and NSTableViewSelectionDidChangeNotification. I did a quick search for a third-party alternative to NSBrowser, along the lines of what Rainer Brockerhoff did with RBSplitView. I thought maybe there would be something at Cocoatech <http://www.cocoatech.com/opensource.php >. But I haven't found anything. --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: intercepting NSBrowser multiple selection extension with shift down/up arrow
On Tue, Oct 14, 2008 at 8:12 AM, Andy Lee <[EMAIL PROTECTED]> wrote: > On Oct 14, 2008, at 12:45 AM, Martin Redington wrote: >> >> On Tue, Oct 14, 2008 at 5:25 AM, Andy Lee <[EMAIL PROTECTED]> wrote: >>> >>> How about if you leave the matrix class alone and do [myBrowser >>> setSendsActionOnArrowKeys:YES]? Then give the browser a target and >>> action, >>> and in the action method do whatever you have to do. >> >> That sounds promising, although a bit disappointing and possibly still >> a tiny bit hacky. > > It works for me. Me too :-) with a couple of exceptions ... see below ... > I did a quick test and it caught all the cases I tried, > though I may have missed something. I managed to remove all of my other notification posts, apart from selectAll: I also found that when modifying the selection programmatically, I needed to post the notification manually, so a more general mechanism than I require would need to post from at least a subset of the selectXXX: methods. > If it helps with the ick factor, I > would say that it's much less hacky to take advantage of one method's > documented purpose -- "do something when the selection changes, even if it's > via keyboard" -- than to do trivial overrides of multiple methods that you > select by trial and error. Fair comment, although the documentation for setSendsActionOnArrowKeys doesn't really state that explicitly - it probably wouldn't have occurred to me to try that for a long time. >> Surely it shouldn't really be that hard to capture/intercept selection >> changes - to have to resort to trial and error over-riding of >> selectXXX, et al. methods is a bit irksome. > > I agree, it seems a weird omission, given that with NSTableView you have a > choice of using either a delegate method or a notification for that very > purpose. > > --Andy > -- http://www.mildmanneredindustries.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: intercepting NSBrowser multiple selection extension with shift down/up arrow
On Oct 14, 2008, at 12:45 AM, Martin Redington wrote: On Tue, Oct 14, 2008 at 5:25 AM, Andy Lee <[EMAIL PROTECTED]> wrote: How about if you leave the matrix class alone and do [myBrowser setSendsActionOnArrowKeys:YES]? Then give the browser a target and action, and in the action method do whatever you have to do. That sounds promising, although a bit disappointing and possibly still a tiny bit hacky. It works for me. I did a quick test and it caught all the cases I tried, though I may have missed something. If it helps with the ick factor, I would say that it's much less hacky to take advantage of one method's documented purpose -- "do something when the selection changes, even if it's via keyboard" -- than to do trivial overrides of multiple methods that you select by trial and error. The only possible issue I found with this approach is that it also catches at least one case where the selection *isn't* changing: if you have just one cell selected and you click it, the action method will be called even though the selection hasn't changed. That should be easy to work around if it causes a problem. Surely it shouldn't really be that hard to capture/intercept selection changes - to have to resort to trial and error over-riding of selectXXX, et al. methods is a bit irksome. I agree, it seems a weird omission, given that with NSTableView you have a choice of using either a delegate method or a notification for that very purpose. --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: intercepting NSBrowser multiple selection extension with shift down/up arrow
On Tue, Oct 14, 2008 at 5:25 AM, Andy Lee <[EMAIL PROTECTED]> wrote: > On Oct 13, 2008, at 11:16 PM, Martin Redington wrote: >> >> I've got an NSBrowser, and a secondary view whose value depends on the >> current selection in the NSBrowser. > > [...] >> >> I seem to be capturing everything so far, except for the case where >> the selection is extended by holding down shift and the up or down >> arrow key. > > It sounds like you're subclassing NSMatrix and using -setMatrixClass: on the > browser? Yep. Sorry, I should have made that clearer. I have a custom NSMatrix class. It was more by trial and error than anything else that I ended up over-riding the NSMatrix methods - they were just the ones that seemed to work. > You might be able to get it to work by also overriding > -highlightCell:atRow:column:, but this seems like a lot of work. That sounds nasty. I really just want to post this notification whenever the selection changes. > How about if you leave the matrix class alone and do [myBrowser > setSendsActionOnArrowKeys:YES]? Then give the browser a target and action, > and in the action method do whatever you have to do. That sounds promising, although a bit disappointing and possibly still a tiny bit hacky. Surely it shouldn't really be that hard to capture/intercept selection changes - to have to resort to trial and error over-riding of selectXXX, et al. methods is a bit irksome. I'd kind of hoped that I'd simply missed some method that I could over-ride to cover my broken cases. > I would think there's an even simpler solution using bindings, but I don't > know bindings so I can't help you there. I'm not using bindings in this context, although if anyone does know it might be of interest for the record. cheers, m. > > --Andy > > > > -- http://www.mildmanneredindustries.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: intercepting NSBrowser multiple selection extension with shift down/up arrow
On Oct 13, 2008, at 11:16 PM, Martin Redington wrote: I've got an NSBrowser, and a secondary view whose value depends on the current selection in the NSBrowser. [...] I seem to be capturing everything so far, except for the case where the selection is extended by holding down shift and the up or down arrow key. It sounds like you're subclassing NSMatrix and using -setMatrixClass: on the browser? You might be able to get it to work by also overriding -highlightCell:atRow:column:, but this seems like a lot of work. How about if you leave the matrix class alone and do [myBrowser setSendsActionOnArrowKeys:YES]? Then give the browser a target and action, and in the action method do whatever you have to do. I would think there's an even simpler solution using bindings, but I don't know bindings so I can't help you there. --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]
intercepting NSBrowser multiple selection extension with shift down/up arrow
I've got an NSBrowser, and a secondary view whose value depends on the current selection in the NSBrowser. When only one item is selected, the secondary view shows the path of the selected item. When multiple items are selected, the secondary view should show nothing. I've set up a notification, that gets posted (currently) from -[NSMatrix selectCellAtRow:column:] -[NSMatrix mouseDown:] -[NSMatrix selectAll:] The observer for the notification updates the secondary view. I seem to be capturing everything so far, except for the case where the selection is extended by holding down shift and the up or down arrow key. Can anyone point me to a suitable method to hopefully overide as follows: - (void) someMethod:(id)someArg { [super someMethod:someArg]; NSBrowser *browser = [self someMethodThatReturnsTheBrowser]; [[NSNotificationCenter defaultCenter] postNotificationName:kMyBrowserSelectionWillChangeNotification object:browser]; } I've tried -[NSMatrix setSelectionFrom:to:anchor:highlight:] and most of the other likely candidates, but they didn't seem to work. cheers, Martin -- http://www.mildmanneredindustries.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: NSBrowser, NSTreeController and Core Data
On Oct 13, 2008, at 08:58, Mark Scardigno wrote: My main goal here is to have core data application that implements an NSBrowser view; You've got a number of conceptual problems here, complicated by the fact that Core Data is not a good place to start if you have no experience with fundamental Cocoa technologies. But anyway ... this being a hierarchic view of entities which I call categories, such as... Category -> SubCategories -> SubCategories , etc. The sub categories selected should be based on the previous columns selected category, obviously. After googling up a previous post here, I followed along and set up an entity. I have an entity defined, called Category which has: + Attribute: "name" Type: (String) + Relationship: parentID Destination: "Category" + Relationship: id Destination: "Category" To-Many Relationship Inverse: parentID Your relationship is from categories to subcategories (and inversely from categories to parent categories). So calling the relationship "id" makes no sense. IAC, to-many relationship names make more sense if they're plural ("categories" instead of "id", and "parentCategory" instead of "parentID"). My MainMenu.nib is as follows: + NSTreeController Attributes Mode: Entity Entity Name: "Category" Child Key Path: "id" Binding Parameters managedObjectContext Bind To: MyApplication_AppDelegate Model Key Path: managedObjectContext + NSBrowser Bindings Browser Content content Bind To: NSTreeController Controller Key: arrangedObjects Model Key Path: Leave Blank contentValues Bind To: NSTreeController Controller Key: arrangedObjects Model Key Path: "name" selectionIndexPaths Bind To: NSTreeController Controller Key: selectionIndexPaths Model Key Path: Leave Blank After I do some parsing of XML, I am programmatically creating my category entities and supplying core data with the values for my keys... NSManagedObject *category = [NSEntityDescription insertNewObjectForEntityForName:@"Category" inManagedObjectContext: [self managedObjectContext]]; .. [category setValue:[childNode stringValue] forKey:@"name"]; [category setValue:[childNode stringValue] forKey:@"id"]; [category setValue:[childNode stringValue] forKey:@"parentID"]; If 'childNode' is of a Cocoa class like NSXMLNode, [childNode stringValue] is going to return the same value each time, which doesn't look like what you want. If you're trying to get to various XML nodes or attributes, you're going to have to do it a different way. (Or perhaps you've invented a class that returns different results each time.) This all suggests that you believe that the relationships are implemented by matching of (string) names. They're not. Relationships are object references. Core Data is an object graph, not a database. When you create a category object, it's going to have no subcategories yet, so there's nothing to set for that relationship immediately. If it has a parent, you need to find the parent object (possibly via the name of the parent object, which is another subject), and set that object for the parent relationship. (The inverse will get set automatically.) The to-many relationship is a NSSet, so if you ever need to add or remove subcategories from an object directly, you would use NSSet accessors. You won't use [setValue:forKey:] for that. I realize that I'm passing a string, but according to the error, it wants an NSSet? How do I fix this? I also read something about subclassing NSCell and adding the following methods: - (id)objectValue - (void)setObjectValue:(id)anObject NSCell doesn't figure into this anywhere at all, and you should just forget about it. You *might* subclass NSCell to customize a user interface, but it doesn't have anything to do with your data model, which is what's at issue here. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
NSBrowser, NSTreeController and Core Data
Hi all, Let me start off by saying, I am new to cocoa and objective c programming. Any help is greatly appreciated. The Error: "Unacceptable type of value for to-many relationship: property = "id"; desired type = NSSet; given type = NSCFString; value = 1001." My main goal here is to have core data application that implements an NSBrowser view; this being a hierarchic view of entities which I call categories, such as... Category -> SubCategories -> SubCategories , etc. The sub categories selected should be based on the previous columns selected category, obviously. After googling up a previous post here, I followed along and set up an entity. I have an entity defined, called Category which has: + Attribute: "name" Type: (String) + Relationship: parentID Destination: "Category" + Relationship: id Destination: "Category" To-Many Relationship Inverse: parentID My MainMenu.nib is as follows: + NSTreeController Attributes Mode: Entity Entity Name: "Category" Child Key Path: "id" Binding Parameters managedObjectContext Bind To: MyApplication_AppDelegate Model Key Path: managedObjectContext + NSBrowser Bindings Browser Content content Bind To: NSTreeController Controller Key: arrangedObjects Model Key Path: Leave Blank contentValues Bind To: NSTreeController Controller Key: arrangedObjects Model Key Path: "name" selectionIndexPaths Bind To: NSTreeController Controller Key: selectionIndexPaths Model Key Path: Leave Blank After I do some parsing of XML, I am programmatically creating my category entities and supplying core data with the values for my keys... NSManagedObject *category = [NSEntityDescription insertNewObjectForEntityForName:@"Category" inManagedObjectContext:[self managedObjectContext]]; .. [category setValue:[childNode stringValue] forKey:@"name"]; [category setValue:[childNode stringValue] forKey:@"id"]; [category setValue:[childNode stringValue] forKey:@"parentID"]; I realize that I'm passing a string, but according to the error, it wants an NSSet? How do I fix this? I also read something about subclassing NSCell and adding the following methods: - (id)objectValue - (void)setObjectValue:(id)anObject However, this did not work for me. Regards, Mark. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: -[NSBrowser scrollToVisible] not making all of the column
Hmmm. Looks like no joy on this one then. A bit of a shame, as it looks like this should be quite easy to do (although presumably it's actually not, or else it would have been fixed). Still, at least it's not *too* bad. I'll file a bug as well. If anyone has any pointers to the multiple cells redraw issue mentioned in my other post, that would be fab ... On Thu, Aug 7, 2008 at 7:59 PM, <[EMAIL PROTECTED]> wrote: > Message: 4 > Date: Thu, 07 Aug 2008 12:37:28 -0400 > From: Bill Cheeseman <[EMAIL PROTECTED]> > Subject: Re: -[NSBrowser scrollToVisible] not making all of the column >visible > To: Cocoa-Dev Mail > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="US-ASCII" > > on 2008-08-07 12:06 PM, Martin Redington at > [EMAIL PROTECTED] wrote: > >> [apologies if this is a repost - I sent it a while ago, but didn't see >> it appear on the list or in the archives] > > I guess you didn't see my reply either. > > I reported this as a bug about 4 years ago, but I'm not aware that anything > has been done about it. > > -- > > Bill Cheeseman - [EMAIL PROTECTED] > Quechee Software, Quechee, Vermont, USA > www.quecheesoftware.com > > PreFab Software - www.prefabsoftware.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]
NSBrowser redraw issues with multiple selection
Here's another NSBrowser issue (this is on Leopard, BTW) I'm allowing multiple selection in my NSBrowser. When my NSBrowser loses focus, the multiple selected cells correctly change to have a grey background, but when it regains focus, only the last selected cell gets updated correctly to the active selection colour. If I scroll the browser or switch apps, the selected cells are correctly redrawn. I've tried forcing redrawing by calling setNeedsDisplay on the matrix, or -[NSMatrix drawCellAtRow:column:] for each cell, but this seems to make no difference. Quartz Debug shows that the last selected cell is getting redrawn, but that the other cells never do, as though the Browser never realises that the cells are dirty and need redrawing too. Any suggestions for how to ensure that all of the selected cells redraw would be great ... -- http://www.mildmanneredindustries.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: -[NSBrowser scrollToVisible] not making all of the column visible
on 2008-08-07 12:06 PM, Martin Redington at [EMAIL PROTECTED] wrote: > [apologies if this is a repost - I sent it a while ago, but didn't see > it appear on the list or in the archives] I guess you didn't see my reply either. I reported this as a bug about 4 years ago, but I'm not aware that anything has been done about it. -- Bill Cheeseman - [EMAIL PROTECTED] Quechee Software, Quechee, Vermont, USA www.quecheesoftware.com PreFab Software - www.prefabsoftware.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: -[NSBrowser scrollToVisible] not making all of the column visible
Am Do,07.08.2008 um 18:06 schrieb Martin Redington: [apologies if this is a repost - I sent it a while ago, but didn't see it appear on the list or in the archives] I've got an app with a NSOutlineView and NSBrowser view of the same data (the file system). I preserve the user's selection between when switching between views. A lot of the time, the NSBrowser scrolls to show the entire selected column. However, sometimes, only a portion of the selected column gets shown, even when I call -[NSBrowser scrollColumnToVisible] explicitly. I get the impression that NSBrowser is checking to see whether any of the selected column is visible, and if so, not scrolling at all. What I'd hoped would happen is that it would scroll to show all of the column - it seems that forcing this behaviour programmatically is difficult, as NSBrowser only allows scrolling by column indexes. Is the behaviour I'm seeing (not all column made visible if any is already visible) the expected behaviour? No explanation, no solution, but maybe a specific behaviour of the finder related to browsers may help you to find a work-around: 1. Switch to browser-view in finder and select an item deep inside the file system, so a part of the path is visible: http://www.cocoading.de/webspace/ScrollStart.tiff 2. Than select the partial visible item, which is a part of the path (grey background): Everything is nice, scrolled correctly! http://www.cocoading.de/webspace/ScrollInsidePath.tiff 3. Try steps 1+2 again, but select a partial visible item, which is *not* a part of the path (white background). No Scrolling is applied! http://www.cocoading.de/webspace/ScrollOutsidePath.tiff 4. Even worse: There is no scrolling, when you edit the item: http://www.cocoading.de/webspace/ScrollEdit.tiff Maybe it is a work-around to select a subitem of the selected item and then return to the selected item. Amin -- http://www.mildmanneredindustries.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/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [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]
-[NSBrowser scrollToVisible] not making all of the column visible
[apologies if this is a repost - I sent it a while ago, but didn't see it appear on the list or in the archives] I've got an app with a NSOutlineView and NSBrowser view of the same data (the file system). I preserve the user's selection between when switching between views. A lot of the time, the NSBrowser scrolls to show the entire selected column. However, sometimes, only a portion of the selected column gets shown, even when I call -[NSBrowser scrollColumnToVisible] explicitly. I get the impression that NSBrowser is checking to see whether any of the selected column is visible, and if so, not scrolling at all. What I'd hoped would happen is that it would scroll to show all of the column - it seems that forcing this behaviour programmatically is difficult, as NSBrowser only allows scrolling by column indexes. Is the behaviour I'm seeing (not all column made visible if any is already visible) the expected behaviour? -- http://www.mildmanneredindustries.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: -[NSBrowser scrollToVisible] not making all of the column visible
on 2008-08-02 8:58 PM, Martin Redington at [EMAIL PROTECTED] wrote: > Is the behaviour I'm seeing (not all column made visible if any is > already visible) the expected behaviour? I filed a bug about 4 years ago, but nothing came of it. -- Bill Cheeseman - [EMAIL PROTECTED] Quechee Software, Quechee, Vermont, USA www.quecheesoftware.com PreFab Software - www.prefabsoftware.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]
NSBrowser redraw issues
Here's another NSBrowser issue ... I'm allowing multiple selection in my NSBrowser. When my NSBrowser loses focus, the multiple selected cells correctly change to have a grey background, but when it regains focus, only the last selected cell gets updated correctly to the active selection colour. If I scroll the browser or switch apps, the selected cells are correctly redrawn. I've tried forcing redrawing by calling setNeedsDisplay on the matrix, or -[NSMatrix drawCellAtRow:column:] for each cell, but this seems to make no difference. Quartz Debug shows that the last selected cell is getting redrawn, but that the other cells never do, as though the Browser never realises that the cells are dirty and need redrawing too. Any suggestions for how to ensure that all of the selected cells redraw would be great ... -- http://www.mildmanneredindustries.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]