revUpdateGeomettry not working and a few others?

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
CoffeeCone
Posts: 64
Joined: Fri Apr 26, 2013 8:38 am

revUpdateGeomettry not working and a few others?

Post by CoffeeCone » Fri Apr 26, 2013 8:52 pm

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
Learning LiveCode, one step at a time.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: revUpdateGeomettry not working and a few others?

Post by Simon » Fri Apr 26, 2013 10:06 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

CoffeeCone
Posts: 64
Joined: Fri Apr 26, 2013 8:38 am

Re: revUpdateGeomettry not working and a few others?

Post by CoffeeCone » Fri Apr 26, 2013 10:28 pm

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
Learning LiveCode, one step at a time.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: revUpdateGeomettry not working and a few others?

Post by Simon » Fri Apr 26, 2013 11:57 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

CoffeeCone
Posts: 64
Joined: Fri Apr 26, 2013 8:38 am

Re: revUpdateGeomettry not working and a few others?

Post by CoffeeCone » Sat Apr 27, 2013 12:09 am

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
Learning LiveCode, one step at a time.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: revUpdateGeomettry not working and a few others?

Post by Simon » Sat Apr 27, 2013 12:34 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: revUpdateGeomettry not working and a few others?

Post by Simon » Sat Apr 27, 2013 12:43 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: revUpdateGeomettry not working and a few others?

Post by jacque » Sat Apr 27, 2013 9:37 am

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

CoffeeCone
Posts: 64
Joined: Fri Apr 26, 2013 8:38 am

Re: revUpdateGeomettry not working and a few others?

Post by CoffeeCone » Thu May 02, 2013 12:03 pm

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.
Learning LiveCode, one step at a time.

Post Reply