Justinmind tutorial (2) -- Calculation Expression and condition usage

Source: Internet
Author: User

The use of justinmind's computation expression and condition is troublesome for beginners.

Combined with an online tutorial, this article mainly uses the calculation expressions and conditions for the calculator examples.



Goal: calculate the amount automatically based on the unit price (static) and quantity (dynamic. :

Add two rectangular parts to the right of the quantity text box. The top side is +, the bottom side is-, and click + or-automatically minus 1. If the number is 0, the calculation is not allowed.

[STEP] (focus only)


1. Select +; 2. Add events (Click + to set the number of events + 1 ):

3. The event is "when you click the mouse" (default); 4. Select "Set Value" for the action; 5. Select the object part with the set value; 6. Select "Calculate "; 7. Click "(add expression)" to bring up the window:

8 ~ 9. Drag and Drop the "+" in the quantity component and computing function to the number expression above. 10. Enter "1 ":



11 ~ 12 Confirm twice and return to the main Workspace:

13. Add a click event again (calculate the amount based on the changed quantity ):


14 ~ 19. I will not repeat it again. Now the "+" button has added two click events:


Next, we will add the same event to the "-" button, but click "quantity-1" at a time, and determine that when the number is 0, the calculation amount will not be reduced by 1.
We only need to copy the "+" button event and change the number + 1 to-1.
20. If the "+" button is selected, click the "Copy event" icon below:

21. Select the "-" button. 22. Click the paste button below:

23. Double-click the event with the number + 1:
 
24. Edit the expression:

25 ~ 28. Change + -:



29. Add a condition limit on the number-1 event (when the number is greater than or equal to 1)

30 ~ 32. Set the condition judgment:

33. OK. Return to the main workspace and click "simulate" to view the generated prototype:



Justinmind tutorial (2) -- Calculation Expression and condition usage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.