Re: Question on NSScrollView
Hi Quincey, You are right, the code is taken from the link you posted. Actually I understand that group rows were demonstrated in that code. Actually when I remove group code I get desired result. I was trying to include group rows so that in future should I need that feature, I need not revisit the implementation. I tried to make group rows behave as normal. For now I decided to comment out the code that makes it group rows. Thanks for your help. Regards, Varun On 3/05/2014 8:06 am, "Quincey Morris" wrote: >On May 2, 2014, at 14:06 , Lee Ann Rucker wrote: > >> You might find it useful to get one of the Apple sample apps, like >>TableViewPlayground, and experiment with that - it's easier to figure >>out what's happening when you have a fully-implemented example than it >>is to start from scratch. > >FWIW, the code being used by the OP has every appearance of being taken >from this tutorial: > > > https://github.com/lucasderraugh/AppleProg-Cocoa-Tutorials/blob/master/Le >sson%2053/Lesson%2053/AppDelegate.m > >but it seems to me that the class name ŒDesktopFolderEntity¹ suggests an >origin in a predecessor to the current TableViewPlayground, where there¹s >currently a class name ŒATDesktopFolderEntity¹. > >However, now that I look at it, this tutorial seems to be intended to >show how to use group rows, which isn¹t what the OP wants. > >___ > >Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > >Please do not post 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/varun.chandramohan%40won >tok.com > >This email sent to varun.chandramo...@wontok.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Question on NSScrollView
> On 2014/05/03, at 6:06, Lee Ann Rucker wrote: > > You might find it useful to get one of the Apple sample apps, like > TableViewPlayground, and experiment with that - it's easier to figure out > what's happening when you have a fully-implemented example than it is to > start from scratch. This is actually really good advice. I would add that sometimes it helps to look at various apple sample code projects as some of them are trying to demonstrate a lot at once. Also other peoples stuff on github can be good. There are also lots of good tutorials online. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Question on NSScrollView
On May 2, 2014, at 14:06 , Lee Ann Rucker wrote: > You might find it useful to get one of the Apple sample apps, like > TableViewPlayground, and experiment with that - it's easier to figure out > what's happening when you have a fully-implemented example than it is to > start from scratch. FWIW, the code being used by the OP has every appearance of being taken from this tutorial: https://github.com/lucasderraugh/AppleProg-Cocoa-Tutorials/blob/master/Lesson%2053/Lesson%2053/AppDelegate.m but it seems to me that the class name ‘DesktopFolderEntity’ suggests an origin in a predecessor to the current TableViewPlayground, where there’s currently a class name ‘ATDesktopFolderEntity’. However, now that I look at it, this tutorial seems to be intended to show how to use group rows, which isn’t what the OP wants. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Question on NSScrollView
You might find it useful to get one of the Apple sample apps, like TableViewPlayground, and experiment with that - it's easier to figure out what's happening when you have a fully-implemented example than it is to start from scratch. On Apr 29, 2014, at 7:20 PM, Varun Chandramohan wrote: > Hi Guys, > > In my app I have a scrollview that displays a list of file paths which is > populated by NSArrayController. This work well, except that I wanted to add > some fancy functionality to it. I have seen some apps allow dragging a file > from Finder into scroll view to add it. This is a neat functionality without > the need to have buttons to manipulate the list. Can someone tell me if > NSScrollView can be extended to work like that? Any suggestions? > > Regards, > Varun > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post 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://urldefense.proofpoint.com/v1/url?u=https://lists.apple.com/mailman/options/cocoa-dev/lrucker%2540vmware.com&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=yJFJhaNnTZDfFSSz1U9TSNMmxGyib3KjZGuKfIhHLxA%3D%0A&m=NjZdtrRyucgNa%2BbrlJBEeuTXYeDbL%2BjntLURy6o%2Fq8U%3D%0A&s=d417f3f646d25c5be714c401c2d64070fc14ba2e31bbd6d3e1635ada807df19f > > This email sent to lruc...@vmware.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Question on NSScrollView
On May 1, 2014, at 23:03 , Varun Chandramohan wrote: > I ran ‘tableView:viewForTableColumn and it is always tableColumn == nil as I > have just 1 column. No. ‘tableColumn == nil’ means that you’re being asked for a view for a *group row*. A group row: (a) spans all columns (though there’s just a single column to span, in this case), and (b) has a gray background. If you don’t want the gray background, then don’t make any group rows. Group rows are *supposed* to look different from regular rows, and they have other unique behavior, too. (It is *possible* to customize the appearance of group rows, though I’ve never done it. But it is to your users’ advantage if the rows look the same as in other apps.) > I noticed that I never hit anything that is not “GroupCell”. However this > does not solve the grey background right? Presumably, the top level folder that you’re displaying only has subfolders, and no files. Note that if your intention is to display a folder *hierarchy*, you’re going to have some trouble using a NSTableView, which is intended for a flat array. NSOutlineView is better suited to a hierarchy. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Question on NSScrollView
I ran 'tableView:viewForTableColumn and it is always tableColumn == nil as I have just 1 column. I noticed that I never hit anything that is not "GroupCell". However this does not solve the grey background right? Also I tried [ltableView setSelectionHighlightStyle: NSTableViewSelectionHighlightStyleSourceList]; It at least gets me the blue highlight colour. However there is some weird blue background now. http://snag.gy/a1AC3.jpg is how it looks now. Still not a white background. Regards, Varun From: Quincey Morris mailto:quinceymor...@rivergatesoftware.com>> Date: Friday, 2 May 2014 3:12 pm To: Development mailto:varun.chandramo...@wontok.com>> Cc: Cocoa dev mailto:Cocoa-dev@lists.apple.com>> Subject: Re: Question on NSScrollView On May 1, 2014, at 17:25 , Varun Chandramohan mailto:varun.chandramo...@wontok.com>> wrote: Yes I have implemented tableView:isGroupRow. - (BOOL)tableView:(NSTableView *)tableView isGroupRow:(NSInteger)row { DesktopEntity *entity = _tableContents[row]; if ([entity isKindOfClass:[DesktopFolderEntity class]]) { return YES; } return NO; } What is wrong with this? Nothing at all! Rows corresponding to a 'DesktopFolderEntity' are group rows, and all the others are not. Also I implemented - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { DesktopEntity *entity = _tableContents[row]; if ([entity isKindOfClass:[DesktopFolderEntity class]]) { NSTableCellView *groupCell = [tableView makeViewWithIdentifier:@"GroupCell" owner:self]; [groupCell.textField setStringValue:entity.name]; return groupCell; } return nil; } Are you saying I should not return nil here? Well, you are returning nil for rows that aren't 'DesktopFolderEntity', which doesn't seem a good idea, but that isn't the issue you asked about. In this code, you should return a view with identifier "GroupCell" - as you have done - for rows that are 'DesktopFolderEntity'. Since these are indeed group rows, this correctly gives them the group-row appearance (the one with the gray background). That is, your table view is showing exactly what you asked it to show. Your 'tableView:viewForTableColumn:' method is, however, missing some code. You need to return a view for non-group rows (that would probably be a view with identifier 'DataCell', if you have the default setup in IB), and you need to test tableColumn (and possibly tableColumn.identifier). ('tableColumn == nil' means that you're being asked for a group-row view. Otherwise you're being asked for a per-column view.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Question on NSScrollView
On May 1, 2014, at 17:25 , Varun Chandramohan wrote: > Yes I have implemented tableView:isGroupRow. > - (BOOL)tableView:(NSTableView *)tableView isGroupRow:(NSInteger)row { > DesktopEntity *entity = _tableContents[row]; > if ([entity isKindOfClass:[DesktopFolderEntity class]]) { > return YES; > } > return NO; > } > > What is wrong with this? Nothing at all! Rows corresponding to a ‘DesktopFolderEntity’ are group rows, and all the others are not. > Also I implemented > - (NSView *)tableView:(NSTableView *)tableView > viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { > DesktopEntity *entity = _tableContents[row]; > if ([entity isKindOfClass:[DesktopFolderEntity class]]) { > NSTableCellView *groupCell = [tableView > makeViewWithIdentifier:@"GroupCell" owner:self]; > [groupCell.textField setStringValue:entity.name]; > return groupCell; > } > return nil; > } > > Are you saying I should not return nil here? Well, you are returning nil for rows that aren’t ‘DesktopFolderEntity’, which doesn’t seem a good idea, but that isn’t the issue you asked about. In this code, you should return a view with identifier “GroupCell” — as you have done — for rows that are ‘DesktopFolderEntity’. Since these are indeed group rows, this correctly gives them the group-row appearance (the one with the gray background). That is, your table view is showing exactly what you asked it to show. Your ‘tableView:viewForTableColumn:’ method is, however, missing some code. You need to return a view for non-group rows (that would probably be a view with identifier ‘DataCell’, if you have the default setup in IB), and you need to test tableColumn (and possibly tableColumn.identifier). (‘tableColumn == nil’ means that you’re being asked for a group-row view. Otherwise you’re being asked for a per-column view.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Question on NSScrollView
Hi Quincey, Yes I have implemented tableView:isGroupRow. - (BOOL)tableView:(NSTableView *)tableView isGroupRow:(NSInteger)row { DesktopEntity *entity = _tableContents[row]; if ([entity isKindOfClass:[DesktopFolderEntity class]]) { return YES; } return NO; } What is wrong with this? Also I implemented - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { DesktopEntity *entity = _tableContents[row]; if ([entity isKindOfClass:[DesktopFolderEntity class]]) { NSTableCellView *groupCell = [tableView makeViewWithIdentifier:@"GroupCell" owner:self]; [groupCell.textField setStringValue:entity.name]; return groupCell; } return nil; } Are you saying I should not return nil here? Regards, Varun From: Quincey Morris mailto:quinceymor...@rivergatesoftware.com>> Date: Friday, 2 May 2014 9:10 am To: Development mailto:varun.chandramo...@wontok.com>> Cc: Cocoa dev mailto:Cocoa-dev@lists.apple.com>> Subject: Re: Question on NSScrollView On May 1, 2014, at 15:16 , Varun Chandramohan mailto:varun.chandramo...@wontok.com>> wrote: However this is not the case with the same table populated manually using NSPasteboardReading and NSTableViewDataSource, NSTableViewDelegate. I noticed a grey background to all the entries to the table. It looks like you have inadvertently turned all the rows into group rows. There are a couple of ways this might happen, that I can think of offhand. One is (obviously) if you implemented the 'tableView:isGroupRow:' delegate method and returned YES. Otherwise, make sure in methods like 'tableView:objectValue...' and 'tableView:willDisplayCell...' or 'tableView:viewForTableColumn...' that you don't return a non-nil value when the column is nil. (A nil column is how the table view asks the delegate/data source for per-row values that span columns.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Question on NSScrollView
On May 1, 2014, at 15:16 , Varun Chandramohan wrote: > However this is not the case with the same table > populated manually using NSPasteboardReading and NSTableViewDataSource, > NSTableViewDelegate. I noticed a grey background to all the entries to the > table. It looks like you have inadvertently turned all the rows into group rows. There are a couple of ways this might happen, that I can think of offhand. One is (obviously) if you implemented the ‘tableView:isGroupRow:’ delegate method and returned YES. Otherwise, make sure in methods like ‘tableView:objectValue…’ and ‘tableView:willDisplayCell…’ or ‘tableView:viewForTableColumn…’ that you don’t return a non-nil value when the column is nil. (A nil column is how the table view asks the delegate/data source for per-row values that span columns.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Question on NSScrollView
Thanks a lot. I did implement it and everything seems to be working fine. Although I did see one major issue. When I used arrayController on the same table I used get my entries in white background and when clicked on gets highlighted in blue. However this is not the case with the same table populated manually using NSPasteboardReading and NSTableViewDataSource, NSTableViewDelegate. I noticed a grey background to all the entries to the table. This is weird as I did not change any properties in the textField to get this colour. The example of this is http://snag.gy/0m8xi.jpg. Does anyone know why this is happening and how to get rid of this? Regards, Varun On 30/04/2014 12:40 pm, "Graham Cox" wrote: > >On 30 Apr 2014, at 12:20 pm, Varun Chandramohan > wrote: > >> Can someone tell me if NSScrollView can be extended to work like that? >>Any suggestions? > > >You don't want to extend or subclass NSScrollView. Instead just put a >custom view inside it. You can set up drag and drop in any view - check >out the NSDraggingDestination protocol. > >--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: Question on NSScrollView
On 30 Apr 2014, at 12:20 pm, Varun Chandramohan wrote: > Can someone tell me if NSScrollView can be extended to work like that? Any > suggestions? You don't want to extend or subclass NSScrollView. Instead just put a custom view inside it. You can set up drag and drop in any view - check out the NSDraggingDestination protocol. --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: Question on NSScrollView
On 2014 Apr 29, at 19:20, Varun Chandramohan wrote: > In my app I have a scrollview that displays a list of file paths which is > populated by NSArrayController. Understand that what you actually have there is, I presume, a ** NSTableView ** inside of an NSScrollView. Researching how to implement drag and drop with ** NSTableView ** should bring up plenty of results :) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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