• 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
Displaying HTML in an NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Displaying HTML in an NSTextField


  • Subject: Displaying HTML in an NSTextField
  • From: "a.d. jensen" <email@hidden>
  • Date: Tue, 19 Sep 2006 17:32:43 -0500

In an attempt to do some debugging, I'd like to see the source code of a webview. So, I've implemented this code:

---

WebDataSource *dataSource = [[webView mainFrame] dataSource];
NSString *myString;
if ([[dataSource representation] canProvideDocumentSource])
{
myString = [NSString stringWithString:[[dataSource representation] documentSource]];
}
else
{
myString = [NSString stringWithCString:"Cannot get text representation" encoding:NSASCIIStringEncoding];
}
[sourceEdit setStringValue: myString];


---

When the page loads, nothing shows up in the text field (though, if there's something in there already, it's erased.) If I drop into the debugger, I can see the source in "myString" (though truncated, which is why I'm trying to put it in a scrolling text field in the first place) and if I change the line that assigns into myString to be a "stringWithCString", the text field is updated properly.

So, my guess is that the NSTextField is interpreting the web page source code and just not displaying it properly (or rendering it, or something). Any ideas on what to do to make it display properly (or tell me how wrong my guess is :-)

Thanks!


dale

--
email@hidden   http://kandsmil.blogspot.com

Only a fool turns away from an angel,
Vision in white steps through the door,
Holds out her hand, I say 'No I'm not ready'
I open my eyes and let the dream fade away.
  -- echolyn, "on any given nite"


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Displaying HTML in an NSTextField
      • From: Rush Manbert <email@hidden>
    • Re: Displaying HTML in an NSTextField
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Deletes Objects On Remove
  • Next by Date: Custom attrs preserved in RTF files?
  • Previous by thread: Re: Deletes Objects On Remove
  • Next by thread: Re: Displaying HTML in an NSTextField
  • Index(es):
    • Date
    • Thread