subclassing WebView

  • I'm trying to subclass WebView in order to override and handle
    keypress events and not getting very far.

    I have a program that is working fine with a stock WebView class
    object. I can call the loadRequest: method on this WebView object and
    it loads the specified URL, e.g.:

    [[targetDisplayWebView mainFrame] loadRequest:[NSURLRequest
    requestWithURL:[NSURL URLWithString:[targetURL stringValue]]]];

    However, I cannot seem to get a subclassed WebView (custom) object to
    do the same thing. The request does not appear to go through.

    I have connected my Controller's webview outlet to the custom view
    object, which is an instance of CustomView sitting within an
    NSWindow. I have adjusted my Controller.h header file to reflect the
    naming change. All the other calls to this WebView subclass are the
    same.

    Unfortunately the loadRequest: method does not load the requested URL.

    Are there base methods I need to declare within my WebView subclass,
    or delegates which I first need to connect to my Controller?

    The documentation for WebView here:

    http://developer.apple.com/documentation/Cocoa/Reference/WebKit/
    Classes/WebView_Class/Reference/Reference.html

    suggests the delegates are optional.

    I tried looking here for instructions on subclassing WebView, but no
    luck:

    http://www.cocoadev.com/index.pl?WebKit

    Is there anything special I need to do to subclass WebView?

    Thanks in advance for any advice.

    Thanks,
    Alex
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today