Saving RTF text?

I am trying to sort out saving text as RTF. I am not having trouble with the RTF text in the text area, but on this page of the LR it concludes like this:

“The following code, appended to the end of the previous method, saves the styled text to disk in RTF format. It assumes that the File Type Set, “TextTypes” has one item, TextRTF, that defines the RTF file type.”

Dim f As FolderItem = GetSaveFolderItem(TextTypes.TextRtf, "TestSaveRTF") If f <> Nil Then Dim s As TextOutputStream = TextOutputStream.Create(f) s.Write(TextArea1.StyledText.RTFData) End If

I get an error in the debugger saying that the item TextTypes does not exist. So I guess I have to Dim TextTypes as something, but I have tried all sorts of combinations, and cannot seem to resolve my problem. When I search for File Type Set, it says there is no matching item.

Add a File Type Set to your project (if there isn’t one there already), add the RTF type to it, then change that line to match the name of the File Type Set and item you just added.

Thanks again Kem!

I noticed in the FileType setup area it only mention MacType and MacCreator. Are Filetypes only for the Mac. I am creating this project on a Mac, but it is destined to be built for Windows only. Should I be working in my Windows VM and then would I still have to worry about FileTypes?

I must say that I prefer to work on my Mac. I was intending to move the project to Windows when I have it running properly, fix up any anomalies (such as some controls not being in the right place), and then build the Windows version from there. Does that sound reasonable?

No.

As Emile said, no, the File Type Sets are for all platforms.

Your plan is fine, but I prefer the Remote Debugger so I don’t have to worry about which plugins I’m using or maintaining two copies of the project file. Or you can share the project file using source control or over a network, but still, the Remote Debugger is easier.

Do you know about the Remote Debugger?

Loading RTF into TextArea on OSX is slow with the built-in method

read here - Xojo Forum Post 72572

  • there is an example for a better way

Yes, I do and I use it. But the problem as I see it is that I have to finally open the project in the Windows 7 VM because a few of my t Labels have moved, and also the colours are not the same in some cases, so I have to tweak them. Also, I have to use Windows to run InnoSetup to create an installer for the finished app.

Thanks again for all your help.

Interesting, I’ve never seen a difference between running the app through Remote Debugger and natively on the Windows VM, but I guess anything’s possible.

I too use InnoSetup after I compile on the Mac.

[quote=76458:@Axel Schneider]Loading RTF into TextArea on OSX is slow with the built-in method

read here - Xojo Forum Post 72572

  • there is an example for a better way[/quote]

Thanks Axel

[quote=76542:@Kem Tekinay]Interesting, I’ve never seen a difference between running the app through Remote Debugger and natively on the Windows VM, but I guess anything’s possible.

I too use InnoSetup after I compile on the Mac.[/quote]

Hi Kem

I have a screenshot of the app running on MacOSX and Windows 7 (through the Remote debugger). What is the best way that I can show you? I have Dropbox, if that helps.

Put it in your Dropbox, then use the “Image” icon here to post a link within your post so everyone can see it.

Thanks,

Hopefully this works.

Perhaps it hasn’t finished uploading yet? Or you have to put it into the Public folder (if you have one).

Oh, I see, it’s a PDF. I right-clicked and opened in a new window so I see it that way.

Great!

That is what it looks like in the Windows 7 VM with Remote debugger.

Here is what the same page (maybe different details) looks like on the Mac.

The difference you can see is also apparent in the Project if I copy it across to the Windows VM (before running it in the debugger).

Got it, but a bit confused. I see that it looks fine on the Mac and looks bad on Windows through Remote Debugger. Are you saying that if you then open the project natively in the Windows Xojo IDE, then run it, it looks fine too?

[quote=76560:@Kem Tekinay]Got it, but a bit confused. I see that it looks fine on the Mac and looks bad on Windows through Remote Debugger. Are you saying that if you then open the project natively in the Windows Xojo IDE, then run it, it looks fine too?
[/quote]

Took a little while to just check and confirm what I really do see. I transferred the latest version of the Project to the Windows 7 VM and opened it in the Xojo IDE. It looks much the same as the PDF I sent showing the Windows version of the app being remotely debugged.

I did have another post asking about this, but I think I gave it a confusing heading. It read “Defference between Mac and Windows” Or words to that effect. But of course, there is a difference between Mac and Windows, so it was not a good choice of heading. I did actually mean what we are seeing with these PDFs.

So to recap, if I run it through the Remote Debugger onto Windows 7, it looks bad. And if I open the project in the Windows 7 Xojo IDE it also looks bad. It also looks bad if I run it through the Windows Xojo IDE.

My experience is that labels under Windows behave quite differently dimensionwise, as well as fontwise. So this lead me to perfect separate versions of my programs for Windows fine tuned with Xojo Windows under Windows.

Color rendition is different as well, which maybe a problem for graphic sensitive apps.

That suggests that there is no advantage (and perhaps some inconvenience) in opening your project in Windows rather than just using Remote Debugger. Or are you saying that you can more easily adjust the differences because they show up in the IDE too?

Yes, the differences are obvious in the Windows IDE, and can then be compensated for.