473,786 Members | 2,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to determine if one control overlaps the other?

Jay
Hi all,

I know how to find a controls' position obviously (i.e.style left,
right, top, offset, etc.), but what I'm a little stumped on is, if
given two controls' positions, how can I tell if one is overlapping/
invading the space of the other?

For example, I have an AJAX dragpanel and am experiencing the common
'bleed through' of dropdown controls when I drag the panel over them.
Naturally the customer doesn't like this. I experimented a little with
the IFrame solution, but did not have much luck. It seems easier now
to just use the 'ondragend' event and show/hide dropdowns accordingly.

Does anyone have a piece of code where, given two control objects as
passing parameters, it returns true or false in regards to them
overlapping or not?

THANK YOU...

Oct 3 '07 #1
4 3182
Jay wrote:
I know how to find a controls' position obviously (i.e.style left,
right, top, offset, etc.), but what I'm a little stumped on is, if
given two controls' positions, how can I tell if one is overlapping/
invading the space of the other?
Compare the coordinates of the corners of one element against the
coordinates of the corresponding corners of the other one.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
Oct 3 '07 #2
On Oct 4, 8:45 am, David Mark <dmark.cins...@ gmail.comwrote:
On Oct 3, 2:26 pm, Jay <Jay.Pomp...@gm ail.comwrote:
[...]
For example, I have an AJAX dragpanel and am experiencing the common
I don't see what AJAX has to do with this, but anyhow...
'bleed through' of dropdown controls when I drag the panel over them.

That's because you didn't hide the inputs when the drag operation
started.
Inputs? I think you mean select elements. Hiding them to stop them
"showing through" is pretty ugly from a users' perspective.

Naturally the customer doesn't like this. I experimented a little with
the IFrame solution, but did not have much luck. It seems easier now

That Iframe "solution" is not a solution (it is an ugly workaround.)
Maybe, but it is a much better solution than toggling their
visibility.
[...]
>
Does anyone have a piece of code where, given two control objects as
passing parameters, it returns true or false in regards to them
overlapping or not?
There is no need to determine if they overlap - cover all of them with
iFrames. You can create all the iFrames at any time before dragging
starts, you might be able to put them in the source HTML but likely
script is better, then just toggle their display property (use a class
and CSS) when dragging starts and again when it ends. If the iFrames
have no visible style, they're invisible, the user will never know
you've done it.

During testing/debugging, give the iFrames a background colour to help
with making sure they're in the right spot.
--
Rob

Oct 4 '07 #3
On Oct 4, 2:00 pm, David Mark <dmark.cins...@ gmail.comwrote:
On Oct 3, 10:17 pm, RobG <rg...@iinet.ne t.auwrote:
On Oct 4, 8:45 am, David Mark <dmark.cins...@ gmail.comwrote:
On Oct 3, 2:26 pm, Jay <Jay.Pomp...@gm ail.comwrote:
[...]
Naturally the customer doesn't like this. I experimented a little with
the IFrame solution, but did not have much luck. It seems easier now
That Iframe "solution" is not a solution (it is an ugly workaround.)
Maybe, but it is a much better solution than toggling their
visibility.

Hardly. Creating a bunch of non-standard "dummy" elements and then
going through all of the mess of positioning them
That can be done in a few lines of code with a reasonable position
function. The one at Javascript Toolbox seems to do the job OK.

is not a better
solution than simply hiding the inputs during the drag operation.
Clearly the inputs are not drop targets, so there is no reason they
need to be visible while dragging.
Yeah, a bit of playing shows IE makes life tough. I normally only use
iFrames under other elements, I'd forgotten that you can't make them
pretty in IE.

How about a single iFrame under the drag object that moves with it?
Then there's no need to find and hide the selects - I just hate the
idea the selects flashing on and off.
--
Rob

Oct 4 '07 #4
Jay
Thanks for all your 'wonderful' insight...Much obliged.

Oct 4 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3955
by: axion_sa | last post by:
Hi, What I have is a booking table, and when updating/inserting I need to ensure that there are no date/time overlaps. The problem I'm having is that while the following script works for events on the same day, it fails miserably when a booking starts on a previous day.
18
2889
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code that applies to all these events, but I need to have specific code execute when the form closes. The properties for this method are sender (the originator) and e (event arguments). I know how to get typeof (sender) to determine what form or...
17
6888
by: No One | last post by:
Is there a way to keep a control centered inside a form without having to recalculate everytime the form is resized?
6
1739
by: Tom McLaughlin | last post by:
How can I determine the numbers of lines of text that are visible in a textbox? Tom
3
11589
by: Developer in California | last post by:
I am working on developing a generic Web framework using Master Pages in ASP.NET 2.0. What I have done is created a PageRenderer class which has a public method which will retrieve the path of the content I want to execute based on the name of the asp:Content control. As shown in the code snippet below, to get the content I want to display, I call the GetContentPagePath public method in PageRenderer passing a string duplicating the value...
1
1111
by: antonyliu2002 | last post by:
I am using the server side Toggle Controls implemented by Jos (cf: http://www.codeproject.com/aspnet/ToggleControls.asp), which is pretty cool, if you wanna toggle controls. On my web page, I have, for example: Fruit + Vegitable + Soda +
4
3253
by: dBNovice | last post by:
Hello all, i will definitely appreciate any help I can get on this.... I have a db that has 3 tables and 3 respective forms: task, subtask and element. Subtask is a subform of task. Element is a subform of subtask. Each form overlaps the other. You can call the other 2 forms from within the current form. The problem I am experiencing is that whenever I add the MS DTPicker on the Task form it shows up on the other two form. Also...
2
2345
by: jaleel | last post by:
I have an aspx page containing a menu and some other controls including dropdown list.The problem is when i hover the mouse on menu control it displays all menu items. But the part where dropdown control is renderd the menu part is gone behind the dropdown. I heard that it is aproblem of IE6 and related to z-index and all. My sceario is like this: 1.I have a user control which contains the menu .This also contains some javascript to...
1
3791
by: prpradip | last post by:
In my application ListView is inside panel (XP theme enable), item text in the ListView control overlaps other items in small icon view. The items are drawn as if aligned to a grid and this causes items to be drawn in overlapped manner which obviosuly looks horrrible. I have tried to change allignment with no success. There is no problem regarding List and Details mode. What might be the problem?
0
9650
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8992
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.