Styled text in a Carbon window

Member
Posts: 31
Joined: 2004.09
Post: #1
Hi all,

what's the quickest/easiest way to display some style text (e.g. the contents of an rtf document) in a Carbon window?

thanks for any help.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Rewriting your app in Cocoa, of course...

If that's not an option for some strange reason, I'd guess HIWebView -- that should be able to load RTF (since Safari can).
Quote this message in a reply
Member
Posts: 31
Joined: 2004.09
Post: #3
Give it up about cocoa, already.

I'll check out HIWebView, thanks.
Quote this message in a reply
Member
Posts: 31
Joined: 2004.09
Post: #4
Hmm, HIWebView requires ObjC to actually display something useful in the view.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #5
mars Wrote:Give it up about cocoa, already.
What's wrong with Cocoa? Huh
Quote this message in a reply
Member
Posts: 31
Joined: 2004.09
Post: #6
Nothing. Except, as noted in both the Subject and the question, I'm not using it...

I am looking for a CARBON solution at this point, thanks.

I've looked at WebKit, and it seems it can do the trick, however it uses a snippet of ObjC code to do its trick. I've tried adding the Cocoa framework and the WebKit framework, and also the WebWindow header and ObjC source file, and Xcode (2.0) isn't compiling the ObjC. Is there something I need to be telling Xcode?
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #7
Probably not, but it's hard to say without a look at the example you're working on. Can you post a link?

[subliminal message] ...Use Cocoa instead...Use Cocoa instead...Use Cocoa instead... [/subliminal message]
Quote this message in a reply
Member
Posts: 31
Joined: 2004.09
Post: #8
OK, here's what I've done...

I've gone to the WebKit example code that gets included with Xcode 2 on the Tiger disc.

The code is a sample Carbon application, which uses C code to display a URL. The fly in the ointment is that it uses a small bit of ObjC, which is contained in a "WebWindow.m" source file, along with a "WebWindow.h" header file.

The sample Xcode project includes the Carbon, Cocoa and WebKit frameworks. It compiles and runs with no problems.

So I added Cocoa and WebKit frameworks to my Carbon Xcode project. I then added the "WebWindow.m" and "WebWindow.h" files to my project. WebWindow.m will not compile. Xcode barfs at the first usage of any ObjC code in that source file, complaining it doesn't know what it is.

Is there some option in my project I have to set, to get Xcode to recognise and compile the .m source file?

ta.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #9
sometimes the prefix header is at fault in situations like that. Check that the prefix header will compile as any of the languages in your project -- C++ headers inside #if defined(__cplusplus); ObjC headers inside #if defined(__OBJC__).
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #10
Try:

#include <WebKit/WebKit.h>
#include <WebKit/HIWebView.h>
#include <WebKit/CarbonUtils.h>

in your WebWindow.m file.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Carbon mouse events blocked by window events krex505 3 2,916 Sep 22, 2006 12:04 AM
Last Post: krex505
  Carbon AGL Python Extension Window Problem krex505 2 2,497 Aug 20, 2006 09:59 PM
Last Post: krex505
  Changing window functionality when using SDL and Carbon mrbannon 10 3,971 Jul 21, 2006 06:19 AM
Last Post: mrbannon
  Carbon Window with GL-Context w/o xcode __anti 11 5,025 Sep 29, 2005 01:07 AM
Last Post: OneSadCookie