Book Image

LiveCode Mobile Development Cookbook

By : Dr. Edward Lavieri
Book Image

LiveCode Mobile Development Cookbook

By: Dr. Edward Lavieri

Overview of this book

Table of Contents (17 chapters)
LiveCode Mobile Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using a date picker


It is easier for users to input dates via a date picker where they are presented with scroll wheels. This has become a standard user interface object and is expected by users. This recipe shows you how to use a date picker in LiveCode.

How to do it...

To use a date picker, follow the given steps:

  1. Create a new main stack.

  2. Drag a button to the stack's card and assign the following properties:

    • Name: Launch Date Picker

    • Width: 184

    • Height: 23

    • Location: 200, 33

  3. Add the following code to the new button to initiate a date picker, as displayed in the given screenshot:

    on mouseUp
      mobilePickDate "date"
    end mouseUp

    The output will be as follows:

  4. When the user selects the date (month, day, year) and taps Done, you will want to ensure that you have a way to capture the date. LiveCode puts the user's selection into the the result system variable. You can test this by adding one line of code to the mobilePickDate command:

    on mouseUp
      mobilePickDate "date"
      answer the result
    end mouseUp...