Re: How detect the object over other object is?

2010-12-20 Thread James Hurley


Message: 14
Date: Sun, 19 Dec 2010 23:41:05 -0800 (PST)
From: JosepM 
To: use-revolut...@lists.runrev.com
Subject: Re: How detect the object over other object is?
Message-ID: <1292830865948-3095145.p...@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Yes, but I need to check for each, isn't other way to do?


Salut,
Josep
--  
View this message in context: http://runtime-revolution.278305.n4.nabble.com/How-detect-the-object-over-other-object-is-tp3094859p3095145.html

Sent from the Revolution - User mailing list archive at Nabble.com.




With a slight variation on Craig's solution you can get a list of all  
controls intersecting all others with


on mouseup
   put the number of controls into N
   repeat with i = 1 to N
  repeat with j = i+1 to N
 put intersect(control i, control j) into theyIntersect
 if theyIntersect then put the id of control i &  " interects  
"  & the id of control j & cr after tList

  end repeat
   end repeat
   answer tList
end mouseup

Although the following is redundant (that is if a intersects b, then b  
intersect a) it may be useful as well:


on mouseup
   put the number of controls into N
   repeat with i = 1 to N
  repeat with j = 1 to N
 if i = j then next repeat --Self intersection
 put intersect(control i, control j) into theyIntersect
 if theyIntersect then put the id of control i &  " interects  
"  & the id of control j & cr after tList

  end repeat
   end repeat
   answer tList
end mouseup

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How detect the object over other object is?

2010-12-20 Thread DunbarX
Josep.

If you have a particular target object, why not simply test whether it 
intersects with all other objects? In the target object script:

on mouseup
repeat with y = 1 to the number of controls
   put "control id" && the id of ("control" && y) into temp
 put temp && ":" && intersect(me,temp) into line y of accum
end repeat
answer accum
end mouseup

Good luck.

Craig Newman
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How detect the object over other object is?

2010-12-19 Thread JosepM

Yes, but I need to check for each, isn't other way to do? 


Salut,
Josep
-- 
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/How-detect-the-object-over-other-object-is-tp3094859p3095145.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How detect the object over other object is?

2010-12-19 Thread DunbarX
Easy. Read about the "intersect" function in the dictionary.

Craig Newman
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


How detect the object over other object is?

2010-12-19 Thread JosepM

Hi,

I move a graphic over others graphics and I need to know the object ID or
name over the moved object is.
Like moving a chess pieces over the board. The user move one piece and I
need to know over what is located.

I see that I can check if the location of the moved piece is into the rect
of the graphic, but I need to check all the posibles zones. Is this the way?
 
Any idea how to deal with?



Salut,
Josep
-- 
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/How-detect-the-object-over-other-object-is-tp3094859p3094859.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode