Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
I am trying to script the process of importing an image, rotating it to a different angle, reducing its size, and then setting its location. The script worked perfectly until I added the line to change its rotation angle. Here's the script as I have it so far:
on mouseUp
answer file "Select a JPEG file:"
put it into filePath
import paint from file filePath
set itemDelimiter to "/"
put last item of filePath into tFileName
set itemDelimiter to ""
put the loc of graphic "placeHolder" into tLoc
set the angle of image tFileName to 270
set the width of image tFileName to 166
set the height of image tFileName to 203
set the loc of image tFileName to tLoc
end mouseUp
After adding the line to set the rotation angle, the image gets rotated to the specified angle but then seems to ignore the remaining commands.
What am I missing?
Thank you,
Jon
Last edited by cmhjon on Tue Jun 20, 2023 8:06 pm, edited 1 time in total.
I am stumped. If I remove the angle command line, the script works perfectly but with the angle command in place, the image size is not reduced in size nor is it repositioned as instructed.
In it, I cheat, and simply import a JPEG from the menubar. If I set its angle to some value, I can then set its loc, but neither of its width or height. The size and position pane in the inspector shows the "lock size and position" checkbox as unchecked.
dunbarx wrote: Tue Jun 20, 2023 8:30 pm
Bernd.
My question is this: If one sets the angle of an image, one can no longer change its width or height. The lockLoc property is irrelevant.
I think you have to set the lockLoc to true before setting the angle. Then you can change to dimensions of the image afterwards.
on mouseUp
put the loc of graphic "placeHolder" into tLoc
answer file "Select a JPEG file:"
put it into filePath
set itemDelimiter to "/"
put last item of filePath into tFileName
set itemDelimiter to ""
import paint from file filePath
set lockLoc of image tFileName to true
set the angle of image tFileName to 270
set the width of image tFileName to 166
set the height of image tFileName to 203
set the loc of image tFileName to tLoc
end mouseUp