(Example: +cartoon +desktops)
Advanced Search & Tips
See the Home Page side bar for links to more sections!
App Makeovers Desktop Pictures Icons MacOS X Mods Safari Stuff
Application Splashes Dock Poofs iTunes Skins MacOS X Themes Snapshots
Boot Images Download Stats Links Page Mouse Cursors Uploads
Boot Panels GUI Software Login Panels REALbasic User Forum
Clocks Home Page
Download a free demo of REALbasic!
Download a free demo of REALbasic!
Recent Articles...
3D
3D Photo Gallery Part 2 (12-06-01)
3D Photo Gallery Part 1 (11-29-01)

Audio
iPod Tricks (Part 1)
Laugh Track Machine
Audio Player with Reverb
Shepard Melody(11-08-01)
RB Phone Home (10-25-01)
Build a Drum Machine (10-04-01)

General RB
Hey! You got your Checkbox in my Listbox!
Background Applications (5-02-03)
Listbox Auto-Find
iTunes-style Listboxes
Virtual Volumes
Time Tracker
Software Distribution Part 4
Software Distribution Part 3
Software Distribution Part 2
Software Distribution Part 1
Exceptions
Custom Controls (8-2-01)
Living on the Edge (6-21-01)
Tips and Tricks (6-14-01)
Review of REALbasic 3.0 (2-19-01)
Text Clippings Made Easy (5-10-01)

Graphics
Image Spinner
Cropping Graphics (Part 4)
Cropping Graphics (Part 3)
Cropping Graphics (Part 2)
Cropping Graphics (Part 1)
Shimmer Graphics
Lissajous Figures
Simple Screen Capture
Vector Graphics
Kaleidoscope Images
Stegonography
Spirals!
Image Table (11-15-01)
RB Magnifying Lens (10-11-01)
Screen Capture (8-9-01)
Color Picker Tutorial (6-7-01)

Hacks
Ghost Grab
Speedy Mouse Extension(11-01-01)
iTunes Plugins (8-23-01)
iTunes Skinner (7-26-01)

Internet
HTML IMG Tags
Version Tracking
Even Smarter Instant Messaging
Web Tiler
JavaScript and REALbasic (10-02-01)
Stock Ticker - Part II (9-06-01)
Stock Ticker - Part I (8-30-01)
AIM Mate (8-16-01)

Mac OS X
Using Sheets in REALbasic
Build a Bundle Part 2
Build a Bundle Part 1
Dock Your Passwords
Mac OS X Debugging
REALbasic Mac OS X Icon Tutorial (12-13-01)
Animate Your Dock (5-17-01)
RB and the Command Line (5-3-01)

Novelty
Guessing Game
Calendar Trivia
Tile Mixer
Zip Code Finder
Happy Valentine's Day
Merlin Simulator Part 3 (01-24-02)
Merlin Simulator Part 2 (01-17-02)
Merlin Simulator Part 1 (01-10-02)
Buzzword Machine (10-18-01)
AppleSoft BASIC (9-20-01)

Printing
Print to PDF

Resources
Picture Extractor 2 (5-31-01)
Picture Extractor 1 (5-24-01)

Serial
Caller ID Part 3 (7-12-01)
Caller ID Part 2 (7-5-01)
Caller ID Part 1 (6-28-01)

Speech
Speech Recognition (9-13-01)
Video
Big Brother Video Capture

Newest Dev Tools!

Book Alert !
REALbasic for Dummies
by Erick Tejkowski
$19.99 @ Amazon

Made with REALbasic!

Problems?
Downloads are in StuffIt 5 format (free download).
Tell me about a bad link (Thanks!).
Submission Policy

8-1-02

Virtual Volumes in REALbasic by Erick Tejkowski

V DRIVE To continue our examinination of the new features in REALbasic 4.5, we'll look at Virtual Volumes this week. If you've ever needed to store different kinds of data in one file, REALbasic's Virtual Volumes are for you!


NOTE: This project requires REALbasic 4.5 or newer!

The new VirtualVolume feature of REALbasic is easy to learn, quick to code, and is a pretty handy tool for your next REALbasic project. The VirtualVolume class lets you store multiple files in one file. This is somewhat like the disk images that you may have used in the Finder. Since REALbasic 4.5 gives you this feature across all of its target platforms (OS9, OSX, and Win32), we'll build today's example using the Classic Mac OS.

Build the Interface

Launch REALbasic and open Window1 from the Project window. To this window, add the following controls:

Control TypeControl NameOther Properties
PushButtonPushButton1 
PushButtonPushButton2 
EditFieldEditField1ReadOnly=TRUE
EditFieldEditField2ReadOnly=TRUE

Arrange the interface however you want. It might look like this:

08-01-02_interface.jpg (20k)

Source Code

