Page 1 of 1

Ask command under iOS - Distinguish between Cancel and empty

Posted: Tue Dec 11, 2012 3:35 pm
by Mag
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.

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

Posted: Tue Dec 11, 2012 4:41 pm
by sturgis
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.

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

Posted: Tue Dec 11, 2012 6:01 pm
by Mag
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.

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

Posted: Tue Dec 11, 2012 6:07 pm
by Mag
OK, saw the preferences, the option is set to Search and grayed out:

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

Posted: Tue Dec 11, 2012 6:35 pm
by jacque
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?

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

Posted: Tue Dec 11, 2012 7:34 pm
by Mag
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.

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

Posted: Tue Dec 11, 2012 9:02 pm
by jacque
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.