Repeat question

Bob Sneidar bobs at twft.com
Tue May 4 14:36:48 EDT 2010


Hi steve. 

First, you are using the wrong form of repeat. You need an index to the field you are referencing, so your repeat loop should start like this:

> REPEAT with theFieldNumber = 1 to the number of fields on the card

Now in your repeat loop you can refer to field theFieldNumber which will increment each iteration. 

>   if field theFieldNumber is empty



You don't need 
>      go to next field

as the repeat loop will increment the reference to the field number in it's next loop. 

You CAN refer to fields by their index ie. field 1, field 2 etc. This has nothing to do with the ID number. To refer to a field by ID you would say field ID 23725 or some such thing. But remember that this becomes problematic when duplicating fields or making copies of stacks then working with the copies. The field ID's will be different in the copy. Most people rarely use the ID's to refer to an object. 

Bob


On May 4, 2010, at 11:15 AM, Steve Jones wrote:

> An area I never mastered with SuperCard and still have trouble with in RR is using the repeat control structure...
> 
> I want to check every field on a card before it closes to be sure none are EMPTY.
> 
> I know the structure would be
> 
> REPEAT for the number of fields on the card
>   if field 1 is empty
>      put up an alert
>   else
>      go to next field
>   end if
> end repeat
> 
> or something similar.
> 
> How do I refer to the fields?  Their IDs aren't sequential and there names aren't "numbered".
> 
> Thanks!
> 
> Steve
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list