Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Download Delegate and Print Button



Josh Ferguson wrote:
I have a WebView window that I need complete control over and I’m having difficulty figuring out delegate methods to handle two situations. First, I need to intercept clicks for downloading files so that I can display my own File Open dialog. Essentially what’s happening right now is that I’ve rolled my own event loop in order to make my webview window modal. When I need to display another window, I simply add that window to my list of windows that can receive events (i.e. with links that open new windows). This must be causing the WebView to swallow the events that cause it to open the File Open dialog for downloads, as I get a Frame Load error when the download link is clicked. I have a feeling I’ll need to create this dialog manually but I can’t find a place to intercept this request. Any recommendations would be greatly appreciated!

Hi Josh,

I don't know about the second one, but I have dealt with file selection from within my WebView. You need to implement the WebUIDelegate method
- (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener



Here's mine, for what it's worth:
- (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener
{
NSOpenPanel *panel = [NSOpenPanel openPanel];
int i = [panel runModalForDirectory:NSHomeDirectory()
file:nil
types:nil];

if (i == NSOKButton)
{
[resultListener chooseFilename:[[panel filenames] objectAtIndex:0]];
}
}


Remember to register as the delegate by sending
[myWebView setUIDelegate:self]
in your window controller.

- Rush
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden

This email sent to email@hidden
References: 
 >Download Delegate and Print Button (From: "Josh Ferguson" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.