Page 1 of 2

Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 10:15 pm
by CodeTRUCKER
Please help. I will be happy to try and clarify anything. The object it to use an aircraft's momentum to generate a required runway length for any kind of aircraft. Thank you.

I am getting this error...

button "btnProcess": compilation error at line 3 (Expression: bad factor), char 28
Line 3 is in red...

on mouseUp
// Read the value entered into textboxes into variables
put "MomentumFactorBox" value into MomentumFactor
put "BrakeFactorBox" value into BrakeFactor
put "GroundSpeedBox" value into GroundSpeed
put "WeightBox" value into Weight
put 0 into RollDistance
put GroundSpeed into GroundSpeedLoop
WeightBrakingFactor = (Weight * GroundSpeed) / MomentumFactor
repeat EnteredGroundSpeed for GroundSpeedLoop times
FeetPer100thSecond = (GroundSpeed * 6076.12) / 360000
RollDistance = RollDistance + FeetPer100thSecond
GroundSpeed = GroundSpeed - WeightBrakingFactor
if GroundSpeed > 0
continue
else
end repeat
endif
end repeat

put RollDistance into RunwayRequired

end mouseUp

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 10:26 pm
by Simon
Hi CodeTRUCKER,
Using your sig line as a hint
<> Please do not give me the answer, but show me how to find it. FYI - I have searched diligently before asking.
I tried not to tell you the answer to your first question but to show you where to find it...
I guess it didn't fly.

Do you want a more concrete answer?

Simon

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 10:46 pm
by CodeTRUCKER
Sure. The tag line is mainly to communicate I *am* willing to do the work, but I guess everyone needs a quick-start every now and then. Go ahead and give me the answer this time and in my other thread. I need a boost. :)

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 10:51 pm
by Simon
Here you go.

You need to tell liveCode that MomentumFactorBox is a field. (at least I think it is)

Code: Select all

put field "MomentumFactorBox" into MomentumFactor
How does that sound?

Simon

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 10:55 pm
by CodeTRUCKER
The fog is beginning to clear... I think?

I'll try it and get back to you right away. Thanks!

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 11:09 pm
by CodeTRUCKER
OK, got that and other like errors fixed and sorted out.


Now, how do I go about understanding what this error is telling me?

button "btnProcess": compilation error at line 9 (Expression: double binary operator) near "=", char 4
Line 9 in red...

on mouseUp
// Read the value entered into textboxes into variables
put field "MomentumFactorBox" into MomentumFactor
put field "BrakeFactorBox" into BrakeFactor
put field "GroundSpeedBox" into GroundSpeed
put field "WeightBox" into Weight
put 0 into RollDistance
put GroundSpeed into GroundSpeedLoop
WeightBrakingFactor = (Weight * GroundSpeed) / MomentumFactor
repeat EnteredGroundSpeed for GroundSpeedLoop times
FeetPer100thSecond = (GroundSpeed * 6076.12) / 360000
RollDistance = RollDistance + FeetPer100thSecond
GroundSpeed = GroundSpeed - WeightBrakingFactor
if GroundSpeed > 0
continue
else
end repeat
endif
end repeat

put RollDistance into RunwayRequired

end mouseUp

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 11:17 pm
by Simon
OK I'm going to make you work for this one because I think you know it from the previous stuff.

put something into something

Simon

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 11:22 pm
by dunbarx
Hi.

You are in good hands with Simon, but since he has not replied in over ten seconds...

You must have programmed in other languages, since the construct:

WeightBrakingFactor = (Weight * GroundSpeed) / MomentumFactor

is common to some of those. But in LC you must rewrite as:

put (Weight * GroundSpeed) / MomentumFactor into WeightBrakingFactor

Simon should be showing up any second.

Craig Newman

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 11:25 pm
by Simon
HA
:D :D :D

Simon

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 11:36 pm
by CodeTRUCKER
Another error bites the dust! ... however, there are more, but I am learning.

You are correct, Craig, about previous experience. I have a degree in Computer Science and several years professional experience. BUT! That was a long time ago. The good news is I love coding and hope to make a jingle in my pocket with some unique apps. Time will tell?

Meanwhile, back at the ranch...

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 11:37 pm
by dunbarx
Hey, Simon.

I feel bad about giving up too much to this guy. I see you are taking him to task, and I am being too helpful. Sorry, really.

Craig

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 11:39 pm
by Simon
Hi Craig,
No problem, I was actually trying to copy your technique :)

Simon

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 11:42 pm
by CodeTRUCKER
dunbarx wrote:Hey, Simon.

I feel bad about giving up too much to this guy. I see you are taking him to task, and I am being too helpful. Sorry, really.

Craig
Hi Craig,

No worries. I like to try and tackle coding bugs myself, but I appreciate help when I am lost, like I am here. Thanks for the help!

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 11:46 pm
by CodeTRUCKER
I can see I am going to have to unwrap all the BASIC, COBOL, CICS, Visual Basic and some C++ from around my brain, especially when it comes to formulas. LiveCode is definitely new territory!

The good news is what I have learned I like. It's just gonna take a while to get it all down. It will come. :)

So, what about the learningtounderstandwhatcrypticerrormessagesmean question?

Re: Copying Text Entry Field (textbox) Value Into a Variable

Posted: Mon Oct 14, 2013 11:51 pm
by CodeTRUCKER
Hey Guys!

This just popped up on my screen...

compiling at 5:50:17 PM
Type Expression: double binary operator
Object btnProcess
Line FeetPer100thSecond = (GroundSpeed * 6076.12) / 360000
Hint =

Did you do that? :o