Underneath
Randy Hengst
iowahengst at mac.com
Sat Aug 27 10:43:12 EDT 2016
Well, assuming you are following the same sort of naming procedure for all tiles and grid names… then what about
on mouseDown
grab me
end mouseDown
local tShortNameOfTarget
on mouseUp
put the short name of target into tShortNameOfTarget
repeat with x = 1 to the number of controls
if the loc of target is within the rect of control x then
if (tShortNameOfTarget is in the short name of control x) AND (the ID of the target is not the ID of control x) then
set the loc of target to the loc of control x
exit repeat
else
move me to 350,350
end if
end if
end repeat
end mouseUp
> On Aug 27, 2016, at 9:38 AM, Richmond <richmondmathewson at gmail.com> wrote:
>
> Well, let's contextualise that:
>
> It works in my example stack #3: http://forums.livecode.com/viewtopic.php?f=7&t=27837&p=145849#p145849
>
> but NOT in my stack with multiple targets.
>
> Richmond.
>
> On 27.08.2016 17:29, Richmond wrote:
>> That works!
>>
>> Thank you.
>>
>> R.
>>
>> On 27.08.2016 16:24, Randy Hengst wrote:
>>> Try this in the image “P” script
>>>
>>> on mouseUp
>>> repeat with x = 1 to the number of controls
>>> if the loc of target is within the rect of control x then
>>> if ("P" is in the short name of control x) AND (the ID of the target is not the ID of control x) then
>>> set the loc of target to the loc of control x
>>> exit repeat
>>> else
>>> move me to 350,350
>>> end if
>>> end if
>>> end repeat
>>> end mouseUp
>>>
>>>
>>>> On Aug 27, 2016, at 3:22 AM, Richmond <richmondmathewson at gmail.com> wrote:
>>>>
>>>> I'm obviously getting something rather wrong, so I have uploaded something here as explaining things without a sample stack and a pretty picture is well-nigh impossible:
>>>>
>>>> http://forums.livecode.com/viewtopic.php?f=7&t=27837
>>>>
>>>> Richmond.
>>>>
>>>> On 27.08.2016 00:59, Jeanne A. E. DeVoto wrote:
>>>>> At 12:27 AM +0300 8/27/2016, Richmond wrote:
>>>>>> This doesn't seem to work because this cycles through ALL the controls, and, of course,
>>>>>> the object being dragged is also a control.
>>>>>
>>>>> Ah. Forgot about that. You'll need to add a condition:
>>>>>
>>>>> if within(control x, the mouseLoc) \
>>>>> AND ("P" is not in the short name of control x)
>>>>> AND (the ID of the target is not the ID of control x) then
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> use-livecode at lists.runrev.com
>>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list