Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

spotlite

macrumors newbie
Original poster
Jan 28, 2008
18
0
Hello everyone,

I am using WebView on an application I am developing. A small section of the application is a WebView object. I am having the WebView load a URL, and that is working fine, and as you would expect, it's showing the top-left corner of this website. I want to focus on a very specific area of this website, without having to use scroll bars to move. Very similar to what Web Clip does for Dashboard, but built into my native app. I'm using Xcode + IB + Cocoa.

Is this possible? What would be the best way of doing it? I've looked at the documentation, but have had no luck.

Thank you in advance.
 

spotlite

macrumors newbie
Original poster
Jan 28, 2008
18
0
Put the webview in a NSClipView?

I don't understand how you would use a NSClip to actually have the WebView show something other than the top-left most corner of the website. I want to have the origin be something else on the site, without the need to have scroll bars. If it's possibly to do this by putting it in a NSClip, could you please elaborate on how to do it? Thank you.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
NSClipView does not display scrollbars: that's what an NSScrollView does. NSScrollView uses and embeded NSClipView to clip the whole view for display. This is basically what you want to do.

So I'd:

1) Create an NSClipView (of the size you want)
2) Set the document view to your web view
3) Scroll to point to set the displayed section of the view to what you want.
 

spotlite

macrumors newbie
Original poster
Jan 28, 2008
18
0
NSClipView does not display scrollbars: that's what an NSScrollView does. NSScrollView uses and embeded NSClipView to clip the whole view for display. This is basically what you want to do.

So I'd:

1) Create an NSClipView (of the size you want)
2) Set the document view to your web view
3) Scroll to point to set the displayed section of the view to what you want.

Got it! Thanks or your help.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.