Very strange behavior of stack in Android Emulator

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
nower
Posts: 47
Joined: Wed May 22, 2013 11:02 pm

Very strange behavior of stack in Android Emulator

Post by nower » Thu Mar 20, 2014 1:02 pm

In this app I open a card in a second stack modal on top of the primary stack.
This works as expected in all pc environments and in the iOS simulator.
In the Android simulator a part that contains a label and a button is not displayed when the card is open. In that place a piece of the underlying card shows through instead.

What is even more strange:
In preOpenCard of the secondary stack I put different text values into the button to determine the max width for layout purposes.
In the Android simulator this process is actually shown in the interface. You can see the button and how it has the different labels, even though it is in preOpenCard. And when the card is finally displayed completely, the part of the card is not displayed at all and the primary card shows through.

Initially I thought the reason for a part not being displayed was that the button is an option menu by default.
But as these option menus don't work on Android, I am now setting the button style to "standard" in preOpenStack (only for Android). However, that doesn't solve the problem.

I will email you the stack and hope you can take a look.
The issue occurs when clicking the "New Quote" button (third from right in the top row) on the main card.

Thank you,
Werner

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Very strange behavior of stack in Android Emulator

Post by LCNeil » Thu Mar 20, 2014 3:39 pm

Hi Werner,

I have had a look at your stack at the most likely reason for this behaviour will be a combination of using modal stacks on mobile (modal stacks are not supported) along with the manual positioning of elements within your stacks.

All stacks, when deployed to mobile, are automatically adjusted to the size of the devices screen and there is no way to manually adjust their size.

I have resolved the issue however by adding the following scripts which show and hide the quoteDisplay as required-

on your saveQuote and cancelEditQuote of the "editQuote" card, I added-

Code: Select all

 set the visible of field "QuoteDisplay"  of card "displayQuote" of stack "enlightening Quotes" to true
and to hide the field, i add the following to the "NewQuote" button of the "DisplayQuote" card

Code: Select all

   set the visible of field "QuoteDisplay" to false
Screen Shot 2014-03-20 at 14.41.25.png
Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——

nower
Posts: 47
Joined: Wed May 22, 2013 11:02 pm

Re: Very strange behavior of stack in Android Emulator

Post by nower » Fri Mar 21, 2014 12:11 am

Hi Neil,

thank you for your help!
That solved most of the issue.

I do have some follow-up questions:

1. In your post you say that modal stacks are not supported on mobile. LC documentation for Android (and iOS) states:
The modal command can also still be used, and will cause the calling handler to block until the modal'ed stack is closed as with the normal engine. Note, however, that performing a further go stack from a modal'ed stack will cause the new stack to layer above the modal stack – this will likely cause many headaches, so it is probably best to avoid this case!
At this time menus and other related popups will not work correctly, as these are implemented in the engine (essentially) as a specialized form of go stack they will cause the current stack to be overlaid completely, with various undesirable side-effects.

That sounds like modal stacks should be ok as long as you don't stack two on top of each other, which I am not doing.
Can you explain the discrepancy between the documentation and what you are saying?

2. You indicate that the manual positioning of elements in my stack could be leading to problems. For mobile, I am only setting the size of each stack to the available screen size to support devices with different screen sizes and device rotation, and then I am positioning the elements on that screen.
How can manual positioning cause problems? Doesn't that happen all the time in games when elements are moved on the screen, or in pinch gestures, when they are made smaller or larger?
Can you clarify what could cause problems and what not, because positioning and resizing are such basic features of LC and are used heavily in all types of development?

3. In the Android simulator there is still the issue that elements of the card to be opened are displayed during preOpenCard, including changing content and changing position. You can see that when you go to the "New Quote" card in the Android emulator.

The LiveCode dictionary says about preOpenCard:
The preOpenCard message is sent before the openCard message. Unlike openCard, preOpenCard handlers are executed before the card appears. Because of this, the preOpenCard handler is a good place to put code that adjusts the size, position, and appearance of objects; the changes are made before the card appears.

The Android emulation doesn't behave like that. Is this a bug? Or is it related to the functionality of my stack? If the latter, what would I need to change for the stack to behave as documented in the dictionary?

Best,
Werner

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Very strange behavior of stack in Android Emulator

Post by LCNeil » Fri Mar 21, 2014 12:23 pm

Hi Werner,

My response above was purely made on assumptions of the modal not being fully supported on mobile in the sense that they fully scale to a devices resolution and that this, along with manually position the type of stack/elements, could be causing the issue. This was not a definite statement and was mainly an observation by myself to what the cause could be.

After you last response, I decided to look a bit further into your stack and I think I have found the culprit that is causing the issue on Android devices.

I came across the issues, as I notices that sometimes, the button list would display as expected without showing the field below it. I eventually managed to click/press a section of your stack and then open the "new quote" stack without any graphical glitches. This led me to discover that "QuoteDisplay" field having focus was the root cause. Disabling focusable(traversalOn) of this field resolved the issues and no more graphic glitches occurred when navigating to the new quote stack.

In regards to the preOpenCard issue, you are correct when you mention that anything executed within the handler should occur before the card is shown. As this is not occurring, this along with the previous issue do sound like bugs so it might be worth submitting a bug report with our Quality Control team as they would be able to investigate the issues further. These could relate to the use of modal on mobile so I would mention this in the report.

You will be able to submit a report here-

http://quality.runrev.com

If you do not have Quality Control account, then you will be able to sign up for one via the New Account" option shown on the Quality Control hompage

Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——

Post Reply

Return to “idea2app and Coding School”