- LiveCode Mobile Development Beginner's Guide
- Colin Holgate
- 636字
- 2021-08-13 18:18:30
Time for action — making and navigating between cards
A calculator doesn't really need a title screen, but we'll make one anyway, in order to practice adding scripts and doing some basic navigation. You can either take your cleared-out stack from earlier, or start a New Mainstack from the File menu.
- Select New Card from the Object menu.
- Use the View menu to either go to the previous card (Go Prev), or first card (Go First).
- 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 a help tip that shows what kind of control it is.
- In the Basic Properties section of the Inspector palette, uncheck the Don't wrap check box.
- Type
title
into the Name entry field. - Choose Contents from the Inspector drop-down menu, and replace the initial text that says Label: by typing
Simple Calculator
into the contents entry field. - Choose Text Formatting from the drop-down menu, and click on the align text center button, which is the middle of the three Align buttons.
- Change the Font, Size, and Style options, to make a nice looking title, resizing the field itself until you like how it looks:
- Drag a Push button (the second icon from the top left-hand side in the Tools palette) from the Tools palette, and place it below the title field.
- In the Inspector, choose Basic Properties from the drop-down menu (it's the menu that says Text Formatting in the screen shot above), type in
Begin
into the Name entry field. LiveCode will automatically show the same text as the button's label, even though you didn't type it into the Label entry field. - You can go into the text formatting options for buttons too, if you wish!
- Mentally prepare yourself - we're about to type in our first script!
- With the button selected, choose Object Script from the Object menu. You can also right-click on the button itself, and select Edit Script.
- The Script window will appear, and will show a starter script, of
on mouseUp
, (empty line), andend mouseUp
as shown in the following screenshot: - Complete the script by typing in
go next
into the blank line to give you this final script:on mouseUp go next end mouseUp
- Close the script window, and click on Yes when asked if you want to save the changes.
- Choose the Browse tool from the Tools palette (the upper left-most 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.
- Save! From the File menu, choose Save, and save the stack, with the name
Simple Calculator
, somewhere you can easily find later. Perhaps you could make a folder to hold the stacks you will make while reading this book.
What just happened?
That may have seemed like a lot of steps, but we did create the two cards we need, laid out a nice looking title field, and created a Begin button with its own script. In reality those steps take under two minutes, and even less as you gain experience in LiveCode.
Pop quiz — best name?
If you want to make it big in the multimedia authoring tool world, which of these names would be a bad choice?
- Henry
- Bill
- Bob
- Kevin
推薦閱讀
- EJB 3.1從入門到精通
- 面向物聯(lián)網(wǎng)的CC2530與傳感器應(yīng)用開發(fā)
- 網(wǎng)管員典藏書架:網(wǎng)絡(luò)管理與運(yùn)維實(shí)戰(zhàn)寶典
- GPS/GNSS原理與應(yīng)用(第3版)
- 物聯(lián)網(wǎng)之魂:物聯(lián)網(wǎng)協(xié)議與物聯(lián)網(wǎng)操作系統(tǒng)
- 城域網(wǎng)與廣域網(wǎng)(第2版)
- 物聯(lián)網(wǎng)之霧:基于霧計算的智能硬件快速反應(yīng)與安全控制
- 物聯(lián)網(wǎng)長距離無線通信技術(shù)應(yīng)用與開發(fā)
- Microservice Patterns and Best Practices
- Kong網(wǎng)關(guān):入門、實(shí)戰(zhàn)與進(jìn)階
- Practical Web Penetration Testing
- 互聯(lián)網(wǎng)安全的40個智慧洞見(2016)
- 一本書讀懂TCP/IP
- Getting Started with tmux
- 網(wǎng)絡(luò)安全之道