Field of Card of Stack
Jim Ault
JimAultWins at yahoo.com
Sat Dec 8 14:35:58 EST 2007
> There's one catch: if the field is part of a
> background group, it doesn't matter if you use the
> correct card name or number in your control reference:
> it will always return the content of the field of the
> _current_ card of the background.
>
> Hope this avoids some unpleasant surprises,
>
> Jan Schenkel.
Good catch, Jan.
Actually, it could go a little further, if the bg that has the field is:
in the stack but not placed on the current card
in the stack and not placed on any card
in the stack and contains a group
in the stack, on a card, and has more than one group with the same field
name/number
Multiple fields on a card with the same name can happen.
One authoring short cut/valid technique is to group a set of fields and
controls so that group-copy-paste will produce multiples that are
self-contained using a group script. Now the same controls & fields have
the same name, but not the same object id and object hierarchy. This is
where using "the long name of me" should eliminate ambiguity.
try
get the long name of field "dataEyeWant"
--> error if no field exists
answer "Rev found a field"
if ("card id " & the short id of this card) is in it then
answer "looks like the field is on this card"
else
answer "looks like the field is NOT on this card"
end if
catch errrr
answer "Rev could not find the field"
end try
I think Eric Chatonet addresses this in some of his tutorial stacks.
Jim Ault
Las Vegas
On 12/8/07 10:35 AM, "Jan Schenkel" <janschenkel at yahoo.com> wrote:
> --- Eric Chatonet <eric.chatonet at sosmartsoftware.com>
> wrote:
>> Hi Shari,
>>
>> Le 8 déc. 07 à 15:40, Shari a écrit :
>>
>>> If you have a stack with one card, far as I can
>> tell both of the
>>> following work, but shouldn't the second one fail?
>>>
>>> get fld "Seaweed" of cd "Aquaplants" of stack
>> "Waterbabies"
>>
>> Will get the contents of the field in the specified
>> card whatever can
>> be the current card in stack "Waterbabies".
>> You'll use this form to get something in a card that
>> is not currently
>> displayed.
>>
>>> get fld "Seaweed" of stack "Waterbabies"
>>
>> Will get the contents of the field in the the
>> current card of stack
>> "Waterbabies".
>> This will depend on the currently displayed card.
>>
>
> There's one catch: if the field is part of a
> background group, it doesn't matter if you use the
> correct card name or number in your control reference:
> it will always return the content of the field of the
> _current_ card of the background.
>
> Hope this avoids some unpleasant surprises,
>
> Jan Schenkel.
More information about the use-livecode
mailing list