Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Overview of this book

Table of Contents (15 chapters)
LiveCode Mobile Development Beginner's Guide Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – making the home card buttons work


The Sort by Location button's script is quite something. You should look forward to that! First, we'll start with the Sort by Time button:

  1. Edit the script of the Sort by Time button on the first card.

  2. Type in the following short handler:

    on mouseUp
      global gReminderData
      set the itemdelimiter to tab
      sort gReminderData numeric by item 4 of each
      showdata
      writedata
    end mouseUp

    Note

    LiveCode's sort command is powerful and in the preceding case, it sorts the list of reminders based on the notification seconds value. Once the lines are sorted, the list is recreated for the user to see and the text file is rewritten.

  3. Get mentally prepared and then edit the script of the Sort by Location button.

  4. Type in all of the following lines of code:

    on mouseUp
      global gReminderData
      mobileStartTrackingSensor "location", true
      put mobileSensorReading("location", false) into tLocation
      mobileStopTrackingSensor "location"
      set the itemdelimiter to comma...