2014년 12월 3일 수요일

How to make a limiter in App Inventor?

Hi does anyone knows how to make a limiter in app inventor 2.

In my text box you can only put numbers 0-50. But I have know clue how to do this. 
And also if that Place is full it needs to notify the main screen on that building that it's full.

Could somebody help me please?



What have you tried?

Read this chapter   http://www.appinventor.org/Chapter18     about how to use the logic blocks.  It is part of the  AI2 free online eBook  http://appinventor.mit.edu/explore/ai2/tutorials.html   ... the links are at the bottom of the Web page.

You can limit the values you can have in a TextBox using this technique.    Use an  If then ...else   block  for the 'building is full thing'.    You will need to pass a variable from screen you are on to the main screen.   Most people would put a TinyDB on both screens,  make a tag 'IsFull' or something like that and place a Boolean global value there   (this means save a true / false condition).

Try some blocks.  Show what you tried if you get into issues and someone probably will help here if you post.



You need a timer (clock) component) that is disabled until the text box gets focus, at which time you should enable it.  In that clock.fired event block, as Steve said, use an If Then block from the control drawer and either reset the value that's in the text box, or put up a notifier to warn the user that the value is wrong, then blank out the text box and let them try again.  Of course, you can also use a ListView and let someone choose the number from a list, rather than allowing them to type it in.

You should know, from your own code and data, if the building is full BEFORE you let them go to another screen.


댓글 없음:

댓글 쓰기