Initializing Number Fields on Startup

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

Initializing Number Fields on Startup

Post by CodeTRUCKER » Mon Oct 14, 2013 8:52 pm

How do I initialize various fields when a LC application is executed? Here is what I tried, but I don't get any results...

(open the stack, "stkMain")

Code: Select all

put 0 into GroundSpeed
(the text box, "groundspeedbox" does not show a "0" like it is supposed to)

Please help.
Last edited by CodeTRUCKER on Tue Oct 15, 2013 12:03 am, edited 1 time 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: Initializing Number Fields on Startup

Post by Simon » Mon Oct 14, 2013 9:13 pm

Hi CodeTRUCKER,
Welcome to the forums!
put 0 into GroundSpeed
You have not told the engine the container type you want to put it in. Right now it's thinking GroundSpeed is a variable.

Here is a lesson that should help:
http://lessons.runrev.com/s/lessons/m/2 ... rld-3-ways

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: Initializing Number Fields on Startup

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

Thank you for the welcome, Simon!

FYI - "GroundSpeed" is a variable. [Calvin scratches head as he makes his way to the lesson...]
~ 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: Initializing Number Fields on Startup

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

Hi Calvin,
Ahh I see, you haven't made any link between groundspeed and groundspeedBOX
Sorry I read it too quickly the first time.

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: Initializing Number Fields on Startup

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

Hi Simon,

Code: Select all

put 0 into GroundSpeed
put GroundSpeed into GroundSpeedBox
Nope, still not working. I have read the page 3 times including reading it last night. I'm just not "getting it."

Take Two! :mrgreen:
~ 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: Initializing Number Fields on Startup

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

OK...
What is groundspeedbox?

Code: Select all

put 0 into GroundSpeed
put GroundSpeed into GroundSpeedBox
You will have to tell liveCode what it is... errr... groundspeed we know is a variable, right now liveCode thinks groundspeedbox is one as well.

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

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

Re: Initializing Number Fields on Startup

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

OK stopping this thread.
Please see:
http://forums.runrev.com/phpBB2/viewtop ... =7&t=17528

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: Initializing Number Fields on Startup

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

Ah! You mean something like...

put 0 into GroundSpeed
put GroundSpeed into textbox(GroundSpeedBox)

I have looked for several hours since last night trying to locate *how* to read and wite into text fields. No joy yet (which is why I posted). It may take a while before I learn how LC does what.
~ 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: Initializing Number Fields on Startup

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

Simon wrote:OK stopping this thread.
Please see:
http://forums.runrev.com/phpBB2/viewtop ... =7&t=17528

Simon
Hi Simon,

Not a good idea (for me, at least). I get very confused easily if there are numerous things going on at the same time. Please let me continue this subject in this thread, if that is OK?
~ 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: Initializing Number Fields on Startup

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

Moving on...

Do I have to structure it...

Code: Select all

put 0 into GroundSpeed
put GroundSpeed into GroundSpeedBox
Or can I just code it like this...

Code: Select all

put "0" into field GroundSpeedBox
Seems like the second one would work?
~ 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: Initializing Number Fields on Startup

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

Yup. but quote the fields name
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: Initializing Number Fields on Startup

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

Simon wrote:Yup. but quote the fields name
I tried...

Code: Select all

put "0" into field "GroundSpeedBox"
..., but it still doesn't work. I feel like an idiot.
~ 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: Initializing Number Fields on Startup

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

Not sure but check very carefully for spaces in the field name
maybe a return?

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: Initializing Number Fields on Startup

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

Thanks for letting me keep the thread. :)

No spaces or returns.

Ok, let me ask you to code the following...

1. You have an app named "Simon's App."
2. When it opens you want a textbox to contain, "123."

How would *you* code it?
~ 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: Initializing Number Fields on Startup

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

Hi Calvin,
The simple answer is just to save the app with 123 in the field.
But that is not what you are asking I think.

Start with a new stack put 1 button and 1 field on it (really new stack, no cheating)
in the button script put

Code: Select all

on mouseUp
put "123" into fld 1
end mouseUp
note fld is short for field
fld 1 is the lowest "layered" field

That should help you find out what is wrong with GroundSpeedBox naming

more to what you want, in the card script

Code: Select all

on openCard
put "123" into fld 1
end openCard
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply