Hi John,
>I need the algorithm (in VFP) to determine if two containers on a form overlap at any point. The code I did now has 8 Between() statements and still does not cover all possibilities.
That's the same problem as figuring out whether two date ranges overlap (
http://www.foxpert.com/knowlbits_200711_1.htm). The key is that it's much easier to find out when there's no overlap, rather when there's an overlap. Therefore you need to approach this from the opposite direction:
Local llxAxis, llyAxis, lo1, lo2
lo1 = Thisform.Container1
lo2 = Thisform.Container2
llxAxis = (NOT((lo2.Left+lo2.Width < lo1.Left) or (lo2.Left > lo1.Left+lo1.Width)))
llyAxis = (NOT((lo2.Top+lo2.Height < lo1.Top) or (lo2.Top > lo1.Height+lo1.Height)))
If m.llxAxis and m.llyAxis
MessageBox("Overlap")
Else
MessageBox("No overlap")
EndIf
--
Christof