2014년 12월 12일 금요일

Blocks

I'm working on an app in App Inventor 2.

The idea is that once the user fills in some number fields and presses submit, the app does a calculation taking the values from the fields.  (For now I'll start with this).

My usual experience with this kind of thing is using Infopath, however I can't seem to get this to work for me in App Inventor. If anyone could give me some ideas of either how to do this or where to start, I'd be really grateful.

On another angle, is it possible to assign a value to a tick box? (i.e. if I click on the box, it's a score of 1, if not, it's a score of 0)

Any help is gratefully appreciated.

Your can learn to program by doing theTutorials:

or by reading the AI2 free online eBook   http://appinventor.mit.edu/explore/ai2/tutorials.html   ... the links are at the bottom of the Web page.

Your questions are pretty well covered in the online book.    If you have a specific question, please post a screen capture image and ask again.

What have you tried.   The nice thing about AI2 is you can not 'break' anything if you save an aia file or  a copy of your project on the MIT server...
Projects > ...save as....

Thanks. I'm working my way through that online book. It's making a bit more sense to me. My biggest issue is where do I actually write the equation with the inputs from the text fields? Also, I'm having difficulty figuring out how to write an if/then block to say "if something isn't filled in, don't go to the next page"

Sorry for all the questions. It's frustrating for me, as I'm not new to the logic behind this, but the actual Jigsaw itself seems to leave me blank.

Book chapter 18    Testing Conditions with if and ifelse Blocks

App Inventor provides an if-then conditional block ()  found in the Control drawer. You can extend the block with as many else and else if branches as you’d like by clicking on the blue icon, as shown in Figure 18-2.

The if and ifelse conditional blocks
You can plug any Boolean expression into the test slots of the if and else if blocks. A Boolean expression is a mathematical equation that returns a result of either true or false. The expression tests the value of properties and variables using relational and logical operators such as the ones shown inFigure 18-3.

Relational and logical operator blocks used in conditional tests
The blocks you put within the “then” slot of an if will only be executed if the test is true. If the test is false, the app moves on to the blocks below it.
For a game, you might plug in a Boolean expression concerning the score, as shown in Figure 18-4.

How to use the Text blocks.... try chapter 16    http://www.appinventor.org/Chapter16

THANK YOU. This is starting to make some sense now. Great. My last question (for now) is:

How do I do Parentheses or brackets in the blocks?

So, the equation I want to do is something along the lines of

Answer = (Textbox1.text x 4.5) + (Textbox2.text x 5.4) + (Textbox3.text x 4.4) + .....

And so on. Does that make sense? I can get individual Textbox x number, but can't seem to put them together with brackets?