Page 1 of 1

revUpdateGeomettry not working and a few others?

Posted: Fri Apr 26, 2013 8:52 pm
by CoffeeCone
Hi, I made a simple Android app using LC 6 and managed to compile it. This is my first LC Android app so bear with me. I already set the geometry properties of a list field and when I resize the stack, it works as planned. However, when I compile it and move it to my Android phone and switch orientation, nothing seems to change. I already added

Code: Select all

on orientationChanged
   revUpdateGeometry
end orientationChanged
to the card script but to no avail.

Another problem I have is for catching when the application is about to be exited. I already have the following code inside the card script:

Code: Select all

on closeStackRequest
   answer "Are you sure?" with "No" or "Yes"
   if it is "Yes" then pass closeStackRequest 
end closeStackRequest
But no prompts are being shown if I want to continue exiting or not.

And finally, how do I detect the Back, Home, Search, and Menu buttons in Android? Is there a way to show a native Android menu when the Menu button is pressed? Or do I have to roll out my own implementation?

EDIT:
I somehow can't attach my source file, so I uploaded it here instead: http://s.coffeecone.com/Untitled_1.livecode

Re: revUpdateGeomettry not working and a few others?

Posted: Fri Apr 26, 2013 10:06 pm
by Simon
Hi,
I've downloaded your stack and can see the problem with it.
The revUpdateGeometry does not do what you thought.
Look up screenRect and possibley resizeStack. You have to script for the new orientation, for this case not much to do.
on orientationChanged is correct just replace revUpdateGeometry with your new code.

Simon

Re: revUpdateGeomettry not working and a few others?

Posted: Fri Apr 26, 2013 10:28 pm
by CoffeeCone
Simon wrote:Hi,
I've downloaded your stack and can see the problem with it.
The revUpdateGeometry does not do what you thought.
Look up screenRect and possibley resizeStack. You have to script for the new orientation, for this case not much to do.
on orientationChanged is correct just replace revUpdateGeometry with your new code.

Simon
Oh, is there no automated built-in way to handle this? I got pretty excited when I saw the geometry property. xD

Re: revUpdateGeomettry not working and a few others?

Posted: Fri Apr 26, 2013 11:57 pm
by Simon
Well it's darn close to auto. :D
As you rotate the device the screenRect changes (width becomes height etc.) so you have to resize your stack.

Simon

Re: revUpdateGeomettry not working and a few others?

Posted: Sat Apr 27, 2013 12:09 am
by CoffeeCone
Simon wrote:Well it's darn close to auto. :D
As you rotate the device the screenRect changes (width becomes height etc.) so you have to resize your stack.

Simon
But what about the offset for the status bar? Am I supposed to use just use:

Code: Select all

set the width of this stack to blah1
set the height of this stack to blah2

Re: revUpdateGeomettry not working and a few others?

Posted: Sat Apr 27, 2013 12:34 am
by Simon
If you know the status bar size then you just subtract it.
But you should have already seen a problem with that in the original orientation.

Simon

Re: revUpdateGeomettry not working and a few others?

Posted: Sat Apr 27, 2013 12:43 am
by Simon
Ah what the heck.

Code: Select all

put the effective working screenRect into tSize
set the width of this stack to item 3 of tSize
set the height of this stack to item 4 of tSize
Simon

Re: revUpdateGeomettry not working and a few others?

Posted: Sat Apr 27, 2013 9:37 am
by jacque
I don't use the geometry manager myself but I thought it was supposed to work on mobile. Anyway, orientationChanged is sent before the screen rotates in case you want to make changes before the redraw. When rotation is complete, a resizeStack message is sent, and that's when you should redo the geometry.

It isn't necessary to set the stack size after rotation, that happens automatically. On mobile, cards and stacks are always the size of the screen and can't be changed.

Re: revUpdateGeomettry not working and a few others?

Posted: Thu May 02, 2013 12:03 pm
by CoffeeCone
jacque wrote:I don't use the geometry manager myself but I thought it was supposed to work on mobile. Anyway, orientationChanged is sent before the screen rotates in case you want to make changes before the redraw. When rotation is complete, a resizeStack message is sent, and that's when you should redo the geometry.

It isn't necessary to set the stack size after rotation, that happens automatically. On mobile, cards and stacks are always the size of the screen and can't be changed.
Thanks. I manually coded the resizing and it works as expected. But I would rather use a built-in mechanism so I posted a bug report.