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 – a simple code layout example


It could get quite complicated if you did lay out all of the card's controls with code, so we're only going to construct a simple case to show the technique. You can enhance this later for more complex cases.

  1. Create a new Mainstack.

  2. Add four buttons across the width of the card.

  3. Put this handler in the card script:

    on resizeStack newWidth,newHeight
    put the width of button 1 into buttonWidth
    put (newWidth - 4 * buttonWidth)/5 into gap
    put the top of button 1 into buttonTop
    repeat with a = 1 to 4
        set the top of button a to buttonTop
        set the left of button a to gap + (a-1) * (gap+buttonWidth)
      end repeat
      pass resizeStack
    end resizeStack
  4. Resize the card window. The buttons should spread out evenly across the card.

  5. Go to Standalone Application Settings and select the iOS option.

  6. Make sure that the supported devices include iPad.

  7. Set the orientation options to include all the four orientations.

  8. From the Development menu, set the Test Target as...