Arrays of field controls
Frank D. Engel, Jr.
fde101 at fjrhome.net
Sat Nov 20 10:36:11 EST 2004
The other way to do it, if you want "nicer" names, is to have a
separate (invisible) field or a property (of a card or stack) and list
the field names in it, perhaps one per line. Now you can do this:
repeat for each line ndx of field "fieldNames"
put field ndx into array[ndx]
end repeat
This has the advantage of allowing you to more conveniently pick
something out by name later on:
put array["Name"] & the lineDelimiter & array["Address"] & the
lineDelimiter & array["City"] & ", " & array["State"] && \
array["Zip Code"] into labelText
(as an example).
Obviously, you could also restore the array into the fields:
repeat for each line ndx of field "fieldNames"
put array[ndx] into field ndx
end repeat
On Nov 20, 2004, at 10:10 AM, MisterX wrote:
> just name your fields as
>
> data1
> data2
> data3
>
> then in your loop
>
> repeat with x = 1 to azillion
> put field ("data"&x) into array[x]
> end repeat
>
> if your fields are already alligned like having a field 1, field 2,
> etc..
> you dont even need to name them!
> put fld x into array[x]
>
> cheers
> X[array]
>
>
>> -----Original Message-----
>> From: use-revolution-bounces at lists.runrev.com
>> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of
>> gwalias-rev at yahoo.com
>> Sent: Saturday, November 20, 2004 15:53
>> To: Revolution Mailing List
>> Subject: Arrays of field controls
>>
>> Dear Revolutionaries
>>
>> Is there some way to refer to a group of controls as if they
>> were in an array. Here's what I want to do ...
>>
>> I have several text fields for a user to enter information
>> and once they click "Accept", I want to store them in a
>> single array variable. I would like to be able to just
>> iterate over the list of text fields and store each entry in
>> the array, instead of having to go throughand explicitly
>> reference each text field.
>> That way, I can always add or remove fields without breaking
>> the logic, or use the same approach in other parts of my
>> program for different data.
>>
>> I apologise if this is an obvious question, I am still
>> evaluating Revolution for the 30 days.
>>
>> Best
>>
>> Gordon
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
-----------------------------------------------------------
Frank D. Engel, Jr. <fde101 at fjrhome.net>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten
Son, that whosoever believeth in him should not perish, but have
everlasting life.
$
___________________________________________________________
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com
More information about the use-livecode
mailing list