populating a var instead of directly a field don't working ???

Andre.Bisseret Andre.Bisseret at inria.fr
Tue Jan 27 03:58:53 EST 2009


Hello,

In a stack I have two fields :

One, « towns » is a list of towns where when a line is clisked, I put  
the name of the town in « tthisTown »

The other field « statClients», is a big list each line of which  
includes a number of items separated with tab ; the first item being  
the town.

I wish to get in a third field, say « results », only the lines  
concerning the clicked town.

The following Handler in the script of field « towns » is working well :

ON mouseUp

     local tThisTown,

     lock screen

     put value(the selectedLine) into tThisTown

put empty into fld "results"

     select before fld "statClients"

    REPEAT

         find whole tThisTown in fld "statClients"

         IF the result is "not found" THEN exit mouseUp

         put value(the foundLine) & cr after fld "results"

     END repeat

END mouseUp

Thinking that it would increase speed, I tried the following handler  
that differs from the preceding only by accumulating the lines found  
in « statClients » in a variable instead of directly in the field «  
results » (at each repeat)

ON mouseUp

     local tThisTown,tVar

     ---------

     put value(the selectedLine) into tThisTown

  put empty into tVar

     select before fld "statClients"

     REPEAT

         find whole tThisTown in fld "statClients"

         IF the result is "not found" THEN exit mouseUp

         put value(the foundLine) & cr after tVar

     END repeat

     put tVar into fld "results"

END mouseUp

This handler does not work ; I get nothing in fld “results”.

I seem getting crasy because I don’t see at all why :-(( (seems to me  
that I wrote similar handlers hundreds of times !!!)


Where am I wrong in this second handler ?

Thanks a lot in advance for any help

Best regards from Grenoble

André



More information about the use-livecode mailing list