Forcing a variable to evaluate as an object reference

iMed Edition info at imed-edition.net
Tue Sep 12 02:26:32 EDT 2006


David,

Your post remembers me probleme I encountered related to Bugzilla Bug  
3648. One of the solutions could be the following:

> on yeschangeit
>    ...
>    repeat for each line i in field "langfields"

Be aware that if you change the content of field "langfields" inside  
the repeat loop, surely you will get an unexpected value for i in the  
next loop. So best practice is to first put the content of the field  
in a variable before the repeat statement, i.e.:

       put field "langfields" into tLangList
       repeat for each line i in tLangList

>      put "field " & i into twhere
>      get the Language[glanguage] of twhere
>      put it into field i

          put the Language[glanguage] of fld i into fld i -- is ok  
for me now

>    end repeat
> end yeschangeit

so the new handler would be (and this works for me):

on yeschangeit
   global glanguage
   put field "langfields" into tLangList
   repeat for each line i in tLangList
     put the Language[glanguage] of fld i into fld i -- is ok for me
   end repeat
end yeschangeit

If this does not work you can send us a sample stack and we will find  
the bug to fix.

Hope this helps!



More information about the use-livecode mailing list