On Mon, 14 Nov 2005 05:06:39 EST, [EMAIL PROTECTED] wrote:
sez [EMAIL PROTECTED]:
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.
Thanks very much - I get the idea (the only tricky bit is the
discarding of irrelevant fields some of which have exactly the same
location as the relevant ones, but are stacked lower): but I can do
it, in fact. So thanks to you I could solve the immediate problem.
However I remained extremely curious about the operation of 'click'.
I tried an experiment with a one-card stack containing a single
field, and 'click at' worked as advertised, firing off an 'openField'
which could be run in the card script as easily as in the field
itself (which is what I wanted). Eventually I realised that I had
some kind of timing problem in the original solution. It evolved to
the point where at the click of a button, I ran a loop which
traversed my fields, but the actual work was done in an 'openField'
handler invoked by my click. This tended to crash or produce the
wrong result until I introduced a delay into the loop, like
click at myCalculatedLoc
wait 50 milliseconds
After that it worked perfectly. It seems to me that the message path
was more complex than I had imagined: I thought that as soon as the
'click' was executed, control would pass to the openField handler and
it wouldn't get back to my button script until the handler was done -
but this wasn't exactly the case. I haven't got time to work out what
the problem really was, but I'm afraid that one of these days it will
come up and bite me.
Graham
------------------------------------------------------------------------
---
Graham Samuel / The Living Fossil Co. / UK and France
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution