PDA

View Full Version : Styled text in a Carbon window


mars
2005.05.05, 10:42 PM
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.

OneSadCookie
2005.05.05, 11:07 PM
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).

mars
2005.05.05, 11:34 PM
Give it up about cocoa, already.

I'll check out HIWebView, thanks.

mars
2005.05.05, 11:48 PM
Hmm, HIWebView requires ObjC to actually display something useful in the view.

AnotherJake
2005.05.06, 12:42 AM
Give it up about cocoa, already.
What's wrong with Cocoa? :???:

mars
2005.05.06, 01:07 AM
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?

AnotherJake
2005.05.06, 01:40 AM
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]

mars
2005.05.06, 02:05 AM
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.

OneSadCookie
2005.05.06, 02:16 AM
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__).

AnotherJake
2005.05.06, 02:41 AM
Try:

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

in your WebWindow.m file.