Copying Text Entry Field (textbox) Value Into a Variable

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

CodeTRUCKER
Posts: 29
Joined: Fri Jul 22, 2011 4:36 pm

Copying Text Entry Field (textbox) Value Into a Variable

Post by CodeTRUCKER » Mon Oct 14, 2013 10:15 pm

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
Last edited by CodeTRUCKER on Mon Oct 14, 2013 10:46 pm, edited 2 times in total.
~ Calvin
<> Please help me find the answer myself, if I can. I have searched diligently before asking.
<> Please allow my wording the benefit of the doubt and I'm not ignoring you, I forgot what we were doing. :)

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post by Simon » Mon Oct 14, 2013 10:26 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

CodeTRUCKER
Posts: 29
Joined: Fri Jul 22, 2011 4:36 pm

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

Post by CodeTRUCKER » Mon Oct 14, 2013 10:46 pm

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. :)
~ Calvin
<> Please help me find the answer myself, if I can. I have searched diligently before asking.
<> Please allow my wording the benefit of the doubt and I'm not ignoring you, I forgot what we were doing. :)

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post by Simon » Mon Oct 14, 2013 10:51 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

CodeTRUCKER
Posts: 29
Joined: Fri Jul 22, 2011 4:36 pm

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

Post by CodeTRUCKER » Mon Oct 14, 2013 10:55 pm

The fog is beginning to clear... I think?

I'll try it and get back to you right away. Thanks!
~ Calvin
<> Please help me find the answer myself, if I can. I have searched diligently before asking.
<> Please allow my wording the benefit of the doubt and I'm not ignoring you, I forgot what we were doing. :)

CodeTRUCKER
Posts: 29
Joined: Fri Jul 22, 2011 4:36 pm

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

Post by CodeTRUCKER » Mon Oct 14, 2013 11:09 pm

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
~ Calvin
<> Please help me find the answer myself, if I can. I have searched diligently before asking.
<> Please allow my wording the benefit of the doubt and I'm not ignoring you, I forgot what we were doing. :)

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post by Simon » Mon Oct 14, 2013 11:17 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Mon Oct 14, 2013 11:22 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post by Simon » Mon Oct 14, 2013 11:25 pm

HA
:D :D :D

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

CodeTRUCKER
Posts: 29
Joined: Fri Jul 22, 2011 4:36 pm

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

Post by CodeTRUCKER » Mon Oct 14, 2013 11:36 pm

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...
~ Calvin
<> Please help me find the answer myself, if I can. I have searched diligently before asking.
<> Please allow my wording the benefit of the doubt and I'm not ignoring you, I forgot what we were doing. :)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Mon Oct 14, 2013 11:37 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post by Simon » Mon Oct 14, 2013 11:39 pm

Hi Craig,
No problem, I was actually trying to copy your technique :)

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

CodeTRUCKER
Posts: 29
Joined: Fri Jul 22, 2011 4:36 pm

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

Post by CodeTRUCKER » Mon Oct 14, 2013 11:42 pm

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!
~ Calvin
<> Please help me find the answer myself, if I can. I have searched diligently before asking.
<> Please allow my wording the benefit of the doubt and I'm not ignoring you, I forgot what we were doing. :)

CodeTRUCKER
Posts: 29
Joined: Fri Jul 22, 2011 4:36 pm

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

Post by CodeTRUCKER » Mon Oct 14, 2013 11:46 pm

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?
~ Calvin
<> Please help me find the answer myself, if I can. I have searched diligently before asking.
<> Please allow my wording the benefit of the doubt and I'm not ignoring you, I forgot what we were doing. :)

CodeTRUCKER
Posts: 29
Joined: Fri Jul 22, 2011 4:36 pm

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

Post by CodeTRUCKER » Mon Oct 14, 2013 11:51 pm

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
~ Calvin
<> Please help me find the answer myself, if I can. I have searched diligently before asking.
<> Please allow my wording the benefit of the doubt and I'm not ignoring you, I forgot what we were doing. :)

Post Reply