mobilePickPhoto & Landscape

The place to discuss anything and everything about running your LiveCode on Android

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
simon.schvartzman
Posts: 230
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

mobilePickPhoto & Landscape

Post by simon.schvartzman » Sun Feb 10, 2019 11:39 pm

I have been fighting (and loosing) for 3 days trying to make it work before coming here...

This is my problem:

1- I have a 1 button app (portrait only) that will allow the user to take a picture
2- once the picture is taken it has to be presented on the device screen using as much real estate as possible
3- using a very simple stack (below) everything works ok if user takes the pictures in Portrait mode as well
4- things become weird if user decides to take the picture in landscape mode with two different situations and results:
4a- user presses the button to take the picture and then rotates the device
4b- user rotates the device and then presses the button to take the picture

Code: Select all

on preOpenStack
   set the width of the templateimage to 320
   set the height of the templateimage to 480
end preOpenStack

Code: Select all

on mouseUp
   set the lockloc of the templateimage to true
   mobilePickPhoto "camera"
   if the result is "cancel" then
      return true
   end if 
   set the top of last img to 100
   set the left of last img to 0
end mouseUp
questions:
1 - what's the default size of the templateimage? ( I have tried answer the width and height of last picture and get strange results)
2 - is there any way to learn how the picture was taken (portrait of landscape) once control is returned to the App? ( same as above)
3 - is there any way to restrict the user to take pictures in Portrait mode only?
4 - has anyone achieved what I'm trying to achieve and is willing to share?

Many thanks in advance for any kind of help...
Simon
________________________________________
To ";" or not to ";" that is the question

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4814
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: mobilePickPhoto & Landscape

Post by jacque » Mon Feb 11, 2019 7:52 pm

The templateImage will not change unless you specifically reset it. It will be whatever size it was last set to otherwise. In this case it will be 320x480, since you set it that way in preOpenStack and locked it before calling the camera.(You could probably, move the lockLoc command to the preOpenStack handler along with the size settings.)

You can determine the picture orientation by comparing its formattedWidth to its formattedHeight. This gives you the original dimensions rather than the display size on screen.

I don't believe you can control the orientation outside of your own app, but maybe someone else has solved it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

simon.schvartzman
Posts: 230
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: mobilePickPhoto & Landscape

Post by simon.schvartzman » Tue Feb 12, 2019 1:27 pm

Thanks Jacque, as always your suggestions are very useful.

Regards
Simon
________________________________________
To ";" or not to ";" that is the question

simon.schvartzman
Posts: 230
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: mobilePickPhoto & Landscape

Post by simon.schvartzman » Thu Feb 14, 2019 12:29 pm

For those interested in the subject LC has confirmed there is a bug related with this whole stuff.

Bug report can be found here

https://quality.livecode.com/show_bug.cgi?id=21833
Simon
________________________________________
To ";" or not to ";" that is the question

Post Reply

Return to “Android Deployment”