Using the VirtualVolume Class
Saving Styled Text and Graphics
Issue: 7.3 (March/April 2009)
Author: Tom Baumgartner
Article Description: No description available.
Article Length (in bytes): 10,358
Starting Page Number: 18
RBD Number: 7309
7309.zip Updated: Monday, March 2, 2009 at 1:36 PM
Related Web Link(s):
Known Limitations: None
Excerpt of article text...
To save a document containing both text and graphics I like to save the text to a file and then save the graphics to the resource fork of the same file. The code to do this is relatively easy, but there are issues with using the resource fork (which is Mac-only and being deprecated by Apple). One alternative is the often-overlooked VirtualVolume class.
Why use VirtualVolume (VV) when using the ResourceFork class is easy? First, resource forks are not supported in Windows files. Second, Apple now recommends that resources be stored in the data fork of a separate resource file. Probably for that reason the ResourceFork class has been deprecated and may not be supported in future versions of REALbasic. Therefore using VV will make your code cross-platform ready and more future-proof.
What are the problems when using VV? To quote the REALbasic Language Reference, "The SaveAsPicture and SaveStyledEditField methods of the FolderItem class do not work for virtual volumes." But those are exactly the methods we want to use to save documents with both styled text and graphics. After a short introduction to VV we will cover some easy workarounds for these limitations.
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.