binfile and custom properties

Jeanne A. E. DeVoto jeanne at
Tue Apr 15 01:34:05 EDT 2003

At 1:43 PM -0700 4/14/03, Roger.E.Eller at wrote:
>This is my first attempt at using custom properties, but I have read on the
>list that it is possible to store binary data this way. I think it is
>partialy working, but is not being saved as a component of the stack. I
>want to do this so my app can be self-contained (no external files).

Just a note: a running application can't save changes to itself. So if
you're relying on setting a custom property of the application's main
stack, and you plan to make it into a standalone, you will need a different
approach such as creating a prefs file.

(You may already know this - just thought I'd mention it so you don't run
into it unexpectedly when you're ready to build the standalone.)

>on mouseUp
>  put "C:/PDF_Files/masterForm.pdf" into masterPDFpath
>  put URL ("binfile:"&masterPDFpath) into masterPDFvariable
>  set the customPropertySet of stack "myStack" to myPDFs
>  set the customProperties of stack "myStack" to myPDFs
>  put masterPDFvariable into myPDFs[masterPDFform]
>  save this stack
>  answer myPDFs[masterPDFform]
>end mouseUp

As Richard mentioned, the line "put masterPDFvariable into
myPDFs[masterPDFform]" isn't doing what I think you want to do. This line
puts masterPFDVariable into an element of a variable. The answer command
works because it's asking for the same element of the same variable - but
once the mouseUp handler finishes running, the variable doesn't exist any
more. That's why future requests to it don't return anything.

Also, you don't need to set the customPropertySet or the customProperties
to make this work. This will do fine:

on mouseUp
  put "C:/PDF_Files/masterForm.pdf" into masterPDFpath
  put URL ("binfile:"&masterPDFpath) into masterPDFvariable
  set the myPDFs["masterPDFform"] of this stack to masterPDFvariable
  save this stack
  answer the myPDFs["masterPDFform"] of this stack
end mouseUp

Jeanne A. E. DeVoto ~ jeanne at
Runtime Revolution Limited - Software at the Speed of Thought

More information about the use-livecode mailing list