Setting a filename

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Setting a filename

Post by Andycal » Sun Feb 24, 2008 11:12 am

I thought this would be easy:

Code: Select all

on openStack
    set the filename of image "prevImage" of this stack to empty
    set the filename of image "prevImage" of this stack to "C:/exports/test.jpg"
end openStack
But it doesn't work.

If I put "C:/exports/test.jpg" in the source of the 'basic properties' for the image, it displays it, but if I just run the above code, I get nothing.

The stack is being called from another stack by the way.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Sun Feb 24, 2008 11:58 am

Does it work if you add the card "descriptor" for the image?

Code: Select all

on openStack 
    set the filename of image "prevImage" OF CD 1 of this stack to empty 
    set the filename of image "prevImage" OF CD 1 of this stack to "C:/exports/test.jpg" 
end openStack

Best

Klaus

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Sun Feb 24, 2008 1:55 pm

Ahh, yep, that works. Doesn't work a second time, but works the first so I guess I need to tidy the file first or something.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Sun Feb 24, 2008 2:24 pm

Doesn't work a second time
What do you mean?

This does not work when you open that stack again/a second time?
Or do other (sub-)stacks NOT have their own "openstack" handler so they call this handler?
In that case there must of course exist an image "previmage" on cd 1 of the "calling" stack, since "THIS" will then refer to the calling stack!


Best

Klaus

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Sun Feb 24, 2008 3:00 pm

I've got one stack with a button. This button does a screenshot export to a file, then opens the sub stack. The sub stack then gets the file and pops it in the image.

Works fine the first time, but if I go back to the first stack and press the button again, the image doesn't appear in the substack.

I'm guessing I'm not using my stacks right?

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Sun Feb 24, 2008 3:08 pm

Code: Select all

Works fine the first time, but if I go back to the first stack and press the button again, the image doesn't appear in the substack.
Is the stack with the script already open at that time?
In that case the "openstack" handler will not get executed, since the stack is already open.


Regards

Klaus

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Sun Feb 24, 2008 6:37 pm

Very good point!

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”