Option Menu for Android?

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

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

Option Menu for Android?

Post by nower » Tue Mar 18, 2014 1:21 pm

In my app (which works on Windows, Mac, and Linux, and which I am trying to enhance to also work on iOS and Android) I use an option menu in two places to allow the user the selection between different options.
This works well on computers, and for iOS it seems to be translated into a "selection wheel". (I don't know the official name.)
In the Android emulator it messes up the stack display. The LiveCode 6.0 documentation for Android indicates something like this:
"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."
However, the LiveCode 6.0 documentation for iOS has the same statement, and there it seems to work now.

1. Can you clarify which constraints are still in place regarding this matter, for Android and iOS? Is there documentation for the current version of LiveCode that lists the constraints that are still in place?

2. What alternative can you recommend that works in all environments, desktop and mobile? I chose the option menu because it takes up little space on the screen when not interacted with.
(As further info, these option menus are already in stacks that are opened modal on top of the base stack, and it seems there is another constraint on mobile about opening two stacks in modal on top of each other,or is that not true any more?)

Thank you,
Werner

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

Re: Option Menu for Android?

Post by LCNeil » Tue Mar 18, 2014 2:17 pm

Hi Werner,
Any constraints that are currently present for mobile deployment are explained within our release notes. A list of these can be seen below-


• clipboard related syntax and functionality (planned for a future release)
• printing syntax and functionality (planned for a future release)
• setting the mouseLoc (no support on mobile devices)
• socket syntax and functionality (planned for a future release)
• dbPostgreSQL, dbODBC and custom externals (planned for a future release)
• industrial strength encryption and public key cryptography (planned for a future release)
• dbMysql SSL support (planned for a future release)
• paint tools (planned for a future release)
• audioclips/videoclips/player functionality (use the 'play' and 'play video' syntax described
later)
• revBrowser (use native browser control instead)
• revFont (use 'custom font inclusion' mechanism instead)
• drag-drop related syntax and functionality (no support on mobile devices)
• backdrop related syntax and functionality (no support on mobile devices)
• cursor related syntax and functionality (no support on mobile devices)
• revSpeak (no support on iOS)

With that being said, LiveCode 6.6. should see the introductions of encryption on mobile.

In regards to opening multiple stack on mobile, stacks will always be resized to the full resolution of the device so it it not technically possible to overlay multiple stacks in the way you would on the desktop environment

The easiest away to create an option menu, would be to simply create a group of controls that your show and hide depending on user interaction. This way, you can have the group positioned wherever you like. Another option would be to create a native mobile picker that will display a list when executed. More information on how to use and create a mobile picker list can be found in the LiveCode dictionary under "mobilePick"

Kind Regards,


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

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

Re: Option Menu for Android?

Post by nower » Fri Mar 21, 2014 2:48 am

As a follow-up to my issue and Neil's response:

I found a reasonable workaround for the issue. Not sure how ideal it is in general, but it seems to work pretty well for me as it doesn't introduce too many changes from the code for the other platforms and the card layout can stay the same.
I am sharing it here in case it is useful for anyone else.

An option menu button works in all environments except Android.
On Android I change the option menu button to a standard button. Button size and everything else remains the same. The button properties are populated as required for the option menu.

Code: Select all

   
   # on Android turn off menu
   if the platform is "android" then
      set the style of button "CategoryMenu" of me to "standard"
   else
      set the style of button "CategoryMenu" of me to "menu"
   end if
For the button I have an onMouseUp handler

Code: Select all

on mouseUp
   if the platform is "android" then
      mobilePickCategory
   end if
end mouseUp
In the mobilePickCategory handler I display a mobilePick control and store the result back into the button:

Code: Select all

on mobilePickCategory
   
   local tOldSelection
   local tNewSelection
   local tCategories
   
   put the text of button "CategoryMenu" into tCategories
   put the menuHistory of button "CategoryMenu" into tOldSelection
   
   mobilePick tCategories, tOldSelection
   
   put the result into tNewSelection
   
   if tNewSelection <> 0 and tNewSelection <> tOldSelection then
      set the label of button "CategoryMenu" to line tNewSelection of tCategories
      set the menuHistory of button "CategoryMenu" to tNewSelection
   end if
   
end mobilePickCategory

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

Re: Option Menu for Android?

Post by LCNeil » Fri Mar 21, 2014 10:35 am

Hi Werner,

Thank you for positing your solution! I am sure it will assist other coding school user if they encounter a similar issue in the future :)

Kind Regards,


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

bernd59
Posts: 10
Joined: Sat Nov 11, 2017 12:21 pm

Re: Option Menu for Android?

Post by bernd59 » Tue Jun 05, 2018 3:46 pm

I seem to have the same problem with LiveCode 9.0: option menu works proper on Win, OSX, iOS but not on Android (But I only tried an old Android phone with Android 4.0). Is there a shorter solution developed in meantime than that solution given above?
Best
Bernd

Post Reply

Return to “idea2app and Coding School”