Limitations of 'click'?

Cubist at aol.com Cubist at aol.com
Mon Nov 14 05:06:39 EST 2005


sez livfoss at blueyonder.co.uk:
>I'm trying to traverse a set of fields whose names and numbers I  
>don't reliably know. In fact my plan is to rename them systematically 
>by visiting each one in turn. What I do know is their locations (they 
>form a grid to which the names will be related). I thought I could  
>move along the grid, storing the coordinates of the next field in  
>line in say myNewLoc, and then execute at each iteration:
>
>  click at myNewLoc
>
>or whatever. I can do this, and I am sure that I am clicking on an  
>open field, but this action doesn't seem to set either the clickField 
>or the selectedField, nor send an 'openField' message, so I can't  
>then operate on the field I've clicked on. In fact I find the  
>clickField to be empty and the selectedField to be a field which  
>clearly isn't selected. According to the RR docs, the 'click' command 
>acts as a mouse click, which would AFAIK set both these, so I must be 
>doing something wrong. Can anybody suggest what?
   Given that you absolutely *do* know the locations of the fields in 
question, something like this might do the job for you:

  put "Field List" into ListOFieldz
  repeat with K1 = 1 to the number of fields
    put return & (the short name of field K1 & "," & the loc of field K1) 
after ListOFieldz
  end repeat
  delete line 1 of ListOFieldz

  # okay, we got all the fields. now let's sort them by location
  sort lines numeric of ListOFieldz by item 3 of each
  sort lines numeric of ListOFieldz by item 2 of each

  # right here is a good place to delete unwanted fields,
  #   based on the locations thereof

  # and, moving right along...
  repeat for each line LL in ListOFieldz
    put item 1 of LL into DisFld
    DoWhateverYouWantTo DisFld
  end repeat

   Hope this helps.



More information about the use-livecode mailing list