Special

Special Print Closeout!

We're clearing out the remainder of our print issues at fire sale prices -- as much as 75% off! Quantities are extremely limited and only available while supplies last. Hurry to take advantage of this one-time offer.

RBD Magazines

Once these printed back issues are gone, they are gone!

Article Preview


Buy Now

PDF:

Feature

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
Resource File(s):

Download Icon 7309.zip Updated: Monday, March 2, 2009 at 1:36 PM

Related Web Link(s):

http://www.freaksw.com/development/REALbasic/rb-classes.php

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.


 


|

 


Weblog Commenting and Trackback by HaloScan.com