html widget?
-
I don't see anything on displaying html in NSText.
What's the best way to display html within an app?
Cheers,
Steve -
NSAttributedString has several initWithHTML methods. So you
could fill in an NSTextView with HTML like this:
- (void) populateHTML:(NSString *)inHTML
{
NSData *theData = [inHTML
dataUsingEncoding:NSMacOSRomanStringEncoding];
NSAttributedString *text;
text = [[[NSAttributedString alloc]
initWithHTML:theData documentAttributes:nil] autorelease];
[[oNewsText textStorage] setAttributedString:text];
}
(Using this in conjunction with CURLHandle by any chance, Steve?) :-)
Regards,
Dan Wood
On Wednesday, June 26, 2002, at 12:34 AM, Steve Dekorte wrote:
>
> I don't see anything on displaying html in NSText.
> What's the best way to display html within an app?
>
> Cheers,
> Steve
>
>
> _______________________________________________
> MacOSX-dev mailing list
> <MacOSX-dev...>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev
>
>
--
Dan Wood
Karelia Software, LLC
<dwood...>
http://www.karelia.com/
Watson for Mac OS X: http://www.karelia.com/watson/ -
Something like this should work. This was typed in Mail so the standard
disclaimer applies.
NSString *path;
NSData *htmlData;
NSURL *baseURL;
path = @"SomePath";
htmlData = [NSData dataWithContentsOfFile: path];
baseURL = [NSURL fileURLWithPath: path];
htmlAttributedString = [[NSAttributedString alloc] initWithHTML:htmlData
baseURL:baseURL documentAttributes:NULL];
[[textView textStorage] setAttributedString:htmlAttributedString];
Hope this helps.
ryan
On Wednesday, June 26, 2002, at 12:34 AM, Steve Dekorte wrote:
>
> I don't see anything on displaying html in NSText.
> What's the best way to display html within an app?
>
> Cheers,
> Steve
>
>
> _______________________________________________
> MacOSX-dev mailing list
> <MacOSX-dev...>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev
-
On Wednesday, June 26, 2002, at 08:34 AM, Steve Dekorte wrote:
> I don't see anything on displaying html in NSText.
> What's the best way to display html within an app?
I think there's a -initWithHTML method on NSAttributedString, or
something similar.
-- Finlay -
On Wednesday, June 26, 2002, at 10:47 AM, Dan Wood wrote:
> text = [[[NSAttributedString alloc]
> initWithHTML:theData documentAttributes:nil] autorelease];
> [[oNewsText textStorage] setAttributedString:text];
Great - thanks to everyone that replied!
> (Using this in conjunction with CURLHandle by any chance, Steve?) :-)
Hey Dan,
I'm using libcurl but with custom code that uses the multi interface
instead of threads since multithreaded apps appear to unstable on OSX.
Btw, looks like the new (finally stable) version of OmniWeb may have
gone the select() route as well.
Cheers,
Steve -
On Wednesday, June 26, 2002, at 04:09 PM, Steve Dekorte wrote:
> Hey Dan,
>
> I'm using libcurl but with custom code that uses the multi interface
> instead of threads since multithreaded apps appear to unstable on OSX.
> Btw, looks like the new (finally stable) version of OmniWeb may have
> gone the select() route as well.
Nope. Still pretty massively multithreaded.
-Greg -
On Wednesday, June 26, 2002, at 05:26 PM, Greg Titus wrote:
> On Wednesday, June 26, 2002, at 04:09 PM, Steve Dekorte wrote:
>> Hey Dan,
>>
>> I'm using libcurl but with custom code that uses the multi interface
>> instead of threads since multithreaded apps appear to unstable on OSX.
>> Btw, looks like the new (finally stable) version of OmniWeb may have
>> gone the select() route as well.
>
> Nope. Still pretty massively multithreaded.
Interesting. I thought I noticed that downloads paused(not just in the
UI) while I was moving the scroll bar, but I guess not.
Steve



