Replacing group images (was Standalone UI's, data stacks, image files)

Klaus Major k_major at os.surf2000.de
Tue Mar 18 15:49:00 EST 2003


Hi Ken,

> ...
> Here's the script:
>
> on mouseUp
>   set the defaultFolder to "Doggies"
>   answer file empty with filter "JPEGs,*.jpg"
>   lock screen
>   import paint from file it
>   set itemDel to "/"
>   put image (last item of it) into image "myImage"
>   delete image (last item of it)
>   start editing group "myImageGroup"
>   create image "myImage" in group "myImageGroup"

this will create an empty image in that group...

Might work if you put the line:

put image (last item of it) into img "myImage"

after that...

But see below ;-)

>   stop editing group
>   unlock screen
>   send "choose browse tool" to me in 20 milliseconds
> end mouseUp
>
> ....when it executes, I end up with an empty background group window. 
> When I
> select the stack window in the Window menu (which is already checked 
> BTW),
> it goes away and I see the image in the stack, but it's not the group, 
> its
> the image. The group (myImageGroup) is there, according to the 
> Application
> Overview, but there's nothing in it.
>
> Why doesn't the [start editing] command place the image into the group?
>
> TIA,
> Ken N.

i hope i understand you right.

You want to "replace" the image "myImage" in group/background 
"myImageGroup"
with another image that the user has choosen?

Imported image and not referenced?

In that case:

> on mouseUp
>   set the defaultFolder to "Doggies"
>   answer file empty with filter "JPEGs,*.jpg"
      if the result is not "cancel" then
          put url("binfile:" & it) into img "myImage"
     end if
    end mouseup

I hope i got it right...
(It was just too easy ;-)

When using this technique (put url"binfile... into img xxx) the images 
do NOT need to
be of the same dimensions!!!

Hope this helps.

Regards

Klaus Major
k_major at os.surf2000.de




More information about the use-livecode mailing list