Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 14 in printed book and digital formats -- plus a one-year subscription so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

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