官术网_书友最值得收藏!

Getting the user input

We want users to interact with our mobile apps. This means that we must provide the opportunity for the user to provide input, we must capture that input, and we must process it. This recipe focuses on capturing the user input via the mobile keyboard.

How to do it...

The following steps will help you get the user input:

  1. Create a new main stack.
  2. Drag a new button to the stack's card.
  3. Assign the following code to the new button:
    on mouseUp
      ask "What is your name?" with "Type here" \
        titled "getting your input" 
    end mouseUp
  4. Execute the code to see the results.

How it works...

We used the ask command to provide the prompt (What is your name) and default text (Type here). The results are put into the it variable. This provides us the opportunity to evaluate and manipulate the user's input. If the user selects the Cancel button, no value is put into the it variable. You can test this by using the if it is empty line of code.

主站蜘蛛池模板: 苏州市| 车险| 南靖县| 旺苍县| 辛集市| 邵武市| 特克斯县| 武邑县| 德州市| 黎平县| 新建县| 甘泉县| 邹城市| 安国市| 景东| 房产| 松阳县| 德阳市| 崇阳县| 阿克苏市| 建阳市| 天等县| 新晃| 普陀区| 汉阴县| 襄城县| 乌鲁木齐县| 扬州市| 资阳市| 大连市| 临夏市| 东兴市| 迁西县| 吐鲁番市| 佛山市| 襄垣县| 潮安县| 克拉玛依市| 福海县| 昭平县| 南岸区|