Page 2 of 2

Re: Rescaling a selected image from album on Android

Posted: Tue Sep 02, 2014 10:46 am
by Tukcedo
[Sigh] You old pirate you ;-) ;-)

Would strict checking catch this, as it does in Perl and other lingoes?

Re: Rescaling a selected image from album on Android

Posted: Tue Sep 02, 2014 6:04 pm
by Simon
Yes, but now I'm confused.
From the Main menu Edit > Preferences > Script Editor select Strict Compilation Mode
or
From the Script Editor menu Edit select Variable Checking
I know the second one works. Is it the same as the first one?

Simon

Re: Rescaling a selected image from album on Android

Posted: Tue Sep 02, 2014 8:09 pm
by Tukcedo
First the good news: the delete now works and it fixes the situation of overlapping or non-resizing images. Left to do: Android reverses portrait and landscape (i.e. camera landscape = image portrait)

Hmmm don't think so: I'm getting different results for the "preferences" and the "variable checking" methods. The 2nd one seems stricter. I've declared a "local cProfileImage" at the top of the card script. Variable checking complains about the code snippet below with:

card "UserProfile": compilation error at line 28 (Chunk: can't create a variable with that name (explicitVariables?)) near "MaxHeight", char 12

whereas Preferences remains entirely happy (No errors occurred). Dunno what it's complaining about to be honest. Perhaps we should split into a new subject ...

Code: Select all

         # an image was selected
         put the formattedHeight of the last image into W
         put the formattedWidth of the last image into H
         set the name of the last image to "cProfileImage"
         set the lockLoc of image "cProfileImage" to true
         set resizeQuality of image "cProfileImage" to "good"
         
         put W / H into AspectRatio
         put round(MaxHeight * AspectRatio) into NewWidth
         answer "W x H = " & W && "x" && H && "(" & AspectRatio & ")" & return &  "New:" && NewWidth && "x" && MaxHeight with OK 
         
         lock screen
         # first set the new dimensions
         set the height of image "cProfileImage" to MaxHeight
         set the width of image "cProfileImage" to NewWidth
         # then position the scaled image
         set the left of image "cProfileImage" to 40
         set the top of image "cProfileImage" to 300
         unlock screen

Re: Rescaling a selected image from album on Android

Posted: Tue Sep 02, 2014 8:42 pm
by Simon
:)
card "UserProfile": compilation error at line 28 (Chunk: can't create a variable with that name (explicitVariables?)) near "MaxHeight", char 12
You'll now have to list all of your variables upfront just like you did with cProfileImage.

I think I have seen the flipped landscape/portrait but I don't recall a solution.

Simon
Edit; No I am wrong.
Variable checking causes LiveCode to perform a stricter check
of your scripts. Using any variable without declaring it first, or
using a literal string without encloning it in quotes causes a
compile error. This behavior can be useful in tracking down
certain subtle problems such as misspelling a variable name.
So that isn't going to help catch spelling mistakes :(
Edit 2; in your strings.

Re: Rescaling a selected image from album on Android

Posted: Tue Sep 02, 2014 8:47 pm
by Tukcedo
Playing with that rotate/angle stuff right now, but this "flipping" thing is pretty resilient it appears ;-) When I get to grips with it I'll post of course. Thanks a zillion so far!