mylo® Sample Codes

Hello World
Download now
I agree to the
License Agreement.

Hello World


Hello World, the quintessential sample program for any aspiring developer.

Things to learn:
  • Understanding the widget package structure
  • Using CSS to style and position HTML elements

Web Shortcut
Download Now
I agree to the
License Agreement.

Web Shortcut


Like the Search Bar widget, this widget accepts keyboard input and will open the mylo® web browser to any URL the user supplies.

Things to learn:
  • Assigning actions to the mylo® keyboard
  • Opening the mylo® Web browser

Search Bar
Download Now
I agree to the
License Agreement.

Search Bar


The Search Bar widget is a simple shortcut that will accept keyboard input in the form of a search term and will open the mylo® web browser to an open search for that term on Wikipedia.

Things to learn:
  • Assigning actions to the mylo® keyboard
  • Opening the mylo® Web browser
  • Building a string with variables

Calendar
Download Now
I agree to the
License Agreement.

Calendar


This widget shows how the date object in JavaScript can be utilized to create a full month calendar. The calendar uses the time setting of the mylo® device to determine the current year and month and will highlight today’s date.

Things to learn:
  • Using the date object
  • Using the goForeground event handler

  
I agree to the
License Agreement.

World Clock


The World Clock widget uses some creative methods to provide an attractive way to show the current time for any user-selectable time zone. Multiple versions of this widget may be installed or copied to have multiple clocks from different time zones shown on the mylo® Screen.

Things to learn:
  • Loading data from user preferences
  • Using the foreground timer

I agree to the
License Agreement.

Calculator


For those of you who prefer a more procedural programming style the Calculator sample demonstrates the four basic math functions which are add, subtract, divide, and multiply. For simplicity, results are calculated in the order entered to avoid low/high order conflicts that could yield unexpected results. An example would be operations such as multiplication or division taking precedence over lower order operations when the user intended that an addition or subtraction should be calculated first. For a more Object-Oriented Programming approach to widget programming, see the code in the "16 Picture Puzzle" widget.

Things to learn:
  • Assigning actions to the mylo® keyboard
  • How to simulate mouse functionality
  • You can use a procedural programming approach

I agree to the
License Agreement.

RSS Reminder


This widget is a simple news aggregator that will display the five most recent news items from a user-selectable RSS feed. Once loaded, the RSS headlines themselves are hyperlinks that will open the mylo® web browser to show the full content of the RSS item in its original context.

Things to learn:
  • Loading data from user preferences
  • Making an XMLHTTP request
  • Parsing an XML response
  • Opening the mylo® Web Browser

I agree to the
License Agreement.

To-Do List


The main goal of this sample To-Do-List widget is to demonstrate one of many possible techniques a mylo® widget developer can use to maintain state in their application. This particular sample is built around a miniature JavaScript database engine which uses an array as the core mechanism to iterate through each record set. This example demonstrates the following functionality:

Things to learn:

  • How to use saveFile() a built-in mylo® function used to save an XML file to a widget directory.
  • How to use the XMLHttpRequest object to load the file, parse each XML record, and then populate the array used by the database engine.
  • Helper functions to iterate through the To-Do-List database, add an item record, and delete an item record.

I agree to the
License Agreement.

16 Picture Puzzle


This 16 Picture Puzzle widget is an excellent example of how to develop a widget using a more Object-Oriented Programming approach. The 16 Picture Puzzle widget uses Lambda (Function Literals) Functions through out. After you have put the puzzle together there is a shuffle function that re-orders the pieces. Besides being a fun game the 16 Picture Puzzle also provides examples on how to use the mylo® Widget Library. For a more procedural approach to widget programming, see the sample code in the Calculator widget.

Things to learn:
  • Use of Function Literals
  • Using the Widget Library
  • You can use an object-oriented programming approach