A Stack of Editors
I just asked a question about the NSStackView, but perhaps I’m looking at the wrong control altogether. What I’m trying to make is a scroll view containing a vertical stack of editors for RTF subdocuments. Each of the text views should size itself to fit the width of the scroll view, but grow vertically as much as necessary to display its full content. The more I think about it, the more I think what I need is a single-column table view within which each cell holds a text editor. But each row, text view, and text container should resize to fit the text held within. How can I achieve that? — Charles Jenkins ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Stack?
Okay, here’s a dumb question… How do you make a stack view actually stack things? When I add subviews into a stack view, instead of appearing one after another as I expect, they’re all laid on top of one another. I created a sample program with one window filled with a scroll view, and inside that a stack view. My Document class just throws in a bunch of subviews (quickies made with NSBox), and no matter what layout alignment I choose, they appear overlaid on one another. Here’s the bit of code that matters: @interface Document () @property (weak) IBOutlet NSStackView* theStack; @property NSArray* heightArray; @end @implementation Document - (instancetype)init { self = [super init]; if (self) { self.heightArray = @[ @50, @70, @25, @90, @25, @150, @50, @200, @30, @75, @25, @90, @150, @300, @80, @50 ]; } return self; } - (void)windowControllerDidLoadNib:(NSWindowController *)aController { [super windowControllerDidLoadNib:aController]; // Add any code here that needs to be executed once the windowController has loaded the document's window. self.theStack.alignment = NSLayoutAttributeBottom; unsigned long count = [self.heightArray count]; for ( unsigned long ix = 0; ix < count; ++ix ) { NSRect rect = CGRectMake(0, 0, 75, [[self.heightArray objectAtIndex: ix] doubleValue] ); NSBox* box = [[NSBox alloc] initWithFrame: rect]; box.fillColor = [NSColor blueColor]; box.borderType = NSLineBorder; box.borderWidth = 20; box.borderColor = [NSColor magentaColor]; box.titlePosition = NSNoTitle; [self.theStack insertView:box atIndex:ix inGravity:NSStackViewGravityCenter]; } } — Charles Jenkins ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: NSTableView with reversed rows?
Op 2 okt 2014, om 23:13 heeft Luc Van Bogaert het volgende geschreven: > That's not exactly what I meant, but it might be part of a solution. > > I want the table to populate 'from the bottom to the top', so that the free > space in the scrollview (if there is any) is at the top, above the top row, > instead of below the bottom table row. > > I hope I have expressed more clear what I 'm looking for. > -- > Luc Van Bogaert Override -[NSScrollView tile], call super and move the document view to the bottom if there is space left? --Willeke ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: NSTableView with reversed rows?
On 3 Oct 2014, at 07:25, Luc Van Bogaert wrote: > Sure, the table will display 'layer' objects that can be stacked onto each > other. So the first layer should be displaced at the bottom of the stack, the > second layer on top of the first, and so on... So in fact, I would like to > have a table that represents a stack of objects that 'grows' upwards. > Another thought. Use an NSStackView (if on 10.9) and add discrete views to the bottom gravity in inverse order. You can embed an NSStackView in a NSScrollView - https://github.com/mugginsoft/TSStackView/blob/master/TSStackView.m#L452 J ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: NSTableView with reversed rows?
On 3 Oct 2014, at 4:25 pm, Luc Van Bogaert wrote: > Sure, the table will display 'layer' objects that can be stacked onto each > other. So the first layer should be displaced at the bottom of the stack, the > second layer on top of the first, and so on... So in fact, I would like to > have a table that represents a stack of objects that 'grows' upwards. All apps I've seen that show layers still start at the top, even if the lowest one represents the bottom (or rear-most) layer. Adding a new layer on top of the stack inserts a row at the top and all the rest move down. Tables are after all only a 'map' of your layers, as if someone had written down a list of them on paper. I've seen a more literal alternative that shows an actual stack of images layered in 3D with the 'current' layer exposed more fully and the remainder more edge-on (hard to describe but easy as a visual metaphor when you see it). Think a sort of vertical version of 'Cover Flow'. --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