RunRev vs RealBasic

Ken Ray kray at sonsothunder.com
Fri Dec 31 15:31:59 EST 2004


On 12/31/04 9:04 AM, "cdunix at praevius.com" <cdunix at praevius.com> wrote:

> The ability to immediately test an interface is a very, very attractive one.
> Although "getting to the window" in test is usually dependent on other things
> as well, it would still be helpful to be able to do.  I do deal with a lot of
> desktop applications as well, so data persistence without the need for a DB
> backend is also a requirement.  How does RunRev handle this?  Is there a
> native
> DB format?  Are objects capable of serializing themselves or would routines
> need
> to be written?

That's one of the beauties of Rev... data can be stored *inside* the stack
files, either as data in fields that have been saved, or as custom
properties that are stored with the stack itself. Additionally, of course,
you could also keep data in text files (or the equivalent) and read them in
as you need them. Once again, the beauty of one-liners; this reads a file
and puts its contents into a variable:

  put url("file:C:\temp.txt") into myVar

The only thing to keep in mind is that that stack that is turned in the
application executable cannot modify itself, however it *can* open Rev
stacks and store data in *them*. Here's an example - suppose you had a stack
called "Stub" that was turning into an executable, and next to it on disk
was a file called "main.rev" that was your "main" window. (I know, your apps
will be a lot more complicated than this, but bear with me.)  You could
first open your main stack from the stub in this manner:

-- Script of stack "stub"
on preOpenStack
  open stack "Main.rev"
end preOpenStack

Then, you could save a persistent variable this way in the "Main.rev" stack:

-- script of a button in the stack "Main.rev"
on mouseUp
  set the uData of this stack to "Hello, Michael"
  save this stack
end mouseUp

The custom property 'uData' will be created (if it's not already there) and
filled with the string "Hello, Michael", and then saved as part of Main.rev.
The next time Main.rev is opened, you can retrieve the value like this:

-- script of another button in the stack "Main.rev"
on mouseUp
  answer (the uData of this stack)
end mouseUp

This displays an alert dialog with the phrase "Hello, Michael" in it.

> I really appreciate the LIST's prompt feedback!

Our pleasure!

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list