Underneath
Posted: Sat Aug 27, 2016 9:21 am
For a variety of reasons I am trying to set up a stack for children to drag and drop letter tiles onto a grid
with predetermined locations for the tiles.
I cannot use my "normal" drag and drop scripts because children have to be able to clone letter tiles from an "alphabet bank".
So when a child clicks on a template tile in the alphabet bank which contains a script of this sort:
on mouseDown
put the short name of me into IMENA
delete the last char of IMENA
delete the last char of IMENA
delete the last char of IMENA
delete the last char of IMENA
clone me
set the name of the last image to IMENA
set the script of img IMENA to fld "fscrip"
end mouseDown
So, if the child clicks on tile template "X.png" s/he ends up with a new tile called "X"
containing the script contained in field "fscrip"
So far, so good, and no rocket science either.
Now the "board' consists of a series of target tiles. Those that are NOT targets are all called "%9", and those that are targets
have names that contain only one alphabetic character; the alphabetic character of the tile that should be dragged there.
Richmond got stuck at this point.
Jeanne De Voto very kindly stepped in with the 'meat' of this:
on mouseUp
put the short name of me into IMENA
repeat with x = 1 to the number of controls
if within(control x, the mouseLoc) AND (IMENA is in the short name of control x) AND (the ID of the target is not the ID of control x) then
--do nix
else
move me to 1000,700
exit repeat
end if
end repeat
end mouseUp
BUT it doesn't work in that the tile always moves to 1000,700.
This is a sort of micro-version of my stack.
with predetermined locations for the tiles.
I cannot use my "normal" drag and drop scripts because children have to be able to clone letter tiles from an "alphabet bank".
So when a child clicks on a template tile in the alphabet bank which contains a script of this sort:
on mouseDown
put the short name of me into IMENA
delete the last char of IMENA
delete the last char of IMENA
delete the last char of IMENA
delete the last char of IMENA
clone me
set the name of the last image to IMENA
set the script of img IMENA to fld "fscrip"
end mouseDown
So, if the child clicks on tile template "X.png" s/he ends up with a new tile called "X"
containing the script contained in field "fscrip"
So far, so good, and no rocket science either.
Now the "board' consists of a series of target tiles. Those that are NOT targets are all called "%9", and those that are targets
have names that contain only one alphabetic character; the alphabetic character of the tile that should be dragged there.
Richmond got stuck at this point.
Jeanne De Voto very kindly stepped in with the 'meat' of this:
on mouseUp
put the short name of me into IMENA
repeat with x = 1 to the number of controls
if within(control x, the mouseLoc) AND (IMENA is in the short name of control x) AND (the ID of the target is not the ID of control x) then
--do nix
else
move me to 1000,700
exit repeat
end if
end repeat
end mouseUp
BUT it doesn't work in that the tile always moves to 1000,700.
This is a sort of micro-version of my stack.