LiveCode LessonsHow To - LiveCode Mobile Tasks iOS TasksHow do I use the Question and Password Dialogues in iOS?

How do I use the Question and Password Dialogues in iOS?

This lesson describes how to use the LiveCode Question and Password Dialogues in iOS. Source code and screen captures are provided.

Introduction

The Question and Password Dialogues provide simple pop up windows that allow you to prompt the user for the answer to a question or a password. The keyboard is raised at the same time as a dialogue is displayed. This allows the user to enter the required information.

Creating the Question Dialogue

Creating the Question Dialogue

The Question Dialogue is raised using the ask question syntax that is demonstrated in the following example:

ask question "What Time is it:" with "10:00" titled "Time Check"

Observe how the respective areas of the dialogue are populated with the values specified in the ask command. The default result is shown in gray, indicating to the user what the default value is and that an answer has not yet been provided.

Responding to the Question Dialogue

Responding to the Question Dialogue

Once the user enters an answer, the result is shown in solid black characters. The result is written to the variable it.

Creating the Password Dialogue

Creating the Password Dialogue

The Password Dialogue is raised using the ask password syntax that is demonstrated in the following example:

ask password "Please log in:" with "Your Password" titled "System Password"

The respective dialogue areas are populated in the same way for the Question Dialogue as for the Password Dialogue. The default result is also shown in gray, indicating to the user what the default value is and that an answer has not yet been provided. As the default value is not concealed, it should ideally not be a valid password, but may be some kind of message requesting the user to enter the password.

Responding to the Password Dialogue

Responding to the Password Dialogue

Once the user enters a password, black dots are displayed, indicating that characters have been entered. The result is written to the variable it.

3 Comments

Jeff Brand

It seems that the behavior works as described in the IOS Simulator, but not on other platforms, or in the IDE.

The documentation indicates that the resulting value after an ask password ... session will be encrypted, so you don't actually know the value passed.

This is true, except in IOS, the value passed in is what is placed in the 'it' variable.

This can be confusing when building an IOS App, as the IDE will have a different behavior, but if you're aware of the difference, it's relatively trivial to work around.

Hanson Schmidt-Cornelius

Hi Jeff,

yes, thank you for pointing this behaviour out. The dictionary entry has been updated to reflect this difference.

Kind Regards,

Hanson

mcgrath3

The default value when used on an iPad shows up as black dots/concealed and not "Your Password".

Add your comment

E-Mail me when someone replies to this comment