• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: off screen drawing with cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: off screen drawing with cocoa


  • Subject: Re: off screen drawing with cocoa
  • From: Half Activist <email@hidden>
  • Date: Tue, 24 Apr 2007 11:08:08 +0200

Adrew Farmer is right, the WebView takes some time to render.
I already did something like what you'd like to do, and I needed to set the frame load delegate of the webview and then get the content of it once I received the
- (void)webView: (WebView *)sender didFinishLoadForFrame: (WebFrame *) frame
message.


Maybe I am wrong, but setting the baseURL to nil might also prevent the data from being loaded into the webview (I already had troubles with it
and usually set the baseURL to something like http://localhost)


I don't know of the internals of the WebKit, but i'd bet it requires a runloop even if the data isn't fetched with an NSURLConnection.

I think You should consider subscribing to the Webkit SDK mailing list and posting your questions there.

Regards.

On Apr 24, 2007, at 10:43 AM, Warwick Hall wrote:


ok, so i create an NSWindow, and set the content view to the WebView.

exception is still thrown, because the defer is YES on the window, so I change that to NO.

then if you look at my previous code, i had a NSGraphicsContext created in the main() function using the NSDictionary attribute approach. Well, another exception is thrown saying invalid graphics context, so i change it to the graphics context for the NSWindow.

Now, when i run it, it runs without exception, a postscript file is created with the size (300.0, 500.0), but it is blank! all that trouble and it comes up blank?!?!?!

please help! here is the modified code snipbit...

--BEGIN--
NSWindow * theWindow =
[[NSWindow alloc] initWithContentRect : NSMakeRect( 0.0, 0.0, 300.0, 500.0 )
styleMask : NSBorderlessWindowMask
backing : NSBackingStoreNonretained
defer : NO
screen : nil];
[NSGraphicsContext setCurrentContext : [NSGraphicsContext graphicsContextWithWindow : theWindow]];


WebView * webView =
[[WebView alloc] initWithFrame : NSMakeRect( 0.0, 0.0, 300.0, 500.0 )
frameName : nil
groupName : nil];


  [theWindow setContentView : webView];

  [webView lockFocus];
  [[webView mainFrame] loadHTMLString : theHtml baseURL : nil ];
  [webView unlockFocus];
--END--

warwick

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
40gmail.com


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >off screen drawing with cocoa (From: Warwick Hall <email@hidden>)
 >Re: off screen drawing with cocoa (From: Nick Zitzmann <email@hidden>)
 >Re: off screen drawing with cocoa (From: Warwick Hall <email@hidden>)
 >Re: off screen drawing with cocoa (From: Half Activist <email@hidden>)
 >Re: off screen drawing with cocoa (From: Michael Watson <email@hidden>)
 >Re: off screen drawing with cocoa (From: Warwick Hall <email@hidden>)

  • Prev by Date: Re: off screen drawing with cocoa
  • Next by Date: Running a setuid script from an NSTask
  • Previous by thread: Re: off screen drawing with cocoa
  • Next by thread: Cocoa Subversion API
  • Index(es):
    • Date
    • Thread