define a text entry field as a variable on a button

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

Post Reply
sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

define a text entry field as a variable on a button

Post by sms5138 » Mon Mar 16, 2015 4:28 pm

Hi!

My subject pretty much says it all. I've been looking online, and unable to locate the answer to this question. I'm trying to put text into a text field on a card, then when clicking a button have the button take the text from that field, and define that text as a variable. If someone has any suggestions, or resources, that I may not have looked into I would greatly appreciate it.

I hope this is clear enough, but please let me know if i've asked this question poorly.

Thanks in advance!

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

Re: define a text entry field as a variable on a button

Post by dunbarx » Mon Mar 16, 2015 4:36 pm

Hi.

Firstly, where are you with learning LC? Have you made a stack or any sort of application before? I only ask so that if I tell you that in order to put text into a field, you would know how to:

Code: Select all

put yourText into field "yourField"
And then if you wanted that other button thing:

Code: Select all

on mouseUp
put field "yourField" into yourVariable
end mouseUp
Now this does what you wanted, and may I assume from within that handler, you can further process the information in that variable (yourVariable)? Know that as written, the variable will be discarded when the handler ends. If you need to save it, that is another story, and you need to write back.

Craig Newman
Last edited by dunbarx on Mon Mar 16, 2015 4:37 pm, edited 1 time in total.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: define a text entry field as a variable on a button

Post by Klaus » Mon Mar 16, 2015 4:36 pm

Hi Sean,

do you mean something like this?

Code: Select all

global the_var_with_the_text_from_field
on mouseiup
  put fld "your text field here..." into the_var_with_the_text_from_field
end mouseup
Depending on your needs the var may also be LOCAL.

Here some great learning resources:
http://www.hyperactivesw.com/revscriptc ... ences.html

Best

Klaus

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

Re: define a text entry field as a variable on a button

Post by dunbarx » Mon Mar 16, 2015 4:38 pm

Klaus.

BEAT YOU!!! :mrgreen:

Craig

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: define a text entry field as a variable on a button

Post by Klaus » Mon Mar 16, 2015 4:48 pm

DAMN! :D



Your message contains 8 characters. The minimum number of characters you need to enter is 10.

sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

Re: define a text entry field as a variable on a button

Post by sms5138 » Mon Mar 16, 2015 11:32 pm

That worked like a charm! Thank you both for the quick follow up.

Post Reply