nsscrollview

How to maintain the scroll position in NSScrollView when changing scale?

I've got an NSView (myView) wrapped in an NSScrollView (myScrollView). Using zoom-in/out buttons, the user can alter the scale of myView. If the user is currently scrolled to a particular spot in myView, I'd like to keep that part of the view on-screen after the zooming has taken place. I've got code that looks like this: // pres...

NSScrollView Bar not scrolling through NSTableView rows

Hello, I currently have an NSTableView inside an NSScrollView and this gets it's contents from a datasource. However, when the number of contents is larger than the view can hold, using the vertical scroll bar does not affect the contents of the table. Dragging the scroll bar doesn't work Clicking the Up/Down buttons doesn't work Usi...

How do I embed a WebView in an NSScrollView?

So I have a project that has some content being displayed in a WebView and I want to stick above that. I want the header to scroll with the WebView content. Now, WebView generally wants to do it's own scroll handling but you can tell it not to using: [[webView mainFrame] setAllowsScrolling:NO]; which successfully makes the WebView's...

NSScroller graphical glitches/lag

Hi, I have the following NSScroller subclass that creates a scroll bar with a rounded white knob and no arrows/slot (background): @implementation IGScrollerVertical - (void)drawKnob { NSRect knobRect = [self rectForPart:NSScrollerKnob]; NSRect newRect = NSMakeRect(knobRect.origin.x, knobRect.origin.y, knobRect.size.width - 4, ...

How to stop NSScrollView from scrolling to top when horizontally resizing contained NSTextView?

I have a NSTextView that I want to display a horizontal scroll bar. Following some leads on the internet, I have most of it working, except that I am having problems with the vertical scroll bar. What I have done is to find the width of the longest line (in pixels with the given font) and then I resize the NSTextContainer and the NSTex...

Center an NSView within an NSScrollView

How do I center an NSView within an NSScrollView like the way "Preview" does? ...

How to add a button or image to a vertical table header of scrollview ?

I have seen a lot of programs had some buttons or images in the vertical or horizontal scrollview table header or bottom and click it to invloke some events, But I have searched interface builder library and not found some widget I can used , how these programs to implement it ? Thank you very much! ...

How to make NSTableView scroll to most recently added row?

Hi, I'm dynamically adding rows to an NSTableView. When I issue [table reloadData] I can see the scroll view move and if I move it by hand I can see the new value on the table. But how can I scroll it automatically? ...

Scrolling an NSTextView to an exact rect?

Hi, I've got an NSTextView, inside an NSScrollView, and I want to scroll it to exactly where it used to be after repopulated the NSTextView with new data. So far, I've tried variations on the code below, but it never gets it quite right. What I need is a setDocumentVisibleRect method, but there isn't one. NSRect oldVisibleRect = [[[se...

How does the momentum/inertial scroll work with the Magic Mouse on NSScrollView?

When you scroll with the newer Apple Magic Mouse (at least on 10.6, I can't confirm any previous Mac OS) you get inertial scroll like scrolling on iPhone (that is, after a flick of the finger to scroll, it doesn't abruptly stop, but instead gradually slows down). This behaviour is "for free" with all NSScrollViews, it would appear. Ther...

Magic Mouse Momentum Scrolling Not Working

Unfortunately this is hard for me to test myself because I have yet to get a Magic Mouse of my own, but I've been told by my testers who do have a magic mouse that momentum scrolling isn't working in my app. I've not subclassed NSScrollView, but scrollview's document view is all custom. I have not overridden scrollWheel: anywhere, either...

Subclassing NSScroller, how to get rid of the white square in the lower right corner?

I've created an iTunes like subclass of NSScroller, however if both the horizontal and vertical scrollers are visible in an NSScrollView or NSTableView I'm left with an ugly white square in the lower right corner. Anyone has a clue on where to add my custom drawing to fill that in with something prettier? ...

Reduced image size in NSScrollView

I'm trying to load an image into my NSImageView/NSScrollView and display it at actual size, but the image mysteriously ends up getting displayed at about half-size. I thought at first it might be being reduced to fit into some kind of constraints of the frame etc., but soon realised this couldn't be right because if I physically enlarge ...

Calculate position of NSScrollView relative to main image.

Assume I load an NSImage of dimensions 2000x2000 and display only a portion of the picture inside an NSScrollView with frame size 500x300. How can I calculate the distance between the images 0,0 origin and the views 0,0 origin (so I can determine the x,y coordinates of the view relative to the whole image)? Thanks in advance :-) ...

How to resize NSOutlineView column when scroller appears/disappears?

This ought to be very basic but after trying for an hour or so I can't figure out how to do this correctly: I have a NSOutline view with two columns, of which the right one should always be fully visible. The enclosing NSScrollView is set to show a vertical scroller only. Now whenever the vertical scroller appears it covers part of the ...

Zooming in an NSView

Hi, I have an NSView in which the user can draw circles. These circles are stored as an array of NSBezierPaths, and in drawRect:, I loop through the array and call -stroke on each of the paths. How do I add a button to zoom in and out the NSView? Just change the bounds of the view? Thanks. ...

NSScrollView - pattern background - how to start from top-left corner?

To fill NSScrollview with pattern image I use - (void)setBackgroundColor:(NSColor *)aColor method where aColor is created with + (NSColor *)colorWithPatternImage:(NSImage *)image method. Despite of what isFlipped returns for NSScrollView and its content view, pattern start repeat from bottom-left corner while I want it to start from top-...

NSTextView's adjustScroll method

I'm trying to implement typewriter scrolling in my Cocoa text editor, keeping the insertion point centered vertically in its scrollview. Toward this end, I have subclassed NSClipView to provide a scrollToPointWithoutConstraint method, which scrolls the document to a specified point without calling constrainScrollPoint. This is necessary...

How to observe NSScroller changes?

I have an NSScrollView subclass and I would like to update another NSView based on the current scroll position. I tried KVC-observing the value of [self horizontalScroller] but that never gets called. // In awakeFromNib [[self horizontalScroller] addObserver:self forKeyPath:@"value" ...

NSScrollView frame and flipped documentView

Hi, I have problems with NSScrollView, It is not displayed the way I want. Yes I know there is a lot of post about it around the web, I need to override the isFlipped, in order to make it return YES, in my NSView subclass. Ok, it's done, so now, my scrollView scroll from top to bottom, and not in the reverse way, as it was before overr...