Standalone UI's, data stacks, image files

John J. Theobald mailjjt at bellsouth.net
Sun Mar 16 21:21:02 EST 2003


Ken Norris wrote:

> Howdy,
> 
> Note: I didn't get any response so I'll repost (same with the last time I
> tried to find answers about this problem). BTW, it seems that others who
> have questions on these types of subjects don't get answers either. The
> problems with external file referencing, data stacks, images, etc., with
> respect to manipulation of stack content seems to get very little response.
> I've been fighting with how to deal with this for weeks. At this point I'll
> take any advice, from sage absolutism to wild guesses ;+) I'm going to
> rewrite what I want to do:
> 
> 1) Use a standalone as a UI with external data stacks, image resource, and
> sound resource files.
> 
> 2) Be able to load the standalone UI with images and sounds into background
> groups from available files, via a Preferences stack where the current file
> names are stored.
> 
> 3) Be able to switch the bg group images and sound prefs from the
> Preferences stack and have them immediately changed in the standalone UI
> (and automatically saved to the Prefs stack).
> 
> 4) Be able to either:
> 
> a) Load a data stack into the standalone UI somehow, and be able to search,
> manipulate, and update any of the card info, then save it back to the data
> stack in updated condition (with an option for backup copies).
> 
> or..
> 
> b) Search, manipiulate, and update the data stack by _remote control_ (the
> hard part) from the standalone UI, and save the altered data stack normally.
> 
> How do I do it?
> 
> TIA,
> Ken N.
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 

Well, I can't answer all of your questions because as I used to tell my 
students, "You retain more by doing it yourself than by me telling you 
how to do it."

I'm no expert by any means, but below is a snippet I use that 
incorporates some of what you seem to be attempting. Maybe you can glean 
something from this:

on mouseUp
   lock screen
   put the filename of this stack into tfilepath
   set the itemdel to "/"
   put empty into the last item of tfilepath
   set the directory to tfilepath & "/lib/"
   put the short name of this stack into thisstack
   set the defaultStack to "m1.lib"
   set the passkey of this stack to "somepassword"
   open card 2
   put image "image2" into image "images" of stack thisstack
   close this stack
   set the defaultStack to "mymainstack"
   set dontuseQTEffects to true
   show image "images" with visual effect dissolve
   unlock screen
end mouseUp

I use a library directory to store password protected stacks (libraries) 
that contain images or data I use in my main stack.  To retrieve an 
image from the file m1.lib and bring it into my main stack I use the 
above code.  Here is a brief description of what is happening:

1. lock screen while the file is being retrieved
2. get the path of the current main stack
3. set the delimeter to "/" for path manipulation
4. drop the filename of the stack from the path so only the parent 	
directory remains
5. append the "lib" directory to the parent directory (now we have the
lib subdirectory)
6. record the name of the current stack into a variable "thisstack"
7. change the default stack to the one in the lib directory with the 
needed image, in this case m1.lib (note it does not have to end in .rev 
or .mc)  All execution defaults to this stack now (hence the term 
default stack)
8. Because the stack is password protected, load the passkey property 
with the password needed to unlock the stack
9. open the card where the image resides
10. put the image into the original main stack referenced in the 
variable "thisstack"
11. close the library stack
12. set the default stack back to the original main stack
13. use the default metacard effects
14. show the image with an effect
15. unlock the screen to make the image display


Note the libraries I use are static and just containers to hold content. 
  If you intend to modify a file or stack (such as a preferences stack) 
that file or those files can't be part of your main stack, but rather 
they must be "independent". You can't modify the currently running 
stack. I believe this is accurate, but others may provide better guidance.

Hope this is of some help.

Regards,

John J. Theoabld




More information about the use-livecode mailing list