Ask command under iOS - Distinguish between Cancel and empty

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Ask command under iOS - Distinguish between Cancel and empty

Post by Mag » Tue Dec 11, 2012 3:35 pm

Hi all,

I'm working with the Ask command under iOS. Based on my experiments, it seems not possible distinguish from the Cancel in the result and an empty "it" result. Anybody had similar problems?

Pseudo code:

Code: Select all

 
   put it into A
   put the result into B

if B is cancel then
      -- do something
      -- unfortunately it seems that under iOS also A falls here if it is ""
else
      -- do something else
 end if
PS
In desktop all works vell.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Ask command under iOS - Distinguish between Cancel and e

Post by sturgis » Tue Dec 11, 2012 4:41 pm

Hmm. can't test on IOS right this sec, but..

if you do something simple like:

Code: Select all

on mouseUp
   ask "This is a question?"
   switch 
      case the result is "Cancel"
         answer information "You cancelled"
         break
      case it is empty
         answer information "nothing in the field"
         break
      default
         answer information "You entered: " & it
   end switch
end mouseUp
Or even simpler,

Code: Select all

ask "This is another question?" 
answer information merge("it: [[it]]  the result:[[the result]]") 
So you can see the values of both.

Though since it works in the ide and not in IOS the other question is whether the ask/answer stuff is being included in the build. If you are using the "splashstack" method of creating your app, and including stacks as part of the app , but not substacks. (in order to make parts of your app "savable") its possible the correct things are not being included due to how the engine figures things out.

To test this you can choose to manually include functionality. In the standalone settings for the main stack, change "search for required inclusions.." to "select inclusions ..." Make sure ask dialong and answer dialog are included as well as any other libraries you might need, build, then test. IF it starts to work after this change, that was the problem. Depending on how your app is set up there might be some easy ways around this that would let you still use the "search for required inclusions" but we can cross that bridge when you get there.

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Ask command under iOS - Distinguish between Cancel and e

Post by Mag » Tue Dec 11, 2012 6:01 pm

Hi sturgis,

thank you for the replay.

In iOS, the first handler give the same result with "" and [Cancel]:

"You cancelled".

The second give this result with "" and [Cancel]:

"it: the result: Cancel"

PS
Now I will study your consideration on splashstack.

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Ask command under iOS - Distinguish between Cancel and e

Post by Mag » Tue Dec 11, 2012 6:07 pm

OK, saw the preferences, the option is set to Search and grayed out:
Attachments
Screen Shot 2012-12-11 at 18.05.46.png

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

Re: Ask command under iOS - Distinguish between Cancel and e

Post by jacque » Tue Dec 11, 2012 6:35 pm

The ask and answer dialogs are not implemented the same way in iOS, so that's why the options are dimmed. Ask and answer are always available in iOS, the engine makes a system call to do those.

The "result" should return the name of the button that was tapped. The "it" variable should return the content of the field in the "ask" dialog, which may be empty. You aren't seeing that?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Ask command under iOS - Distinguish between Cancel and e

Post by Mag » Tue Dec 11, 2012 7:34 pm

Hi jacque, thank you for the replay.

Well, the ask command under iOS:

Pressing the OK button with a string it gives an empty result.

Pressing the Cancel button gives a "cancel" result.

Entering an empty string and pressing OK, it gives a "cancel" result.

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

Re: Ask command under iOS - Distinguish between Cancel and e

Post by jacque » Tue Dec 11, 2012 9:02 pm

For the record, the OK button returns empty in the result on the IDE too, I was wrong about that. I can reproduce your iOS results. I don't know if that is what the OS sends back to LiveCode or whether it's a bug in LiveCode itself. It's probably worth a bug report though.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply