Yes this is quite possible to solve. But can you tell me a little
more about the situation:
You set up the calculation to take place... when? When something is
typed into one of the 2 first fields? on exitframe? when clicking a
button?
One way to go would be to let the calculation be triggered by keyUp
events in the 2 input fields. Then you would get this kind of
behavior while typing in input field 2:
|In1 |In2 |Sum |
|10 |1 |10 |
|10 |12 |120 |
|10 |126 |1260 |
When typing in the Sum field nothing happens, because it doesn't trig
a calculation.
The code could be a lot simpler if you hardcoded the member and
sprite names into the behaviors, but I wanted to make it as universal
as possible.
Put this in a behavior. Put the behavior on each of the input fields:
--
on keyUp me
firstValue = sprite(me.spriteNum).member.text
sendAllSprites(#setFirstValue, firstValue)
sendAllSprites(#sendSecondValue, me)
sendAllSprites(#addValues)
end
on sendSecondValue me, _caller
if _caller <> me then
secondValue = sprite(me.spriteNum).member.text
put "sending 2nd value: " & secondValue
sendAllSprites(#setSecondValue, secondValue)
end if
end
--
-- And put this in a behavior on the sum sprite:
--
property firstValue
property secondValue
on setFirstValue me, _firstValue
firstValue = _firstValue
end
on setSecondValue me, _secondValue
secondValue = _secondValue
end
on addValues me
sum = firstValue + secondValue
sprite(me.spriteNum).member.text = sum.integer.string
end
--
>Hello,
>
>I'm having a problem that I'm sure one of you brilliant people will have
>no problem with.
>
>I have a simple calculation (three fields: two input fields and one Sum
>field, it simply adds the two input fields)
>
>What I need to have happen is if the user would put a value that would
>differ from the value created by the calculation into the sum field; I
>no longer have need for the calculation to take place.
>
>So, I've racked my brain on this and came up with a global variable that
>if the user clicks the sum field then no calculation. Works Great but,
>if you would like to tab to the sum field it never recognizes that you
>put your own value into the sum field.
>
>So I need to find a way of having this work so, if the user tabs to the
>sum field and changes the value it will no longer calculate.
>
>Any ideas and suggestions would be greatly appreciated.
>
>Thank you,
>
>Mattie
>
>
>[To remove yourself from this list, or to change to digest mode, go
>to http://www.penworks.com/lingo-l.cgi To post messages to the
>list, email [EMAIL PROTECTED] (Problems, email
>[EMAIL PROTECTED]). Lingo-L is for learning and helping with
>programming Lingo. Thanks!]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]