That's it for the interface, now it's time to add some code. The code we'll add goes in the Action event of PushButton1 and PushButton2. First, PushButton1:

  dim f,root,textfile,numberfile as folderItem 
  dim v as virtualVolume
  dim textout as textoutputStream
  dim numout as binaryStream
  dim d as date 
  
  f=DesktopFolder.Child("Resex Virtual Volume")
  v=f.createVirtualVolume
  
  if v<>nil then
    //we have a virtual volme, so let's find it's root
    root = v.Root
    
    //create folderitems for the items
    //we will add to the virtual volume
    textfile = root.child("My Text")
    numberfile = root.child("My Date")
    
    if textfile<>nil then
      //create a text file on the virtual volume
      textout = textfile.createTextFile
      //add some text to it
      textout.writeline "This is text on my virtual volume."
      textout.close
    end if
    
    if numberfile<>nil then
      d=new date 
      //using a generic binary file type here
      //that we didn't even have to define
      //in the file types dialog
      numout = numberfile.createbinaryFile("")
      //store the day, month, and year
      numout.writelong d.day 
      numout.writelong d.month 
      numout.writelong d.Year
      numout.close
    end if
    
  end if
  

Then, it's time for PushButton2

  dim f,root,textfile,numfile as folderItem 
  dim v as virtualVolume
  dim textin as textinputStream
  dim binin as binaryStream
  dim s as string 
  
  f=DesktopFolder.Child("Resex Virtual Volume")
  
  //now open the virtual volume
  v=f.OpenAsVirtualVolume
  
  if v<>nil then
    //we have a virtual volme, so let's find it's root
    root = v.Root
    
    //create folderitems for the items
    //we will retrieve from the virtual volume
    textfile = root.child("My Text")
    numfile = root.child("My Date")
    
    if textfile<>nil and textfile.exists then
      //create a text file on the virtual volume
      textin = textfile.openasTextFile
      //read the text from it
      editfield1.text=textin.readline
      textin.close
    end if
    
    if numfile<>nil and numfile.exists  then
      //get the date from the virtual volume
      binin = numfile.openasbinaryFile(FALSE)
      if binin<>nil then
        //day
        s = str(binin.readlong)+"."
        //month
        s = s + str(binin.readlong)+"."
        //year
        s = s + str(binin.readlong)
        editfield2.text=s 
        binin.close
      end if
      
    end if
    
  end if
  

As you can tell, there isn't much to learn here, but there is much to gain. Creating a VirtualVolume requires use of the new "CreateVirtualVolume" method of the FolderItem class. Once you have a VirtualVolume, you find it's root using the "Root" method. From there, it's standard REALbasic code.

Conclusion

To test the project, select the Debug-Run menu. The demo creates a VirtualVolume on the desktop and adds two files to it. Clicking the other PushButton will retrieve the data from the VirtualVolume. As usual you can download the completed project instead of creating it by hand. Use your imagination when playing with the new VirtualVolume features of REALbasic 4.5. There are many useful possibilities for using this feature:

  • As a kind of "virtual" resource fork
  • As a way to package your favorite skins in one file
  • As a database
  • As an archive for easy one-file backups
The cool part about the VirtualVolume is that you don't have to create your own weird file formats. You can put information together into one file using the standard text and binary file operations that you already know. Neat! Have fun and see you next week!


7-30-02

REALbasic News by Erick Tejkowski

MovieWorks Plug-in
Alfred Van Hoek has updated his MovieWorks Plug-in. So, what can you do with the plug-in? You can copy tracks from cd's into a movieFile, and export them as an mp4 file (or other type) with the qtMovieExporter and QTComponent classes. An importer project sample comes with the plugin.

OpenBase Plugin
Brad Hutchings has posted an Alpha release of his OpenBase Plugin 3.0a2 for REALbasic. This release adds a "connect" project showing how to use a socket to asynchronously test a connection before handing control off to OpenBase. It fixes various problems reported by testers. Please see the enclosed documentation.

EasyPalette
fracturedSoftware announced the release of easyPalette beta1. easyPalette makes it fast and easy to add cross platform, customisable tearoff palettes to your REALbasic project. a fully functional demo of easyPalette is available at www.fracturedsoftware.com. The final version of easyPalette should be available in about 2 weeks and will cost USD 25 with source code.

ColorSwatch 2.0
Scott Steinman has some free REALbasic code for you! Download his ColorSwatch 2.0 and give it a whirl.


See the Home Page side bar for links to more sections!
App Makeovers Desktop Pictures Icons MacOS X Mods Safari Stuff
Application Splashes Dock Poofs iTunes Skins MacOS X Themes Snapshots
Boot Images Download Stats Links Page Mouse Cursors Uploads
Boot Panels GUI Software Login Panels REALbasic User Forum
Clocks Home Page

Maintained by the Staff of ResExcellence. This entire site ©1997-2003 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement.

[an error occurred while processing this directive]on the ResEx LinuxPPC Server