Explore the community Forums Lectora Lectora Questions & Answers Creating a Calculator in Lectora 11

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #281879 Score: 0
    Profile photo of Cedwards
    Cedwards
    Member
    @Cedwards

    Does anyone know how to create a simple calculator that adds, subtracts, multiplies & divides in Lectora 11?

    Thank you,

    #285403 Score: 0
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    336 pts
    @ssneg

    I do.

    #285404 Score: 0
    Profile photo of Cedwards
    Cedwards
    Member
    @Cedwards

    Would you mind sharing?

    #285402 Score: 0
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    336 pts
    @ssneg

    Lectora way:

    1. add input field A (variable A)
    2. add input field B (variable B)
    3. add text field named “Result-Text”
    4. add variable named “Result”
    5. add button called “Plus” with two actions:
    5.1. set variable “Result” to VAR(A) + VAR(B)
    5.2. change content of “Result-Text” to variable “Result”
    6. repeat step 5 for subtraction, division, multiplication or any other math action

    Script way:

    1. Add a proper JS calculator from http://plugins.jquery.com/kbw.calculator/ or from http://www.jquery4u.com/plugins/5-jquery-mobile-calculation-calculators/ or anywhere else. Or write your own.

    Smart way:

    1. Consider this: every Windows, Mac, iOS or Android user already has a great, familiar, convenient calculator app in their computer or tablet.
    2. Also consider this: every human being has a cell phone that has a calculator function, even if it’s a 15-year old Motorola.

    #285405 Score: 0
    Profile photo of Sarahrd79
    Sarahrd79
    Member
    @Sarahrd79

    Ok – I can get so far but the results do not end up in the results-text box. I get VAR(A)XVAR(B) – so it is like the connection to the Results Text box needs a code but there seems something missing in the instructions below. Can someone help me figure this out? I need better step by step instructions on how to create a calculation

    8 X 2 = 16 – 8 = a entry box from the Test/Survey area and same with the 2
    = has the variable to click on the equal – OnMCLkModVAR – Target REsult Type Set Equal to Value VAR(A)XVAR(B)
    second action – ONMCLKChange – Target – Results-Text Value – Result

    It seems that Result is missing the link – not sure how to get it associated to the end result answer

    ?????????????

    #285401 Score: 0
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    321 pts
    @timk

    For a multiplication button you’ll need a variable for the results of your calculation (e.g. “results”), and a textfield to display the variable

    1.
    On: Click
    Action: Modify variable
    Target: results
    Type: Set equal to
    Value: VAR(Entry_0001) (Insert the correct name of the variable associated with the first entry field)

    2.
    On: Click
    Action: Modify variable
    Target: results
    Type: Multiply Variable by
    Value: VAR(Entry_0002)

    3.
    On: Click
    Action: Change contents
    Target: Results Tex Block
    Value: results

    Tim

    #285400 Score: 0
    Profile photo of kellykungfu
    kellykungfu
    Member
    @kellykungfu

    @ssneg 50268 wrote:

    Lectora way:

    1. add input field A (variable A)
    2. add input field B (variable B)
    3. add text field named “Result-Text”
    4. add variable named “Result”
    5. add button called “Plus” with two actions:
    5.1. set variable “Result” to VAR(A) + VAR(B)
    5.2. change content of “Result-Text” to variable “Result”
    6. repeat step 5 for subtraction, division, multiplication or any other math action

    Script way:

    1. Add a proper JS calculator from http://plugins.jquery.com/kbw.calculator/ or from http://www.jquery4u.com/plugins/5-jquery-mobile-calculation-calculators/ or anywhere else. Or write your own.

    Smart way:

    1. Consider this: every Windows, Mac, iOS or Android user already has a great, familiar, convenient calculator app in their computer or tablet.
    2. Also consider this: every human being has a cell phone that has a calculator function, even if it’s a 15-year old Motorola.

    Hey Sergey,

    I like your responses especially the “Smart Way”! Wait till someone asks how to build a clock…

    -kelly

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.