Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
LiveCode Mobile Development Beginner's Guide (2nd Edition)

You're reading from   LiveCode Mobile Development Beginner's Guide (2nd Edition) Create interactive mobile apps for Android and iOS with LiveCode

Arrow left icon
Product type Paperback
Published in May 2015
Publisher
ISBN-13 9781849699655
Length 256 pages
Edition 1st Edition
Arrow right icon
Authors (2):
Arrow left icon
Colin Holgate Colin Holgate
Author Profile Icon Colin Holgate
Colin Holgate
Joel W Gerdeen Joel W Gerdeen
Author Profile Icon Joel W Gerdeen
Joel W Gerdeen
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. LiveCode Fundamentals FREE CHAPTER 2. Getting Started with LiveCode Mobile 3. Building User Interfaces 4. Using Remote Data and Media 5. Making a Jigsaw Puzzle Application 6. Making a Reminder Application 7. Deploying to Your Device A. Extending LiveCode Index

Time for action – making cards and navigating between them

A calculator doesn't really need a title screen, but we'll make one anyway in order to practice adding scripts and to do some basic navigation. Start a new Mainstack from the File menu and open the Inspector palette.

  1. In the Inspector palette, enter the Simple Calculator stack name in the Name field.
  2. Select New Card from the Object menu.
  3. Use the View menu to either go to the previous card (Go Prev) or first card (Go First).
  4. Make sure you have the Edit tool selected in the Tools palette and drag a Label field to the middle of the card window. In this case, you can easily see which one is the Label field (it says Label: in the icon), but as a general tip, you can point to controls in the Tools Palette and see the help tip that shows what kind of control it is.
  5. In the Basic Properties section of the Inspector palette, uncheck the Don't wrap checkbox.
  6. Type title into the Name entry field.
  7. Choose Contents from the Inspector drop-down menu and replace the initial text that says Label: by entering Simple Calculator into the Contents entry field.
  8. Choose Text Formatting from the drop-down menu and click on the Align text center button, the middle of the three Align buttons.
  9. Change the font, size, and style options to make a nice looking title, resizing the field itself until you like how it looks:
    Time for action – making cards and navigating between them
  10. Drag a Push button (the second icon from the top-left corner of the Tools palette) from the Tools palette and place it below the title field.
  11. In the Inspector palette, choose Basic Properties from the drop-down menu (it's the menu that says Text Formatting in the preceding screenshot) and enter Begin in the Name entry field. LiveCode will automatically show the same text as the button's label even though you didn't type it in the Label entry field.
  12. You can go into the Text Formatting options for buttons too, if you wish!
  13. Mentally prepare yourself; we're about to type in our first script!
  14. With the button selected, choose Object Script from the Object menu. You can also right-click on the button itself and select Edit Script.
  15. The script window will appear and show a starter script of on mouseUp, blank line, and end mouseUp, as shown in the following screenshot:
    Time for action – making cards and navigating between them

Complete the script by typing go next into the blank line to give you this final script:

on mouseup
  go next
end mouseup

Now, perform the following steps:

  1. Close the script window and click on Yes when asked whether you want to save the changes.
  2. Choose the Browse tool from the Tools palette (the upper leftmost tool that looks like a regular cursor arrow) and click on the Begin button that you just made. All being well, you're now looking at a blank card. Don't worry, you didn't just delete the title field and button! You're now on the second of the two cards that you made earlier. Use the View menu again to go back to the first card to try the button again.
  3. Save! from the File menu, choose Save and save the stack with the Simple Calculator name somewhere you can easily find it later. Perhaps, you could make a folder to hold the several stacks you will make while reading this book.

What just happened?

These may have seemed like a lot of steps, but we did create the two cards we needed, laid out a nice looking title field, and a begin button with its own script. In reality, these steps take well under two minutes and will be even quicker to carry out as you gain experience in LiveCode.

Pop quiz – selecting the best name?

If you want to make it big in the multimedia authoring tool world, which of these names would be a bad choice?

  1. Henry
  2. Bill
  3. Bob
  4. Kevin

Answer: 1

In the early days of multimedia, it seemed like everyone had one of just a few popular names. There was Bill Atkinson, who created HyperCard, and Bill Appleton, who created SuperCard. Kevin Calhoun was the lead HyperCard programmer for a while and Kevin Miller is the head of LiveCode. Bob Stein was one of the founders of The Voyager Company and along with Bob Abel who was one of the pioneers in visual effects. Dan was another good choice as there was Dan Winkler, the author of the HyperTalk language, and Danny Goodman, the author of many famous programming books. Henry would be a good name if you wanted to make motorcars or marry lots of queens.

You have been reading a chapter from
LiveCode Mobile Development Beginner's Guide (2nd Edition)
Published in: May 2015
Publisher:
ISBN-13: 9781849699655
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime